MCPcopy Create free account
hub / github.com/openscopeproject/InteractiveHtmlBom / getStoredCheckboxRefs

Function getStoredCheckboxRefs

InteractiveHtmlBom/web/ibom.js:144–167  ·  view source on GitHub ↗
(checkbox)

Source from the content-addressed store, hash-verified

142}
143
144function getStoredCheckboxRefs(checkbox) {
145 function convert(ref) {
146 var intref = parseInt(ref);
147 if (isNaN(intref)) {
148 for (var i = 0; i < pcbdata.footprints.length; i++) {
149 if (pcbdata.footprints[i].ref == ref) {
150 return i;
151 }
152 }
153 return -1;
154 } else {
155 return intref;
156 }
157 }
158 if (!(checkbox in settings.checkboxStoredRefs)) {
159 var val = readStorage("checkbox_" + checkbox);
160 settings.checkboxStoredRefs[checkbox] = val ? val : "";
161 }
162 if (!settings.checkboxStoredRefs[checkbox]) {
163 return new Set();
164 } else {
165 return new Set(settings.checkboxStoredRefs[checkbox].split(",").map(r => convert(r)).filter(a => a >= 0));
166 }
167}
168
169function getCheckboxState(checkbox, references) {
170 var storedRefsSet = getStoredCheckboxRefs(checkbox);

Callers 4

getCheckboxStateFunction · 0.85
clickHandlerFunction · 0.85
setMarkWhenCheckedFunction · 0.85
updateCheckboxStatsFunction · 0.85

Calls 2

readStorageFunction · 0.85
convertFunction · 0.70

Tested by

no test coverage detected