mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-02 15:40:13 +00:00
Fix custom sites (block Javascript)
This commit is contained in:
parent
9c47a1761a
commit
f37224dbc0
@ -470,7 +470,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
||||
}
|
||||
|
||||
// block external javascript for custom sites (optional)
|
||||
var domain_blockjs_ext = matchUrlDomain([block_js_custom_ext], header_referer);
|
||||
var domain_blockjs_ext = matchUrlDomain(block_js_custom_ext, header_referer);
|
||||
if (domain_blockjs_ext && !matchUrlDomain(domain_blockjs_ext, details.url) && details.url.match(/(\.js$|\.js\?|\/json\?)/) && isSiteEnabled({url: header_referer})) {
|
||||
return { cancel: true };
|
||||
}
|
||||
@ -488,7 +488,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
||||
}
|
||||
|
||||
// block javascript of (sub)domain for custom sites (optional)
|
||||
var domain_blockjs = matchUrlDomain([block_js_custom], details.url);
|
||||
var domain_blockjs = matchUrlDomain(block_js_custom, details.url);
|
||||
if (domain_blockjs && matchUrlDomain(domain_blockjs, details.url) && details.url.match(/(\.js$|\.js\?|\/json\?)/)) {
|
||||
return { cancel: true };
|
||||
}
|
||||
|
@ -104,33 +104,33 @@ function add_options() {
|
||||
sites_custom[title][inputEls[i].dataset.key] = inputEls[i].value;
|
||||
}
|
||||
}
|
||||
if (sites_custom[title]['domain'] === '')
|
||||
sites_custom = {};
|
||||
else
|
||||
|
||||
if (title && sites_custom[title]['domain']) {
|
||||
sites_custom[title]['domain'] = sites_custom[title]['domain'].replace('www.', '').toLowerCase();
|
||||
|
||||
// add new site to local storage
|
||||
ext_api.storage.sync.get({
|
||||
sites_custom: {}
|
||||
}, function (items) {
|
||||
var sites_custom_old = items.sites_custom;
|
||||
// add new site to local storage
|
||||
ext_api.storage.sync.get({
|
||||
sites_custom: {}
|
||||
}, function (items) {
|
||||
var sites_custom_old = items.sites_custom;
|
||||
|
||||
for (var key in sites_custom) {
|
||||
sites_custom_old[key] = sites_custom[key];
|
||||
}
|
||||
for (var key in sites_custom) {
|
||||
sites_custom_old[key] = sites_custom[key];
|
||||
}
|
||||
|
||||
ext_api.storage.sync.set({
|
||||
sites_custom: sites_custom_old
|
||||
}, function () {
|
||||
// Update status to let user know new custom site was added.
|
||||
var status_add = document.getElementById('status_add');
|
||||
status_add.textContent = 'Site added.';
|
||||
setTimeout(function () {
|
||||
//status.textContent = '';
|
||||
renderOptions();
|
||||
}, 800);
|
||||
ext_api.storage.sync.set({
|
||||
sites_custom: sites_custom_old
|
||||
}, function () {
|
||||
// Update status to let user know new custom site was added.
|
||||
var status_add = document.getElementById('status_add');
|
||||
status_add.textContent = 'Site added.';
|
||||
setTimeout(function () {
|
||||
//status.textContent = '';
|
||||
renderOptions();
|
||||
}, 800);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Delete custom site from ext_api.storage
|
||||
|
Loading…
Reference in New Issue
Block a user