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('