2020-08-20 19:01:12 +02:00
|
|
|
var ext_api = chrome || browser;
|
2020-11-05 22:21:41 +01:00
|
|
|
|
|
|
|
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();
|
2020-12-09 17:32:30 +01:00
|
|
|
open(location).close();
|
2020-11-05 22:21:41 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
ext_api.extension.getBackgroundPage().popup_show_toggle_tab(popup_show_toggle);
|
|
|
|
|
|
|
|
document.getElementById("clear_cookies").addEventListener('click', function () {
|
2020-10-12 17:31:51 +02:00
|
|
|
ext_api.extension.getBackgroundPage().clear_cookies();
|
2020-12-09 17:32:30 +01:00
|
|
|
open(location).close();
|
2020-11-24 17:12:47 +01:00
|
|
|
});
|