Fix-update WSJ (timing issues)

Single refresh when paywall.
This commit is contained in:
magnolia1234 2020-05-14 20:58:55 +02:00
parent 8341c9c87f
commit 4344263be6
3 changed files with 18 additions and 6 deletions

View file

@ -496,12 +496,9 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
ext_api.tabs.onUpdated.addListener(function (tabId, info, tab) { updateBadge(tab); });
ext_api.tabs.onActivated.addListener(function (activeInfo) { ext_api.tabs.get(activeInfo.tabId, updateBadge); });
let cachedBadgeText = '';
function updateBadge (activeTab) {
if (!activeTab) { return; }
const badgeText = getTextB(activeTab.url);
if (cachedBadgeText === badgeText) { return; }
cachedBadgeText = badgeText;
ext_api.browserAction.setBadgeBackgroundColor({color: 'red'});
ext_api.browserAction.setBadgeText({text: badgeText});
}

View file

@ -120,6 +120,17 @@ else if (matchDomain("wsj.com")) {
if (close_button)
close_button.click();
}
document.addEventListener('DOMContentLoaded', () => {
let wsj_login = document.querySelector('.wsj-snippet-login');
if (wsj_login && !window.location.hash) {
let url = window.location.href;
if (url.includes('?')) {
window.location.href = url.replace('?', '#refreshed?');
} else {
window.location.href = url + '#refreshed';
}
}
});
}
else if (matchDomain("sloanreview.mit.edu")) {
@ -562,6 +573,7 @@ else if (matchDomain('faz.net')) {
str = str.replace(/([a-z\"\“])(?=[A-Z](?=[A-Za-zÀ-ÿ]+))/gm, "$&\n\n");
// exceptions: names with alternating lower/uppercase (no general fix)
str = str.replace(/Glaxo\n\nSmith\n\nKline/g, "GlaxoSmithKline");
str = str.replace(/Eu\n\nGH/g, "EuGH");
str = str.replace(/If\n\nSG/g, "IfSG");
str = str.replace(/La\n\nPierre/g, "LaPierre");
return str;

View file

@ -237,17 +237,20 @@
"*://*.cedsdigital.it/*",
"*://*.corriereobjects.it/*",
"*://*.epimg.net/*",
"*://*.htmedia.in/*",
"*://*.lightboxcdn.com/*",
"*://merreader.emol.cl/*",
"*://*.lp4.io/*",
"*://*.nyt.com/*",
"*://*.onecount.net/*",
"*://*.onesignal.com/*",
"*://*.qiota.com/*",
"*://*.rcsobjects.it/*",
"*://*.repstatic.it/*",
"*://*.swisspay.ch/*",
"*://*.htmedia.in/*",
"*://*.qiota.com/*",
"*://*.tribdss.com/*",
"*://*.userzoom.com/*",
"*://*.viralize.tv/*",
"*://merreader.emol.cl/*",
"*://*.bndestem.nl/*",
"*://*.bd.nl/*",
"*://*.ed.nl/*",