MCPcopy Index your code
hub / github.com/hoothin/UserScripts / createOption

Function createOption

DownloadAllContent/DownloadAllContent.user.js:2128–2157  ·  view source on GitHub ↗
(_name, _value, _type)

Source from the content-addressed store, hash-verified

2126 let insertPos = donateNode.parentNode.nextElementSibling;
2127 let radioIndex = 0;
2128 function createOption(_name, _value, _type) {
2129 if (!_type) _type = "input";
2130 let con = document.createElement("div");
2131 let option = document.createElement("input");
2132 let cap = document.createElement("b");
2133 option.type = _type;
2134 option.value = _value;
2135 option.checked = _value;
2136 cap.style.margin = "0px 10px 0px 0px";
2137 if (_type == "radio") {
2138 let label = document.createElement("label");
2139 label.innerText = _name;
2140 radioIndex++;
2141 option.id = "radio" + radioIndex;
2142 label.setAttribute("for", option.id);
2143 cap.appendChild(label);
2144 } else {
2145 if (_type == "input") {
2146 option.style.flexGrow = "1";
2147 }
2148 cap.innerText = _name;
2149 }
2150 con.style.margin = "10px 0";
2151 con.style.display = "flex";
2152 con.style.alignItems = "center";
2153 con.appendChild(cap);
2154 con.appendChild(option);
2155 insertPos.parentNode.insertBefore(con, insertPos);
2156 return option;
2157 }
2158 function formatShortcut(e) {
2159 let result = [];
2160 if (e.ctrlKey) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected