MCPcopy
hub / github.com/NeverDecaf/chromium-web-store / load_options

Function load_options

src/scripts/options.js:1–175  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1function load_options() {
2 var maindiv = document.getElementById("updatetoggle");
3 var default_options = { ...DEFAULT_MANAGEMENT_OPTIONS };
4 chrome.management.getAll(function (e) {
5 e = e.filter((ex) => ex.updateUrl);
6 installed_extensions = e.map((ex) => ex.id);
7 e.forEach(function (ex) {
8 label = document.createElement("label");
9 label.setAttribute(
10 "title",
11 chrome.i18n.getMessage("options_neverCheckTooltip")
12 );
13 span = document.createElement("span");
14 div = document.createElement("div");
15 img = document.createElement("img");
16 input = document.createElement("input");
17 input.setAttribute("type", "checkbox");
18 input.setAttribute("id", ex.id);
19 if (
20 Array.from(store_extensions.keys()).some(
21 (x) =>
22 x.test(ex.updateUrl) && store_extensions.get(x).ignore
23 )
24 ) {
25 input.checked = true;
26 input.disabled = true;
27 }
28 img.setAttribute("alt", ex.name);
29 if (ex.icons)
30 img.setAttribute(
31 "src",
32 "chrome://extension-icon/" +
33 ex.id +
34 "/" +
35 ex.icons[0].size +
36 "/0"
37 );
38 else
39 img.setAttribute(
40 "src",
41 "chrome://extension-icon/" + ex.id + "/16/0"
42 );
43 span.innerHTML = ex.name;
44 label.appendChild(input);
45 label.appendChild(img);
46 label.appendChild(span);
47 div.appendChild(label);
48 maindiv.appendChild(div);
49 default_options[ex.id] = false;
50 });
51 document.getElementById("import_export_list").value = e
52 .map((ex) => {
53 for (const [re, updaterOptions] of store_extensions) {
54 if (re.test(ex.updateUrl)) {
55 if (!updaterOptions.ignore)
56 return ex.name + "|" + ex.id;
57 else return ex.name;
58 }
59 }
60 return ex.name + "|" + ex.id + "|" + ex.updateUrl;

Callers

nothing calls this directly

Calls 2

checkForUpdatesFunction · 0.70
promptInstallFunction · 0.70

Tested by

no test coverage detected