Fix-update Medium/Towards Data Science
This commit is contained in:
parent
099f3166c8
commit
ce705e0aec
@ -621,6 +621,7 @@ ext_api.storage.local.get({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
disableJavascriptOnListedSites();
|
disableJavascriptOnListedSites();
|
||||||
|
disableJavascriptInlineOnMediumSites();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Listen for changes to options
|
// Listen for changes to options
|
||||||
@ -755,7 +756,7 @@ ext_api.storage.onChanged.addListener(function (changes, namespace) {
|
|||||||
active: true,
|
active: true,
|
||||||
currentWindow: true
|
currentWindow: true
|
||||||
}, function (tabs) {
|
}, function (tabs) {
|
||||||
if (tabs.length > 0 && tabs[0].url && tabs[0].url.indexOf("http") !== -1) {
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
||||||
ext_api.tabs.update(tabs[0].id, {
|
ext_api.tabs.update(tabs[0].id, {
|
||||||
url: tabs[0].url
|
url: tabs[0].url
|
||||||
});
|
});
|
||||||
@ -910,7 +911,7 @@ ext_api.webRequest.onHeadersReceived.addListener(function (details) {
|
|||||||
['blocking', 'responseHeaders']);
|
['blocking', 'responseHeaders']);
|
||||||
|
|
||||||
// block inline script
|
// block inline script
|
||||||
var block_js_inline = ["*://elviajero.elpais.com/*", "*://retina.elpais.com/*", "*://verne.elpais.com/*", "*://*.medianama.com/*"]
|
var block_js_inline = ["*://elviajero.elpais.com/*", "*://retina.elpais.com/*", "*://verne.elpais.com/*", "*://*.medianama.com/*"];
|
||||||
ext_api.webRequest.onHeadersReceived.addListener(function (details) {
|
ext_api.webRequest.onHeadersReceived.addListener(function (details) {
|
||||||
if (!isSiteEnabled(details)) {
|
if (!isSiteEnabled(details)) {
|
||||||
return;
|
return;
|
||||||
@ -929,6 +930,28 @@ 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 = [];
|
||||||
@ -1055,7 +1078,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
|||||||
active: true,
|
active: true,
|
||||||
currentWindow: true
|
currentWindow: true
|
||||||
}, function (tabs) {
|
}, function (tabs) {
|
||||||
if (tabs.length > 0 && tabs[0].url && tabs[0].url.indexOf("http") !== -1) {
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
||||||
ext_api.tabs.executeScript({
|
ext_api.tabs.executeScript({
|
||||||
file: 'options/toggleIcon.js',
|
file: 'options/toggleIcon.js',
|
||||||
runAt: 'document_start'
|
runAt: 'document_start'
|
||||||
@ -1216,7 +1239,7 @@ if (matchUrlDomain(change_headers, details.url) && (['main_frame', 'sub_frame',
|
|||||||
active: true,
|
active: true,
|
||||||
currentWindow: true
|
currentWindow: true
|
||||||
}, function (tabs) {
|
}, function (tabs) {
|
||||||
if (tabs.length > 0 && tabs[0].url && tabs[0].url.indexOf("http") !== -1) {
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
||||||
if (isSiteEnabled({url: tabs[0].url})) {
|
if (isSiteEnabled({url: tabs[0].url})) {
|
||||||
ext_api.tabs.executeScript({
|
ext_api.tabs.executeScript({
|
||||||
file: 'contentScript.js',
|
file: 'contentScript.js',
|
||||||
@ -1308,7 +1331,7 @@ function site_switch() {
|
|||||||
active: true,
|
active: true,
|
||||||
currentWindow: true
|
currentWindow: true
|
||||||
}, function (tabs) {
|
}, function (tabs) {
|
||||||
if (tabs.length > 0 && tabs[0].url && tabs[0].url.indexOf("http") !== -1) {
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
||||||
let currentUrl = tabs[0].url;
|
let currentUrl = tabs[0].url;
|
||||||
let isDefaultSite = matchUrlDomain(defaultSites_grouped_domains, currentUrl);
|
let isDefaultSite = matchUrlDomain(defaultSites_grouped_domains, currentUrl);
|
||||||
if (!isDefaultSite) {
|
if (!isDefaultSite) {
|
||||||
@ -1354,7 +1377,7 @@ function remove_cookies_fn(domainVar, exclusions = false) {
|
|||||||
active: true,
|
active: true,
|
||||||
currentWindow: true
|
currentWindow: true
|
||||||
}, function (tabs) {
|
}, function (tabs) {
|
||||||
if (tabs.length > 0 && tabs[0].url && tabs[0].url.indexOf("http") !== -1) {
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
||||||
let tabId = tabs[0].id;
|
let tabId = tabs[0].id;
|
||||||
let storeId = '0';
|
let storeId = '0';
|
||||||
for (let store of cookieStores) {
|
for (let store of cookieStores) {
|
||||||
@ -1414,7 +1437,7 @@ function clear_cookies() {
|
|||||||
active: true,
|
active: true,
|
||||||
currentWindow: true
|
currentWindow: true
|
||||||
}, function (tabs) {
|
}, function (tabs) {
|
||||||
if (tabs.length > 0 && tabs[0].url && tabs[0].url.indexOf("http") !== -1) {
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
||||||
ext_api.tabs.executeScript({
|
ext_api.tabs.executeScript({
|
||||||
file: 'options/clearCookies.js',
|
file: 'options/clearCookies.js',
|
||||||
runAt: 'document_start'
|
runAt: 'document_start'
|
||||||
@ -1457,7 +1480,7 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
|
|||||||
active: true,
|
active: true,
|
||||||
currentWindow: true
|
currentWindow: true
|
||||||
}, function (tabs) {
|
}, function (tabs) {
|
||||||
if (tabs.length > 0 && tabs[0].url && tabs[0].url.indexOf("http") !== -1) {
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
||||||
let currentUrl = tabs[0].url;
|
let currentUrl = tabs[0].url;
|
||||||
let domain;
|
let domain;
|
||||||
let isExcludedSite = matchUrlDomain(excludedSites, currentUrl);
|
let isExcludedSite = matchUrlDomain(excludedSites, currentUrl);
|
||||||
|
@ -4,6 +4,7 @@ Changelog Bypass Paywalls Clean - Chrome
|
|||||||
Post-release
|
Post-release
|
||||||
Add MediaNama (India)
|
Add MediaNama (India)
|
||||||
Remove Mitteldeutsche Zeitung (obsolete)
|
Remove Mitteldeutsche Zeitung (obsolete)
|
||||||
|
Fix-update Medium/Towards Data Science
|
||||||
Fix-update National Geographic USA
|
Fix-update National Geographic USA
|
||||||
Fix-update Prensa Iberica
|
Fix-update Prensa Iberica
|
||||||
Fix-update Saechsische Zeitung (amp)
|
Fix-update Saechsische Zeitung (amp)
|
||||||
|
@ -74,6 +74,18 @@ if (matchDomain(['medium.com', 'towardsdatascience.com']) || document.querySelec
|
|||||||
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$/) || matchDomain(['afr.com'])) {//australia
|
else if (window.location.hostname.match(/\.(com|net)\.au$/) || matchDomain(['afr.com'])) {//australia
|
||||||
@ -2028,13 +2040,11 @@ else if (matchDomain('newyorker.com')) {
|
|||||||
for (let asset_invisible of invisible_assets)
|
for (let asset_invisible of invisible_assets)
|
||||||
asset_invisible.classList.remove('responsive-asset--invisible');
|
asset_invisible.classList.remove('responsive-asset--invisible');
|
||||||
let overlays = document.querySelectorAll('.aspect-ratio--overlay-container, .asset-embed__asset-container');
|
let overlays = document.querySelectorAll('.aspect-ratio--overlay-container, .asset-embed__asset-container');
|
||||||
let noscript,
|
|
||||||
html;
|
|
||||||
let parser = new DOMParser();
|
let parser = new DOMParser();
|
||||||
for (let overlay of overlays) {
|
for (let overlay of overlays) {
|
||||||
noscript = overlay.querySelector('noscript');
|
let noscript = overlay.querySelector('noscript');
|
||||||
if (noscript) {
|
if (noscript && noscript.innerHTML) {
|
||||||
html = parser.parseFromString(noscript.innerHTML, 'text/html');
|
let html = parser.parseFromString(noscript.innerHTML, 'text/html');
|
||||||
overlay.appendChild(html.querySelector('img'));
|
overlay.appendChild(html.querySelector('img'));
|
||||||
removeDOMElement(noscript);
|
removeDOMElement(noscript);
|
||||||
}
|
}
|
||||||
|
@ -30,5 +30,5 @@
|
|||||||
"webRequestBlocking",
|
"webRequestBlocking",
|
||||||
"<all_urls>"
|
"<all_urls>"
|
||||||
],
|
],
|
||||||
"version": "2.2.1.8"
|
"version": "2.2.1.9"
|
||||||
}
|
}
|
@ -505,5 +505,5 @@
|
|||||||
"*://*.wallkit.net/*",
|
"*://*.wallkit.net/*",
|
||||||
"*://*.wsj.net/*"
|
"*://*.wsj.net/*"
|
||||||
],
|
],
|
||||||
"version": "2.2.1.8"
|
"version": "2.2.1.9"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user