diff --git a/background.js b/background.js index 3dc8ef2..e08025e 100755 --- a/background.js +++ b/background.js @@ -276,6 +276,7 @@ var blockedRegexes = { 'thehindubusinessline.com': /(cdn\.cxense\.com\/.+|cdn\.tinypass\.com\/.+)/, 'thenation.com': /cdn\.tinypass\.com\/.+/, 'thestar.com': /emeter-nam\.mppglobal\.com\/probes\/JSONP\?/, + 'timeshighereducation.com': /\.timeshighereducation\.com\/sites\/default\/files\/js\/js_bbCGL.+\.js/, 'valeursactuelles.com': /.+\.qiota\.com\/.+/, 'variety.com': /cdn\.cxense\.com\/.+/, 'washingtonpost.com': /.+\.washingtonpost\.com\/.+\/pwapi-proxy\.min\.js/, @@ -353,7 +354,7 @@ function add_grouped_sites(init_rules) { for (let domain of au_news_corp_domains) { allow_cookies.push(domain); use_google_bot.push(domain); - blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-access-.+\.js/; + blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-(access|iframe)-.+\.js/; } for (let domain of au_prov_news_domains) { allow_cookies.push(domain); diff --git a/changelog.txt b/changelog.txt index 4bb7c80..904210c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -8,7 +8,7 @@ Add La Voix du Nord (France) Add The Spectator USA Remove Aftonbladet.se (obsolete) Remove NK News (obsolete) -Fix-update Australia News Corp (amp/no video) +Fix-update Australia News Corp (amp/video-link) Fix-update CharlieHebdo.fr (captcha) Fix-update Discover Magazine Fix-update El Mercurio & La Segunda (mobile) diff --git a/contentScript.js b/contentScript.js index d89e90f..a29e057 100755 --- a/contentScript.js +++ b/contentScript.js @@ -85,17 +85,21 @@ else if (window.location.hostname.endsWith(".com.au") || window.location.hostnam for (let div_hidden of div_hidden_all) div_hidden.removeAttribute('amp-access-hide'); } else if (window.location.href.includes('?amp')) { - window.setTimeout(function () { - let div_hidden = document.querySelector('div[amp-access="subscriber AND status=\'logged-in\'"]'); - if (div_hidden) - div_hidden.removeAttribute('amp-access-hide'); - let placeholders = document.querySelectorAll('amp-img.amp-hidden'); - for (let placeholder of placeholders) { - placeholder.classList.remove('amp-hidden'); - if (placeholder.src && placeholder.src.includes('blank-square.svg')) - removeDOMElement(placeholder); - } - }, 500); // Delay (in milliseconds) + //window.setTimeout(function () { + let div_hidden = document.querySelector('div[amp-access="subscriber AND status=\'logged-in\'"]'); + if (div_hidden) + div_hidden.removeAttribute('amp-access-hide'); + //}, 500); // Delay (in milliseconds) + } + let amp_iframes = document.querySelectorAll('amp-iframe'); + let elem; + for (let amp_iframe of amp_iframes) { + elem = document.createElement('a'); + elem.innerText = 'Video-link'; + elem.setAttribute('href', amp_iframe.getAttribute('src')); + elem.setAttribute('target', '_blank'); + amp_iframe.parentElement.insertBefore(elem, amp_iframe); + removeDOMElement(amp_iframe); } } else { // Australian Seven West Media