Fix WSJ (mobile)

This commit is contained in:
magnolia1234 2023-10-31 17:55:19 +01:00
parent d399e8bc64
commit 5c23c20cbc
4 changed files with 27 additions and 17 deletions

View File

@ -4,7 +4,7 @@ Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywal
Post-release
Add The Impression
Fix WSJ (Googlebot for cn/jp subdomain)
Fix WSJ (mobile & Googlebot for cn/jp subdomain)
Update custom sites (link to 1ft.io)
* v3.4.0.0 (2023-10-29)

View File

@ -5404,6 +5404,8 @@ else if (matchDomain('winnipegfreepress.com')) {
}
else if (matchDomain('wsj.com')) {
if (matchDomain('www.wsj.com'))
blockJsReferrer();
if (window.location.pathname.startsWith('/livecoverage/')) {
window.setTimeout(function () {
let paywall = document.querySelector('div#cx-lc-snippet');
@ -5412,14 +5414,10 @@ else if (matchDomain('wsj.com')) {
removeDOMElement(paywall);
if (amphtml) {
amp_redirect_not_loop(amphtml);
} else if (window.location.pathname.includes('/card/')) {
let article = document.querySelector('div > div[class*="-ParagraphContainer"]');
if (article) {
let weblink = document.createElement('a');
weblink.href = window.location.href.split('/card/')[0];
weblink.innerText = 'BPC > full text in feed';
article.parentNode.firstChild.before(weblink);
}
} else {
let fade = document.querySelectorAll('div[class*="-CardWrapper"]');
for (let elem of fade)
elem.removeAttribute('class');
}
}
}, 1000);
@ -5445,12 +5443,15 @@ else if (matchDomain('wsj.com')) {
let wsj_pro = snippet.querySelector('a[href^="https://wsjpro.com/"]');
let article = document.querySelector('article');
if (article) {
if (wsj_pro)
window.setTimeout(function () {
if (wsj_pro) {
article.firstChild.before(googleSearchToolLink(window.location.href));
else
article.firstChild.before(archiveLink(window.location.href, 'BPC > Try for full article text (articles before 2023-10-28)'));
} else
article.firstChild.before(archiveLink(window.location.href));
if (!mobile)
header_nofix(document.querySelector('div#bpc_archive'), 'BPC > hard refresh page (for Windows: Ctrl + Enter in address bar) or use link below');
}, 500);
csDoneOnce = true;
waitDOMElement('div.paywall', 'DIV', node => hideDOMElement(...document.querySelectorAll('div#bpc_archive')), false);
}
}
}
@ -5677,6 +5678,15 @@ function header_nofix(header, msg = 'BPC > no fix') {
}
}
function blockJsReferrer() {
if (document.head && !document.querySelector('head > meta[name="referrer"][content="no-referrer"]')) {
var meta = document.createElement('meta');
meta.name = "referrer";
meta.content = "no-referrer";
document.head.appendChild(meta);
}
}
function replaceDomElementExt(url, proxy, base64, selector, text_fail = '', selector_source = selector) {
if (proxy) {
if (!text_fail) {

View File

@ -51,5 +51,5 @@
"webRequestBlocking",
"*://*/*"
],
"version": "3.4.0.2"
"version": "3.4.0.3"
}

View File

@ -808,5 +808,5 @@
"*://*.wyleex.com/*",
"*://webcache.googleusercontent.com/*"
],
"version": "3.4.0.2"
"version": "3.4.0.3"
}