Fix popup (update notification & close error)

Plus update options (layout)
This commit is contained in:
magnolia1234 2020-11-24 17:12:47 +01:00
parent cf40936a9f
commit a4b3524cfb
6 changed files with 18 additions and 12 deletions

View file

@ -5,6 +5,7 @@ Post-release
Add El Periodico (Spain)
Add Grupo Vocento (Spain, regional daily)
Fix-update Corriere Della Sera (redirect preview)
Fix popup (update notification & close error)
Update block general paywall script (Pelcro)
Update grouped sites (init rules)

View file

@ -356,5 +356,5 @@
"*://*.repstatic.it/*",
"*://*.userzoom.com/*"
],
"version": "1.9.6.4"
"version": "1.9.6.5"
}

View file

@ -26,6 +26,7 @@ function save_options() {
// Restores checkbox input states using the preferences stored in ext_api.storage.
function renderOptions() {
var labelEl;
ext_api.storage.local.get({
sites: {}, sites_custom: {}
}, function(items) {
@ -38,7 +39,7 @@ function renderOptions() {
}
var value = defaultSites[key];
var labelEl = document.createElement('label');
labelEl = document.createElement('label');
var inputEl = document.createElement('input');
inputEl.type = 'checkbox';
inputEl.dataset.key = key;
@ -47,13 +48,18 @@ function renderOptions() {
inputEl.checked = Object.keys(sites).some(title => (title.replace(/\s\(.*\)/, '') === clean_key));
if (value !== '###') {
labelEl.appendChild(inputEl);
} else {
labelEl.appendChild(document.createElement('hr'));
labelEl.setAttribute('style', ' font-weight: bold;');
}
labelEl.appendChild(document.createTextNode(' ' + key));
sitesEl.appendChild(labelEl);
}
// custom
var labelEl = document.createElement('label');
labelEl.appendChild(document.createTextNode(' ——— Custom Sites ———'));
labelEl.appendChild(document.createElement('hr'));
labelEl = document.createElement('label');
labelEl.setAttribute('style', ' font-weight: bold;');
labelEl.appendChild(document.createTextNode('* Custom Sites'));
sitesEl.appendChild(labelEl);
var sites_custom = items.sites_custom;
var defaultSites_domains = ext_api.extension.getBackgroundPage().defaultSites_domains;
@ -63,7 +69,7 @@ function renderOptions() {
continue;
}
var labelEl = document.createElement('label');
labelEl = document.createElement('label');
var inputEl = document.createElement('input');
inputEl.type = 'checkbox';
inputEl.dataset.key = key;

View file

@ -18,7 +18,7 @@ function popup_show_toggle(domain) {
site_switch_span.appendChild(labelEl);
document.getElementById("site_switch").addEventListener('click', function () {
ext_api.extension.getBackgroundPage().site_switch();
window.close();
open(location, '_self').close();
});
}
};
@ -26,5 +26,5 @@ ext_api.extension.getBackgroundPage().popup_show_toggle_tab(popup_show_toggle);
document.getElementById("clear_cookies").addEventListener('click', function () {
ext_api.extension.getBackgroundPage().clear_cookies();
window.close();
open(location, '_self').close();
});

View file

@ -225,7 +225,7 @@ var defaultSites =
"Wired": "wired.com",
"WirtschaftsWoche": "wiwo.de",
"World Politics Review": "worldpoliticsreview.com",
"——— Block Paywall-scripts ———": "###",
"* Block Paywall-scripts (opt-in to custom sites to enable also for non-listed sites)": "###",
"Amp-access": "cdn.ampproject.org",
"BlueConic": "blueconic.net",
"Cxense": "cxense.com",
@ -238,6 +238,6 @@ var defaultSites =
"Qiota": "qiota.com",
"TinyPass": "tinypass.com",
"TribDss": "tribdss.com",
"——— BPC settings ———": "###",
"* BPC settings": "###",
"Show options on update": "#options_on_update"
}

View file

@ -4,9 +4,8 @@ var manifestData = ext_api.runtime.getManifest();
var versionString = 'v' + manifestData.version;
document.getElementById('version').innerText = versionString;
const proxyurl = "https://cors-anywhere.herokuapp.com/";
const manifest_new = 'https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/raw/master/manifest.json';
fetch(proxyurl + manifest_new)
fetch(manifest_new, { headers: { "Content-Type": "application/json", "X-Requested-With": "XMLHttpRequest" } })
.then(response => {
if (response.ok) {
response.json().then(json => {