Fix theglobeandmail.com

This commit is contained in:
Adam 2021-12-05 23:42:46 -08:00
parent 9181725487
commit 4506b13240
2 changed files with 5 additions and 36 deletions

View File

@ -240,7 +240,8 @@ const blockedRegexes = {
'elpais.com': /(\.epimg\.net\/js\/.+\/(noticia|user)\.min\.js|\/elpais\.com\/arc\/subs\/p\.min\.js|cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|consent)-.+\.js)/,
'expansion.com': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/,
'chicagobusiness.com': /(\.tinypass\.com\/|\.chicagobusiness\.com\/.+\/js\/js_.+\.js)/,
'dailytelegraph.com.au': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/
'dailytelegraph.com.au': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/,
'theglobeandmail.com': /(\.theglobeandmail\.com\/pf\/dist\/engine\/react\.js|smartwall\.theglobeandmail\.com\/)/
};
const userAgentDesktop = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';

View File

@ -231,41 +231,9 @@ if (matchDomain('elmercurio.com')) {
}
}, 500); // Delay (in milliseconds)
} else if (matchDomain('theglobeandmail.com')) {
document.addEventListener('DOMContentLoaded', () => {
const realArticle = document.querySelector('.js-c-article-body');
let decoyArticle = document.querySelector('.decoy-article');
if (realArticle && !decoyArticle) {
decoyArticle = document.createElement('div');
decoyArticle.classList.add('js-c-article-body');
decoyArticle.classList.add('decoy-article');
decoyArticle.hidden = true;
realArticle.parentElement.insertBefore(decoyArticle, realArticle);
for (let child = realArticle.firstChild; child !== null; child = child.nextSibling) {
if (child.style) {
child.style.display = 'block';
}
}
}
const regWall = document.querySelector('#regwall');
const lightBox = document.querySelector('.c-lightbox');
if (regWall && lightBox) {
regWall.hidden = true;
lightBox.hidden = true;
}
const subscribed = document.querySelector('html.story-subscribed');
if (subscribed && !window.location.href.includes('?ref=premium')) {
window.setTimeout(function () {
window.location.href = new URL(window.location.href).pathname + '?ref=premium';
}, 100);
}
});
const cCards = document.querySelectorAll('div.c-card');
for (const cCard of cCards) {
const aLink = cCard.querySelector('a');
const key = cCard.querySelector('span.c-indicator-icon--key');
if (key && aLink && !aLink.href.includes('?ref=premium')) {
aLink.href = aLink.href + '?ref=premium';
}
const articleBodySubscribed = document.querySelector('.c-article-body--subscribed');
if (articleBodySubscribed) {
articleBodySubscribed.removeAttribute('class');
}
} else if (matchDomain(['examiner.com.au', 'thecourier.com.au', 'theadvocate.com.au'])) {
const subscribeTruncate = document.querySelector('.subscribe-truncate');