diff --git a/changelog.txt b/changelog.txt index 57984dc..df0a23d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release Fix-update Bloomberg (overlay) +Fix-update Toronto Star (map-snippet) * v1.8.9.0 (2020-10-04) Add Hannoversche Allgemeine Zeitung diff --git a/contentScript.js b/contentScript.js index e1d9433..b6409fe 100644 --- a/contentScript.js +++ b/contentScript.js @@ -425,10 +425,40 @@ else if (matchDomain("techinasia.com")) { else if (matchDomain("thestar.com")) { let paywall = document.querySelector('.basic-paywall-new'); - removeDOMElement(paywall); - let tbcs = document.querySelectorAll('.text-block-container'); - for (let tbc of tbcs) { - tbc.removeAttribute('style'); + if (paywall) { + removeDOMElement(paywall); + let tbcs = document.querySelectorAll('.text-block-container'); + for (let tbc of tbcs) { + tbc.removeAttribute('style'); + } + if (document.head.innerText.includes('window.__PRELOADED_STATE__')) { + let html = document.head.outerHTML; + let split1 = html.split('window.__PRELOADED_STATE__ =')[1]; + let state = split1.split('//-->')[0].trim(); + let json = JSON.parse(state); + if (json) { + let body = json.body; + let par_append_text, par_append; + for (let elem of body) { + if (elem.isParagraph) { + par_append_text = parseHtmlEntities(elem.text); + } else if (elem.snippet) { + let parser = new DOMParser(); + let article_html = parser.parseFromString('
' + elem.snippet + '
', 'text/html'); + let article_snippet = article_html.querySelector('div#bpc'); + let pars = document.querySelectorAll('div.c-article-body__content > p'); + for (let par of pars) { + if (par.innerText.includes(par_append_text)) { + par_append = par; + continue; + } + } + if (article_snippet && par_append) + par_append.appendChild(article_snippet); + } + } + } + } } } @@ -649,6 +679,7 @@ else if (matchDomain('faz.net')) { str = str.replace(/If\n\nSG/g, "IfSG"); str = str.replace(/m\n\nRNA/g, "mNRA"); str = str.replace(/St\n\nVO/g, "StVO"); + str = str.replace(/Berl\n\nHG/g, "BerlHG"); str = str.replace(/De\n\n([A-Z])/g, "De$1"); str = str.replace(/La\n\n([A-Z])/g, "La$1"); str = str.replace(/Le\n\n([A-Z])/g, "Le$1"); diff --git a/lp/manifest.json b/lp/manifest.json index f16f1c6..06d9f39 100644 --- a/lp/manifest.json +++ b/lp/manifest.json @@ -318,5 +318,5 @@ "webRequest", "webRequestBlocking" ], - "version": "1.8.9.1" + "version": "1.8.9.2" } \ No newline at end of file diff --git a/manifest.json b/manifest.json index ec8fa9f..bc347b1 100644 --- a/manifest.json +++ b/manifest.json @@ -40,5 +40,5 @@ "webRequest", "webRequestBlocking" ], - "version": "1.8.9.1" + "version": "1.8.9.2" } \ No newline at end of file