bypass-paywalls-firefox-clean/popup.js
magnolia1234 a4b3524cfb Fix popup (update notification & close error)
Plus update options (layout)
2020-11-24 17:12:47 +01:00

31 lines
1.3 KiB
JavaScript

var ext_api = chrome || browser;
function popup_show_toggle(domain) {
if (domain) {
var site_switch_span = document.getElementById('site_switch_span');
let labelEl = document.createElement('label');
labelEl.setAttribute('class', 'switch');
let inputEl = document.createElement('input');
inputEl.setAttribute('id', 'site_switch');
inputEl.setAttribute('type', 'checkbox');
if (ext_api.extension.getBackgroundPage().enabledSites.includes(domain))
inputEl.setAttribute('checked', true);
labelEl.appendChild(inputEl);
let spanEl = document.createElement('span');
spanEl.setAttribute('class', 'slider round');
spanEl.setAttribute('title', 'en/disable current site in BPC');
labelEl.appendChild(spanEl);
site_switch_span.appendChild(labelEl);
document.getElementById("site_switch").addEventListener('click', function () {
ext_api.extension.getBackgroundPage().site_switch();
open(location, '_self').close();
});
}
};
ext_api.extension.getBackgroundPage().popup_show_toggle_tab(popup_show_toggle);
document.getElementById("clear_cookies").addEventListener('click', function () {
ext_api.extension.getBackgroundPage().clear_cookies();
open(location, '_self').close();
});