MCPcopy Index your code
hub / github.com/ClearURLs/Addon / changeSwitchButton

Function changeSwitchButton

core_js/popup.js:87–112  ·  view source on GitHub ↗

* Change the value of a switch button. * @param {string} id HTML id * @param {string} storageID storage internal id

(id, storageID)

Source from the content-addressed store, hash-verified

85* @param {string} storageID storage internal id
86*/
87function changeSwitchButton(id, storageID)
88{
89 let element = document.getElementById(id);
90
91 changeVisibility(id, storageID);
92
93 element.onchange = function(){
94 browser.runtime.sendMessage({
95 function: "setData",
96 params: [storageID, element.checked]
97 }).then((data) => {
98 if(storageID === "globalStatus"){
99 browser.runtime.sendMessage({
100 function: "changeIcon",
101 params: []
102 }).catch(handleError);
103 }
104 changeVisibility(id, storageID);
105
106 browser.runtime.sendMessage({
107 function: "saveOnExit",
108 params: []
109 }).catch(handleError);
110 }).catch(handleError);
111 };
112}
113
114/**
115* Change the visibility of sections.

Callers 1

popup.jsFile · 0.70

Calls 1

changeVisibilityFunction · 0.85

Tested by

no test coverage detected