| 10162 | configTable.appendChild(configTbody); |
| 10163 | configCon.appendChild(configTable); |
| 10164 | function createCheckbox(innerText, val, tag, parentCheck, otherType, alwaysShow) { |
| 10165 | if (typeof val == 'undefined') val = ""; |
| 10166 | let title = document.createElement(tag || "h3"); |
| 10167 | setHTML(title, innerText); |
| 10168 | title.style.overflowWrap = "normal"; |
| 10169 | let input = document.createElement("input"); |
| 10170 | if (otherType === 'key') { |
| 10171 | input.type = 'text'; |
| 10172 | input.setAttribute('readOnly', 'readonly'); |
| 10173 | input.addEventListener("keydown", e => { |
| 10174 | if (e.key === 'Escape' || e.key === 'Backspace') input.value = ''; |
| 10175 | else input.value = e.key; |
| 10176 | e.stopPropagation(); |
| 10177 | e.preventDefault(); |
| 10178 | }); |
| 10179 | } else { |
| 10180 | input.type = otherType || "checkbox"; |
| 10181 | } |
| 10182 | input.style.width = "35px"; |
| 10183 | input.style.height = "20px"; |
| 10184 | input.style.float = "left"; |
| 10185 | input.style.margin = "0 2px"; |
| 10186 | input.value = val; |
| 10187 | input.checked = val; |
| 10188 | let td = document.createElement("td"); |
| 10189 | td.appendChild(input); |
| 10190 | if (parentCheck) { |
| 10191 | title.appendChild(input); |
| 10192 | title.style.margin = "0"; |
| 10193 | td.appendChild(title); |
| 10194 | let parent = parentCheck.parentNode.nextElementSibling; |
| 10195 | let tr = parent.querySelector("tr"); |
| 10196 | if (!tr) { |
| 10197 | tr = document.createElement("tr"); |
| 10198 | parent.appendChild(tr); |
| 10199 | } |
| 10200 | tr.appendChild(td); |
| 10201 | if (!alwaysShow) { |
| 10202 | if (!parentCheck.checked) { |
| 10203 | td.style.display = "none"; |
| 10204 | } |
| 10205 | parentCheck.addEventListener("click", e => { |
| 10206 | td.style.display = parentCheck.checked ? "" : "none"; |
| 10207 | }); |
| 10208 | } |
| 10209 | } else { |
| 10210 | let tr = document.createElement("tr"); |
| 10211 | tr.appendChild(td); |
| 10212 | td = document.createElement("td"); |
| 10213 | td.appendChild(title); |
| 10214 | tr.appendChild(td); |
| 10215 | configTable.children[0].appendChild(tr); |
| 10216 | } |
| 10217 | let xNodePos = innerText.indexOf('【X】'); |
| 10218 | if (xNodePos !== -1) { |
| 10219 | input.style.float = ""; |
| 10220 | let xNode = title.firstChild.splitText(xNodePos); |
| 10221 | xNode.splitText(3); |