Fix-update Sueddeutsche Zeitung (+ magazine)

This commit is contained in:
magnolia1234 2020-11-01 12:03:16 +01:00
parent e1a41b305f
commit fdf269880c
4 changed files with 25 additions and 6 deletions

View file

@ -80,6 +80,7 @@ var allow_cookies = [
'slader.com',
'startribune.com',
'stocknews.com',
'sueddeutsche.de',
'techinasia.com',
'the-american-interest.com',
'thehindu.com',
@ -638,7 +639,8 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
let bloomberg_site = (matchUrlDomain('assets.bwbx.io', details.url) && matchUrlDomain('bloomberg.com', header_referer) && isSiteEnabled({url: header_referer}));
let au_nc_amp_site = (matchUrlDomain('cdn.ampproject.org', details.url) && matchUrlDomain(au_news_corp_domains, header_referer) && isSiteEnabled({url: header_referer}));
let au_swm_site = (header_referer && urlHost(header_referer).endsWith('com.au') && details.url.includes('https://s.thewest.com.au/'));
if (!isSiteEnabled(details) && !(inkl_site) && !(bloomberg_site) && !(au_nc_amp_site) && !(au_swm_site)) {
let sz_amp_site = (matchUrlDomain('cdn.ampproject.org', details.url) && matchUrlDomain('sueddeutsche.de', header_referer) && isSiteEnabled({url: header_referer}));
if (!isSiteEnabled(details) && !inkl_site && !bloomberg_site && !au_nc_amp_site && !au_swm_site && !sz_amp_site) {
return;
}
@ -712,7 +714,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
if (tabId !== -1) {
ext_api.tabs.get(tabId, function (currentTab) {
if (isSiteEnabled(currentTab) || medium_custom_domain || au_swm_site) {
if (isSiteEnabled(currentTab) || medium_custom_domain || au_swm_site || sz_amp_site) {
ext_api.tabs.executeScript(tabId, {
file: 'contentScript.js',
runAt: 'document_start'

View file

@ -5,6 +5,7 @@ Post-release
Add Deutsche Wirtschafts Nachrichten
Add WirtschaftsWoche (Germany)
Fix-update Quartz (newsletter)
Fix-update Sueddeutsche Zeitung (+ magazine)
Icon for dark/incognito mode (Chrome)
Save options to storage.local (quota exceeded)

View file

@ -1087,12 +1087,28 @@ else if (matchDomain("irishtimes.com")) {
}
else if (matchDomain("sueddeutsche.de")) {
document.addEventListener('DOMContentLoaded', () => {
let reduced_par = document.querySelector('div.sz-article-body__paragraph--reduced');
let url = window.location.href;
if (url.includes('reduced=true') || reduced_par)
document.addEventListener('DOMContentLoaded', () => {
let offer_page = document.querySelector('div.offer-page');
if (url.startsWith('https://www.sueddeutsche.de') && (url.includes('reduced=true') || offer_page))
window.location.href = url.split('?')[0].replace('www.', 'amphtml.');
else if (url.startsWith('https://sz-magazin.sueddeutsche.de')) {
if (url.includes('reduced=true') || offer_page)
window.location.href = new URL(url).pathname + '!amp';
}
});
window.setTimeout(function () {
if (url.includes('!amp')) {
let paragraph_reduced = document.querySelector('.paragraph--reduced');
if (paragraph_reduced)
paragraph_reduced.classList.remove('paragraph--reduced');
let paragraph_hidden = document.querySelectorAll('.paragraph--hidden');
for (let par_hidden of paragraph_hidden)
par_hidden.classList.remove('paragraph--hidden');
let amp_offerpage = document.querySelector('.amp-offerpage');
removeDOMElement(amp_offerpage);
}
}, 500); // Delay (in milliseconds)
}
else if (matchDomain("charliehebdo.fr")) {

View file

@ -338,5 +338,5 @@
"webRequest",
"webRequestBlocking"
],
"version": "1.9.2.4"
"version": "1.9.2.5"
}