Fix WSJ (amp live coverage)

merge-requests/16/head
magnolia1234 9 months ago
parent 03975182c5
commit 21646f8db1

@ -5,6 +5,7 @@ Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywal
Post-release
Fix Forbes (menu)
Fix Star Tribune (css)
Fix WSJ (amp live coverage)
Maintenance background tab
* v3.3.1.0 (2023-08-27)

@ -5247,23 +5247,44 @@ else if (matchDomain('winnipegfreepress.com')) {
}
else if (matchDomain('wsj.com')) {
let url_article = window.location.pathname.includes('/articles/');
let path_article = window.location.pathname.match(/((\w)+(\-)+){3,}\w+/);
if (url_article || path_article) {
if (window.location.pathname.startsWith('/amp/')) {
amp_unhide_subscr_section();
let masthead_link = document.querySelector('div.masthead > a[href*="-"]');
if (masthead_link)
masthead_link.href = 'https://www.wsj.com';
} else {
let snippet = document.querySelector('.snippet-promotion, div#cx-snippet-overlay');
let wsj_pro = document.querySelector('meta[name="page.site"][content="wsjpro"]');
if (snippet || wsj_pro) {
removeDOMElement(snippet, wsj_pro);
if (url_article)
window.location.href = window.location.href.replace('wsj.com', 'wsj.com/amp');
else
window.location.href = '/amp/articles/' + path_article[0];
if (window.location.pathname.startsWith('/livecoverage/')) {
window.setTimeout(function () {
let paywall = document.querySelector('div#cx-lc-snippet');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall) {
removeDOMElement(paywall);
if (amphtml) {
window.location.href = amphtml.href;
} 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);
}
}
}
}, 1000);
} else {
let url_article = window.location.pathname.includes('/articles/');
let path_article = window.location.pathname.match(/((\w)+(\-)+){3,}\w+/);
if (url_article || path_article) {
if (window.location.pathname.startsWith('/amp/')) {
amp_unhide_subscr_section();
let masthead_link = document.querySelector('div.masthead > a[href*="-"]');
if (masthead_link)
masthead_link.href = 'https://www.wsj.com';
} else {
let snippet = document.querySelector('.snippet-promotion, div#cx-snippet-overlay');
let wsj_pro = document.querySelector('meta[name="page.site"][content="wsjpro"]');
if (snippet || wsj_pro) {
removeDOMElement(snippet, wsj_pro);
if (url_article)
window.location.href = window.location.href.replace('wsj.com', 'wsj.com/amp');
else
window.location.href = '/amp/articles/' + path_article[0];
}
}
}
}

@ -51,5 +51,5 @@
"webRequestBlocking",
"*://*/*"
],
"version": "3.3.1.2"
"version": "3.3.1.3"
}

@ -792,5 +792,5 @@
"*://*.wyleex.com/*",
"*://webcache.googleusercontent.com/*"
],
"version": "3.3.1.2"
"version": "3.3.1.3"
}

@ -2,8 +2,8 @@
"addons": {
"magnolia@12.34": {
"updates": [
{ "version": "3.3.0.0",
"update_link": "https://gitlab.com/magnolia1234/bpc-uploads/-/raw/master/bypass_paywalls_clean-3.3.0.0.xpi" }
{ "version": "3.3.1.0",
"update_link": "https://gitlab.com/magnolia1234/bpc-uploads/-/raw/master/bypass_paywalls_clean-3.3.1.0.xpi" }
]
}
}

Loading…
Cancel
Save