Fix custom sites (domains with capitals)

This commit is contained in:
magnolia1234 2020-03-09 21:11:38 +01:00 committed by GitHub
parent 42ce0b8ffc
commit 7d8fd431ba
2 changed files with 9 additions and 7 deletions

View file

@ -122,7 +122,7 @@ const use_google_bot_default = [
];
var use_google_bot_custom = [];
var use_google_bot = use_google_bot_default.concat(use_google_bot_custom);
//_paywall\.sjs
// block paywall-scripts individually
var blockedRegexes = {
'adweek.com': /.+\.lightboxcdn\.com\/.+/,
@ -196,7 +196,7 @@ browser.storage.sync.get({
use_google_bot_custom = Object.keys(sites_custom).filter(function (key) {
return sites_custom[key]['googlebot'] > 0;
}).map(function (key) {
return sites_custom[key]['domain']
return sites_custom[key]['domain'].toLowerCase();
});
use_google_bot = use_google_bot_default.slice();
@ -204,14 +204,14 @@ browser.storage.sync.get({
block_js_custom = Object.keys(sites_custom).filter(function (key) {
return sites_custom[key]['block_javascript'] > 0;
}).map(function (key) {
return sites_custom[key]['domain']
return sites_custom[key]['domain'].toLowerCase();
});
block_js = block_js_default.slice();
enabledSites = Object.keys(sites).filter(function (key) {
return (sites[key] !== '' && sites[key] !== '###');
}).map(function (key) {
return sites[key];
return sites[key].toLowerCase();
});
for (var domainIndex in enabledSites) {
@ -248,7 +248,7 @@ browser.storage.onChanged.addListener(function (changes, namespace) {
use_google_bot_custom = Object.keys(sites_custom).filter(function (key) {
return sites_custom[key]['googlebot'] > 0;
}).map(function (key) {
return sites_custom[key]['domain']
return sites_custom[key]['domain'].toLowerCase();
});
use_google_bot = use_google_bot_default.slice();
for (var domainIndex in use_google_bot_custom) {
@ -261,7 +261,7 @@ browser.storage.onChanged.addListener(function (changes, namespace) {
block_js_custom = Object.keys(sites_custom).filter(function (key) {
return sites_custom[key]['block_javascript'] > 0;
}).map(function (key) {
return sites_custom[key]['domain']
return sites_custom[key]['domain'].toLowerCase();
});
block_js = block_js_default.slice();
for (var domainIndex in block_js_custom) {

View file

@ -19,7 +19,7 @@ function save_options() {
}, function() {
// Update status to let user know options were saved.
var status = document.getElementById('status');
status.textContent = 'Options saved.';
status.textContent = 'Options saved.';
setTimeout(function() {
status.textContent = '';
window.close();
@ -31,9 +31,11 @@ function save_options() {
active: true,
currentWindow: true
}, function (tabs) {
if (tabs[0].url.indexOf("http") !== -1) {
browser.tabs.update(tabs[0].id, {
url: tabs[0].url
});
}
});
}