mirror of
https://github.com/iamadamdev/bypass-paywalls-chrome
synced 2025-04-30 05:24:26 +02:00
NZ Herald update (#962)
* Update NZ Herald to make menu work * NZ Herald update
This commit is contained in:
parent
0363b4a198
commit
0c73e41608
@ -178,6 +178,7 @@ const blockedRegexes = {
|
|||||||
'inquirer.com': /.+\.tinypass\.com\/.+/,
|
'inquirer.com': /.+\.tinypass\.com\/.+/,
|
||||||
'lastampa.it': /.+\.repstatic\.it\/minify\/sites\/lastampa\/.+\/config\.cache\.php\?name=social_js/,
|
'lastampa.it': /.+\.repstatic\.it\/minify\/sites\/lastampa\/.+\/config\.cache\.php\?name=social_js/,
|
||||||
'lrb.co.uk': /.+\.tinypass\.com\/.+/,
|
'lrb.co.uk': /.+\.tinypass\.com\/.+/,
|
||||||
|
'nzherald.co.nz': /(.+nzherald\.co\.nz\/.+\/subs\/p\.js|.+nzherald\.co\.nz\/.+\/react\.js|.+nzherald\.co\.nz\/.+\/appear\.js|.+nzherald\.co\.nz\/.+\/tracking\/.+|.+nzherald\.co\.nz\/.+\/default\.js|.+\/newsbarscript\.js)/,
|
||||||
'medscape.com': /.+\.medscapestatic\.com\/.*medscape-library\.js/,
|
'medscape.com': /.+\.medscapestatic\.com\/.*medscape-library\.js/,
|
||||||
'interest.co.nz': /(.+\.presspatron\.com.+|.+interest\.co\.nz.+pp-ablock-banner\.js)/,
|
'interest.co.nz': /(.+\.presspatron\.com.+|.+interest\.co\.nz.+pp-ablock-banner\.js)/,
|
||||||
'repubblica.it': /scripts\.repubblica\.it\/pw\/pw\.js.+/,
|
'repubblica.it': /scripts\.repubblica\.it\/pw\/pw\.js.+/,
|
||||||
|
@ -134,31 +134,7 @@ if (matchDomain('elmercurio.com')) {
|
|||||||
const counter = document.getElementById('article-counter');
|
const counter = document.getElementById('article-counter');
|
||||||
removeDOMElement(counter);
|
removeDOMElement(counter);
|
||||||
} else if (matchDomain('nzherald.co.nz')) {
|
} else if (matchDomain('nzherald.co.nz')) {
|
||||||
const articleContent = document.querySelector('.article__content');
|
NZHerald();
|
||||||
if (articleContent) {
|
|
||||||
const articleOffer = document.querySelector('.article-offer');
|
|
||||||
if (articleOffer) {
|
|
||||||
const cssSelector = articleContent.querySelectorAll('p')[5].getAttribute('class');
|
|
||||||
const hiddenNotPars = articleContent.querySelectorAll('.' + cssSelector + ':not(p)');
|
|
||||||
for (const hiddenNotPar of hiddenNotPars) {
|
|
||||||
hiddenNotPar.classList.remove(cssSelector);
|
|
||||||
hiddenNotPar.removeAttribute('style');
|
|
||||||
}
|
|
||||||
const hiddenPars = articleContent.querySelectorAll('p.' + cssSelector);
|
|
||||||
let parHtml, parDom;
|
|
||||||
const parser = new DOMParser();
|
|
||||||
for (const hiddenPar of hiddenPars) {
|
|
||||||
const parHtml = parser.parseFromString('<div style="margin: 10px 0px; font-size: 17px">' + hiddenPar.innerHTML + '</div>', 'text/html');
|
|
||||||
const parDom = parHtml.querySelector('div');
|
|
||||||
articleContent.insertBefore(parDom, hiddenPar);
|
|
||||||
}
|
|
||||||
const firstSpan = document.querySelector('p > span');
|
|
||||||
if (firstSpan) { firstSpan.removeAttribute('class'); }
|
|
||||||
removeDOMElement(articleOffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const premiumToaster = document.querySelector('#premium-toaster');
|
|
||||||
removeDOMElement(premiumToaster);
|
|
||||||
} else if (matchDomain('interest.co.nz')) {
|
} else if (matchDomain('interest.co.nz')) {
|
||||||
const wrapper = document.getElementById('pp-ablock-banner-wrapper');
|
const wrapper = document.getElementById('pp-ablock-banner-wrapper');
|
||||||
const overlay = document.querySelector('.black-overlay');
|
const overlay = document.querySelector('.black-overlay');
|
||||||
@ -518,3 +494,55 @@ function pageContains (selector, text) {
|
|||||||
return RegExp(text).test(element.textContent);
|
return RegExp(text).test(element.textContent);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function NZHerald() {
|
||||||
|
window.setTimeout(function () {
|
||||||
|
const articleBody = document.querySelector('.article__body');
|
||||||
|
if (articleBody) {
|
||||||
|
const childItems = articleBody.getElementsByTagName('*');
|
||||||
|
let classHidden = '';
|
||||||
|
for (const el of childItems) {
|
||||||
|
if (el.getAttribute('class') !== null && el.getAttribute('style') !== null && classHidden === '') {
|
||||||
|
classHidden = el.getAttribute('class');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (classHidden !== '') {
|
||||||
|
for (const el of childItems) {
|
||||||
|
el.classList.remove(classHidden);
|
||||||
|
el.removeAttribute('style');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const overlay = document.querySelector('#premium-toaster');
|
||||||
|
if (overlay) {
|
||||||
|
overlay.style.display = 'none';
|
||||||
|
}
|
||||||
|
const advert = document.querySelector('.section-iframe.both');
|
||||||
|
if (advert) {
|
||||||
|
advert.style.display = 'none';
|
||||||
|
}
|
||||||
|
const els = document.querySelectorAll('.header__navigation-toggle-button');
|
||||||
|
for (var i = 0; i < els.length; i++) {
|
||||||
|
els[i].addEventListener("click", function(ev) {
|
||||||
|
document.querySelector('.container').classList.toggle('container--sidebar-is-active');
|
||||||
|
ev.stopImmediatePropagation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const sub_els = document.querySelectorAll('.subnavigation');
|
||||||
|
for (var i = 0; i < sub_els.length; i++) {
|
||||||
|
sub_els[i].addEventListener("mouseover", function() {
|
||||||
|
this.childNodes[1].classList.add('subnavigation__item-wrapper--is-active');
|
||||||
|
});
|
||||||
|
sub_els[i].addEventListener("mouseleave", function() {
|
||||||
|
this.childNodes[1].classList.remove('subnavigation__item-wrapper--is-active');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const acc_els = document.querySelectorAll('.accordion__button');
|
||||||
|
for (var i = 0; i < acc_els.length; i++) {
|
||||||
|
acc_els[i].addEventListener("click", function(ev) {
|
||||||
|
this.parentNode.classList.toggle('accordion--is-expanded');
|
||||||
|
ev.stopImmediatePropagation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user