mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 06:47:47 +01:00
Fix-update Medium/Towards Data Science (multimedia)
This commit is contained in:
parent
59e68c973c
commit
73bcd7ccd2
4 changed files with 20 additions and 37 deletions
|
@ -630,7 +630,6 @@ ext_api.storage.local.get({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disableJavascriptOnListedSites();
|
disableJavascriptOnListedSites();
|
||||||
disableJavascriptInlineOnMediumSites();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Listen for changes to options
|
// Listen for changes to options
|
||||||
|
@ -939,28 +938,6 @@ ext_api.webRequest.onHeadersReceived.addListener(function (details) {
|
||||||
},
|
},
|
||||||
['blocking', 'responseHeaders']);
|
['blocking', 'responseHeaders']);
|
||||||
|
|
||||||
// medium sites: block inline script
|
|
||||||
var medium_block_js_inline = ["*://*.medium.com/*", "*://*.towardsdatascience.com/*"];
|
|
||||||
function disableJavascriptInlineOnMediumSites() {
|
|
||||||
ext_api.webRequest.onHeadersReceived.addListener(function (details) {
|
|
||||||
if (!isSiteEnabled(details) || !details.url.split('?')[0].match(/((\w)+(\-)+){3,}/)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var headers = details.responseHeaders;
|
|
||||||
headers.push({
|
|
||||||
'name': 'Content-Security-Policy',
|
|
||||||
'value': "script-src *;"
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
responseHeaders: headers
|
|
||||||
};
|
|
||||||
}, {
|
|
||||||
'types': ['main_frame', 'sub_frame'],
|
|
||||||
'urls': medium_block_js_inline
|
|
||||||
},
|
|
||||||
['blocking', 'responseHeaders']);
|
|
||||||
}
|
|
||||||
|
|
||||||
var block_js_default = ["*://cdn.tinypass.com/*", "*://*.piano.io/*", "*://*.poool.fr/*", "*://cdn.ampproject.org/v*/amp-access-*.js", "*://*.blueconic.net/*", "*://*.cxense.com/*", "*://*.evolok.net/*", "*://js.matheranalytics.com/*", "*://*.newsmemory.com/*", "*://*.onecount.net/*", "*://js.pelcro.com/*", "*://*.qiota.com/*", "*://*.tribdss.com/*"];
|
var block_js_default = ["*://cdn.tinypass.com/*", "*://*.piano.io/*", "*://*.poool.fr/*", "*://cdn.ampproject.org/v*/amp-access-*.js", "*://*.blueconic.net/*", "*://*.cxense.com/*", "*://*.evolok.net/*", "*://js.matheranalytics.com/*", "*://*.newsmemory.com/*", "*://*.onecount.net/*", "*://js.pelcro.com/*", "*://*.qiota.com/*", "*://*.tribdss.com/*"];
|
||||||
var block_js_custom = [];
|
var block_js_custom = [];
|
||||||
var block_js_custom_ext = [];
|
var block_js_custom_ext = [];
|
||||||
|
@ -1510,6 +1487,9 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (message.request === 'refreshCurrentTab') {
|
||||||
|
refreshCurrentTab();
|
||||||
|
}
|
||||||
if (message.scheme && (![chrome_scheme, 'undefined'].includes(message.scheme) || focus_changed)) {
|
if (message.scheme && (![chrome_scheme, 'undefined'].includes(message.scheme) || focus_changed)) {
|
||||||
let icon_path = {path: {'128': 'bypass.png'}};
|
let icon_path = {path: {'128': 'bypass.png'}};
|
||||||
if (message.scheme === 'dark')
|
if (message.scheme === 'dark')
|
||||||
|
@ -1622,3 +1602,17 @@ function randomIP() {
|
||||||
rndmIP.push(randomInt(254) + 1);
|
rndmIP.push(randomInt(254) + 1);
|
||||||
return rndmIP.join('.');
|
return rndmIP.join('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Refresh the current tab
|
||||||
|
function refreshCurrentTab() {
|
||||||
|
ext_api.tabs.query({
|
||||||
|
active: true,
|
||||||
|
currentWindow: true
|
||||||
|
}, function (tabs) {
|
||||||
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
||||||
|
ext_api.tabs.update(tabs[0].id, {
|
||||||
|
url: tabs[0].url
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox
|
||||||
|
|
||||||
Post-release
|
Post-release
|
||||||
Fix-update Atlantico.fr
|
Fix-update Atlantico.fr
|
||||||
|
Fix-update Medium/Towards Data Science (multimedia)
|
||||||
|
|
||||||
* v2.2.4.0 (2021-06-06)
|
* v2.2.4.0 (2021-06-06)
|
||||||
Add group Crain's Business
|
Add group Crain's Business
|
||||||
|
|
|
@ -69,24 +69,12 @@ if (matchDomain(['medium.com', 'towardsdatascience.com']) || document.querySelec
|
||||||
let paywall = document.querySelector('div#paywall-background-color');
|
let paywall = document.querySelector('div#paywall-background-color');
|
||||||
removeDOMElement(paywall);
|
removeDOMElement(paywall);
|
||||||
if (paywall)
|
if (paywall)
|
||||||
window.location.reload(true);
|
ext_api.runtime.sendMessage({request: 'refreshCurrentTab'});
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
let meter = document.querySelector('[id*="highlight-meter-"]');
|
let meter = document.querySelector('[id*="highlight-meter-"]');
|
||||||
if (meter)
|
if (meter)
|
||||||
meter.hidden = true;
|
meter.hidden = true;
|
||||||
}, 500); // Delay (in milliseconds)
|
}, 500); // Delay (in milliseconds)
|
||||||
let hidden_images = document.querySelectorAll('img:not([src])');
|
|
||||||
let parser = new DOMParser();
|
|
||||||
for (let hidden_image of hidden_images) {
|
|
||||||
let noscript = hidden_image.parentElement.parentElement.querySelector('noscript');
|
|
||||||
if (noscript && noscript.innerHTML) {
|
|
||||||
let html = parser.parseFromString(noscript.innerHTML, 'text/html');
|
|
||||||
if (html.querySelector('img')) {
|
|
||||||
hidden_image.parentNode.replaceChild(html.querySelector('img'), hidden_image);
|
|
||||||
removeDOMElement(noscript);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (window.location.hostname.match(/\.(com|net)\.au$/)) {//australia
|
else if (window.location.hostname.match(/\.(com|net)\.au$/)) {//australia
|
||||||
|
|
|
@ -524,5 +524,5 @@
|
||||||
"*://*.wallkit.net/*",
|
"*://*.wallkit.net/*",
|
||||||
"*://*.wsj.net/*"
|
"*://*.wsj.net/*"
|
||||||
],
|
],
|
||||||
"version": "2.2.4.1"
|
"version": "2.2.4.2"
|
||||||
}
|
}
|
Loading…
Reference in a new issue