forked from ThomazPom/Moz-Ext-Ignore-X-Frame-Options
-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
32 lines (27 loc) · 932 Bytes
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var defaultRgx = ["<all_urls>","*://*/*","https://*.w3schools.com/*"].join('\n')
var myPort = browser.runtime.connect({name:"port-from-cs"});
browser.storage.local.get(null, function(res) {
var regstr = (res.regstr_allowed || defaultRgx);
document.querySelector(".listextarea").value=regstr;
document.querySelector("#disable_webext").checked=res.is_disabled;
});
window.onload= function()
{
var txarea = document.querySelector(".listextarea");
var disable_checkbox= document.querySelector("#disable_webext");
txarea.onkeyup = txarea.onchange = disable_checkbox.onchange
= function(){
regstr = txarea.value.trim()
myPort.postMessage({
regstr_allowed: regstr,
is_disabled: disable_checkbox.checked
});
}
document.querySelector("#reset").onclick=x=>{
if(confirm("Config will be reset to\n"+defaultRgx))
{
txarea.value=defaultRgx;
txarea.onchange();
}
}
}