Fix-update WSJ (amp for pro/login)

This commit is contained in:
magnolia1234 2020-06-15 11:59:34 +02:00
parent 29ae9db483
commit 710ac16453
2 changed files with 7 additions and 11 deletions

View file

@ -197,7 +197,8 @@ var blockedRegexes = {
'thecourier.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/, 'thecourier.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/,
'thedailybeast.com': /.+\.tinypass\.com\/.+/, 'thedailybeast.com': /.+\.tinypass\.com\/.+/,
'thenation.com': /.+\.tinypass\.com\/.+/, 'thenation.com': /.+\.tinypass\.com\/.+/,
'valeursactuelles.com': /.+\.poool\.fr\/.+/ 'valeursactuelles.com': /.+\.poool\.fr\/.+/,
'wsj.com': /cdn\.ampproject\.org\/v\d\/amp-access-.+\.js/
}; };
const userAgentDesktop = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" const userAgentDesktop = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"

View file

@ -121,22 +121,17 @@ else if (matchDomain("wsj.com")) {
close_button.click(); close_button.click();
} }
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
let wsj_login = document.querySelector('.wsj-snippet-login'); let wsj_login = document.querySelector('.wsj-snippet-login, .wsjpro-label');
if (wsj_login && !window.location.hash) { if (wsj_login) {
let url = window.location.href; window.location.href = window.location.href.replace('wsj.com', 'wsj.com/amp');
if (url.includes('?')) {
window.location.href = url.replace('?', '#refreshed?');
} else {
window.location.href = url + '#refreshed';
}
} }
}); });
} }
else if (matchDomain("sloanreview.mit.edu")) { else if (matchDomain("sloanreview.mit.edu")) {
const read_more = document.querySelector('.btn-read-more'); const read_more = document.querySelector('.btn-read-more');
if(read_more) if (read_more)
read_more.click(); read_more.click();
} }
else if (matchDomain("mexiconewsdaily.com")) { else if (matchDomain("mexiconewsdaily.com")) {