MCPcopy Index your code
hub / github.com/prettydiff/prettydiff / buildDomInterface

Function buildDomInterface

services.ts:1108–1176  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1106 return allOptions.join("");
1107 },
1108 buildDomInterface = function node_apps_build_libraries_modifyFile_read_buildDomInterface():string {
1109 const allItems:string[] = [],
1110 exclusions = {
1111 "diff": "",
1112 "difflabel": "",
1113 "mode": "",
1114 "source": "",
1115 "sourcelabel": ""
1116 };
1117 let a:number = 0,
1118 b:number = 0,
1119 item:string[],
1120 optName:string,
1121 opt:option,
1122 vals:string[],
1123 vallen:number,
1124 select:boolean = false;
1125 do {
1126 optName = optkeys[a];
1127 opt = prettydiff.api.optionDef[optName];
1128 if (exclusions[optName] !== "" && (opt.api === "any" || opt.api === "dom")) {
1129 item = [`<li data-mode="${opt.mode}">`];
1130 if (opt.type === "boolean") {
1131 item.push(`<p class="label">${opt.label} <a class="apiname" href="documentation.xhtml#${optName}">(${optName})</a></p>`);
1132 if (opt.default === true) {
1133 item.push(`<span><input type="radio" id="option-false-${optName}" name="option-${optName}" value="false"/> <label for="option-false-${optName}">false</label></span>`);
1134 item.push(`<span><input type="radio" checked="checked" id="option-true-${optName}" name="option-${optName}" value="true"/> <label for="option-true-${optName}">true</label></span>`);
1135 } else {
1136 item.push(`<span><input type="radio" checked="checked" id="option-false-${optName}" name="option-${optName}" value="false"/> <label for="option-false-${optName}">false</label></span>`);
1137 item.push(`<span><input type="radio" id="option-true-${optName}" name="option-${optName}" value="true"/> <label for="option-true-${optName}">true</label></span>`);
1138 }
1139 select = false;
1140 } else {
1141 item.push(`<label for="option-${optName}" class="label">${opt.label}`);
1142 item.push(` <a class="apiname" href="documentation.xhtml#${optName}">(${optName})</a>`);
1143 item.push(`</label>`);
1144 if (opt.type === "number" || (opt.type === "string" && opt.values === undefined)) {
1145 item.push(`<input type="text" id="option-${optName}" value="${opt.default}" data-type="${opt.type}"/>`);
1146 select = false;
1147 } else {
1148 item.push(`<select id="option-${optName}">`);
1149 vals = Object.keys(opt.values);
1150 vallen = vals.length;
1151 b = 0;
1152 do {
1153 item.push(`<option data-description="${opt.values[vals[b]].replace(/"/g, "&quot;")}" ${
1154 (opt.default === vals[b])
1155 ? "selected=\"selected\""
1156 : ""
1157 }>${vals[b]}</option>`);
1158 b = b + 1;
1159 } while (b < vallen);
1160 item.push(`</select>`);
1161 select = true;
1162 }
1163 }
1164 item.push(`<p class="option-description">${opt.definition.replace(/"/g, "&quot;")}`);
1165 if (select === true) {

Callers 1

modifyFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected