Fix Repubblica.it

Fix for timing-issue with redirect of weblinks on homepage.
This commit is contained in:
magnolia1234 2020-03-03 18:15:21 +01:00 committed by GitHub
parent de43bdcd50
commit 78a4f28102
3 changed files with 22 additions and 10 deletions

View file

@ -281,6 +281,18 @@ browser.runtime.onInstalled.addListener(function (details) {
}
});
// repubblica.it bypass
browser.webRequest.onBeforeRequest.addListener(function (details) {
if (!isSiteEnabled(details)) {
return;
}
var updatedUrl = details.url.replace('/pwa/', '/ws/detail/');
return { redirectUrl: updatedUrl };
},
{urls:["*://*.repubblica.it/pwa/*"], types:["main_frame"]},
["blocking"]
);
var block_js_default = ["*://*.tinypass.com/*", "*://*.poool.fr/*", "*://*.piano.io/*", "*://*.outbrain.com/*"];
var block_js_custom = [];
var block_js = block_js_default.concat(block_js_custom);

View file

@ -8,18 +8,18 @@ if (!localstorage_hold){
}
// Content workarounds/domain
if (location.hostname.endsWith('rep.repubblica.it')) {
if (location.href.includes('/pwa/')) {
location.href = location.href.replace('/pwa/', '/ws/detail/');
}
if (location.href.includes('/ws/detail/')) {
if (window.location.hostname.endsWith('rep.repubblica.it')) {
setTimeout(function () {
if (window.location.href.includes('/pwa/')) {
window.location.href = window.location.href.replace('/pwa/', '/ws/detail/');
}
}, 500); // Delay (in milliseconds)
if (window.location.href.includes('/ws/detail/')) {
const paywall = document.querySelector('.paywall[subscriptions-section="content"]');
if (paywall) {
paywall.removeAttribute('subscriptions-section');
const preview = document.querySelector('div[subscriptions-section="content-not-granted"]');
if (preview) {
preview.remove();
}
removeDOMElement(preview);
}
}
}

View file

@ -4,8 +4,8 @@
<meta charset="utf-8">
</head>
<body>
<div style="width:325px;"><strong>Bypass Paywalls Clean <span id="version"></span></strong>
<br><a href="options.html">Options</a> | <a href="options_custom.html">Custom</a> | <a href="https://github.com/magnolia1234/bypass-paywalls-firefox-clean/blob/master/README.md" target=”_blank”>GitHub</a> | <strong><span id="version_new"></span></strong></div>
<div style="width:275px;"><strong>Bypass Paywalls Clean <span id="version"></span></strong>
<br><a href="options.html">Options</a> | <a href="https://github.com/magnolia1234/bypass-paywalls-firefox-clean/blob/master/README.md" target=”_blank”>GitHub</a> | <strong><span id="version_new"></span></strong></div>
<script src="version.js"></script>
</body>
</html>