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

View file

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