Fix NzHerald (timing)

This commit is contained in:
magnolia1234 2022-11-24 17:30:56 +01:00
parent 547cf0880a
commit 3ca76326ed
5 changed files with 43 additions and 23 deletions

View File

@ -6,6 +6,7 @@ Add Haaretz.co.il & The Marker
Remove LaVie.fr
Fix & grouping Australia Nine Entertainment
Fix La Vanguardia (images)
Fix NzHerald (timing)
Fix Nzz.ch regional (css)
* v2.9.4.0 (2022-11-20)

View File

@ -2480,10 +2480,10 @@ else if (matchDomain('valor.globo.com')) {
replaceDomElementExt(url_cache, true, false, 'div.protected-content');
}
window.setTimeout(function () {
let skeleton_box = document.querySelector('div.glb-skeleton-box');
if (skeleton_box) {
skeleton_box.classList.remove('glb-skeleton-box');
skeleton_box.removeAttribute('style');
let skeleton_box = document.querySelectorAll('div.glb-skeleton-box');
for (let elem of skeleton_box) {
elem.classList.remove('glb-skeleton-box');
elem.removeAttribute('style');
}
}, 1000);
}
@ -3430,13 +3430,7 @@ else if (matchDomain('nytimes.com')) {
}
else if (matchDomain('nzherald.co.nz')) {
function nzherald_main() {
if (window.Fusion)
window.Fusion.globalContent.isPremium = false;
}
window.setTimeout(function () {
insert_script(nzherald_main);
}, 100);
// plus code in contentScript_once.js (timing)
let article_content = document.querySelector('.article__content');
if (article_content) {
let premium = document.querySelector('span.ellipsis');
@ -3922,18 +3916,21 @@ else if (matchDomain('theglobeandmail.com')) {
}
else if (matchDomain(['thehindu.com', 'thehindubusinessline.com'])) {
let counter = document.querySelector('#test');
removeDOMElement(counter);
if (!window.location.pathname.endsWith('/amp/')) {
let counter = document.querySelector('#test');
let ads = document.querySelectorAll('.ad, .article-ad, .dfp-ad');
removeDOMElement(counter, ...ads);
} else {
let ads = document.querySelectorAll('amp-ad, amp-embed, [class^="height"], [class^="advt"], [id^="piano"]');
removeDOMElement(...ads);
}
function hindu_main() {
document.addEventListener('bpc_event', function (e) {
if (window) {
window.Adblock = false;
window.isNonSubcribed = false;
}
})
if (window) {
window.Adblock = false;
window.isNonSubcribed = false;
}
}
insert_script(hindu_main);
document.dispatchEvent(new CustomEvent('bpc_event', {}));
}
else if (matchDomain('theinitium.com')) {

View File

@ -25,6 +25,16 @@ if (matchDomain('gitlab.com')) {
}, 1000);
}
else if (matchDomain('nzherald.co.nz')) {
function nzherald_main() {
if (window.Fusion)
window.Fusion.globalContent.isPremium = false;
}
window.setTimeout(function () {
insert_script(nzherald_main);
}, 100);
}
function matchDomain(domains, hostname) {
var matched_domain = false;
if (!hostname)
@ -34,3 +44,14 @@ function matchDomain(domains, hostname) {
domains.some(domain => (hostname === domain || hostname.endsWith('.' + domain)) && (matched_domain = domain));
return matched_domain;
}
function insert_script(func, insertAfterDom) {
let bpc_script = document.querySelector('script#bpc_script');
if (!bpc_script) {
let script = document.createElement('script');
script.setAttribute('id', 'bpc_script');
script.appendChild(document.createTextNode('(' + func + ')();'));
let insertAfter = insertAfterDom ? insertAfterDom : (document.body || document.head || document.documentElement);
insertAfter.appendChild(script);
}
}

View File

@ -39,7 +39,8 @@
],
"content_scripts": [{
"matches": [
"*://*.gitlab.com/magnolia1234"
"*://*.gitlab.com/magnolia1234",
"*://*.nzherald.co.nz/*"
],
"run_at": "document_start",
"js": ["contentScript_once.js"]
@ -731,5 +732,5 @@
"*://gcm.omerlocdn.com/*",
"*://webcache.googleusercontent.com/*"
],
"version": "2.9.4.4"
"version": "2.9.4.5"
}

View File

@ -1869,7 +1869,7 @@ var defaultSites = {
"The Hindu": {
domain: "thehindu.com",
allow_cookies: 1,
block_regex: /(cdn\.cxense\.com\/|\.tinypass\.com\/)/
block_regex: /(cdn\.cxense\.com\/|\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js)/
},
"The Hindu BusinessLine": {
domain: "thehindubusinessline.com",