diff --git a/README.md b/README.md index 0f449d6..9d6b149 100644 --- a/README.md +++ b/README.md @@ -689,6 +689,7 @@ Grouped in options:\ [LiveMint](https://www.livemint.com) - [MediaNama](https://www.medianama.com) - [Mid-Day](https://www.mid-day.com) - +[Outlook](https://www.outlookindia.com) - [The Economic Times (ET Prime)](https://economictimes.indiatimes.com) - [The Hindu](https://www.thehindu.com) - [The Hindu BusinessLine](https://www.thehindubusinessline.com) - diff --git a/background.js b/background.js index 486aa2c..a256112 100644 --- a/background.js +++ b/background.js @@ -149,7 +149,7 @@ function set_rules(sites, sites_updated, sites_custom) { let site_default = defaultSites.hasOwnProperty(site) ? site : Object.keys(defaultSites).find(default_key => compareKey(default_key, site)); if (site_default) { rule = defaultSites[site_default]; - if (sites_updated.hasOwnProperty(site_default)) + if (sites_updated.hasOwnProperty(site_default) && !sites_updated[site_default].new_site) rule = sites_updated[site_default]; } else if (sites_updated.hasOwnProperty(site)) { // updated (new) sites rule = sites_updated[site]; diff --git a/changelog.txt b/changelog.txt index 3125f5f..8b5644f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ Post-release Add Aftonbladet.se Add Investors' Chronicle (UK) Add Nzz.ch Regional (opt-in to custom sites) +Add Outlook India Fix ABC.es (mobile) Fix Adweek (free articles only) Fix Quartz (newsletter) diff --git a/contentScript.js b/contentScript.js index 67c2d4e..6f83a9e 100644 --- a/contentScript.js +++ b/contentScript.js @@ -64,7 +64,7 @@ if ((bg2csData !== undefined) && bg2csData.ld_json && dompurify_loaded) { removeDOMElement(paywall); let json_script = getArticleJsonScript(); if (json_script) { - let json_text = JSON.parse(json_script.text).articleBody; + let json_text = parseHtmlEntities(JSON.parse(json_script.text).articleBody); let content = document.querySelector(article_sel); if (json_text && content) { let parser = new DOMParser(); @@ -2753,7 +2753,7 @@ else if (matchDomain('hilltimes.com')) { if (json_script) { let json = JSON.parse(json_script.text).filter(x => x.articleBody)[0]; if (json) { - let json_text = json.articleBody.replace(/ /g, '').replace(/(\.|\%)\s{3,}/g, "$&\r\n\r\n"); + let json_text = parseHtmlEntities(json.articleBody).replace(/(\.|\%)\s{3,}/g, "$&\r\n\r\n"); let content = document.querySelector('div#xorg'); if (json_text && content) content.innerText = '\r\n' + json_text; @@ -3120,6 +3120,27 @@ else if (matchDomain('nytimes.com')) { } } +else if (matchDomain('outlookindia.com')) { + let paywall = document.querySelector('div.paywall'); + if (paywall) { + removeDOMElement(paywall); + let json_script = getArticleJsonScript(); + if (json_script) { + let json = JSON.parse(json_script.text); + if (json) { + let json_text = parseHtmlEntities(json.articleBody).replace(/\n/g, "$&\r\n"); + let content = document.querySelector('div#articleBody'); + if (json_text && content) { + content.innerHTML = ''; + let article_new = document.createElement('p'); + article_new.innerText = json_text; + content.appendChild(article_new); + } + } + } + } +} + else if (matchDomain('quora.com')) { let overlays = document.querySelectorAll('div[class*="_overlay"]'); removeDOMElement(...overlays); @@ -3956,9 +3977,9 @@ function breakText(str) { }; function parseHtmlEntities(encodedString) { - let translate_re = /&(nbsp|amp|quot|lt|gt|deg|hellip|laquo|raquo|ldquo|rdquo|lsquo|rsquo|mdash);/g; + let translate_re = /&(nbsp|amp|quot|lt|gt|deg|hellip|laquo|raquo|ldquo|rdquo|lsquo|rsquo|mdash|shy);/g; let translate = {"nbsp": " ", "amp": "&", "quot": "\"", "lt": "<", "gt": ">", "deg": "°", "hellip": "…", - "laquo": "«", "raquo": "»", "ldquo": "“", "rdquo": "”", "lsquo": "‘", "rsquo": "’", "mdash": "—"}; + "laquo": "«", "raquo": "»", "ldquo": "“", "rdquo": "”", "lsquo": "‘", "rsquo": "’", "mdash": "—", "shy": ""}; return encodedString.replace(translate_re, function (match, entity) { return translate[entity]; }).replace(/&#(\d+);/gi, function (match, numStr) { diff --git a/manifest.json b/manifest.json index b4a9c6b..2081cde 100644 --- a/manifest.json +++ b/manifest.json @@ -445,6 +445,7 @@ "*://*.orlandosentinel.com/*", "*://*.ostsee-zeitung.de/*", "*://*.otz.de/*", + "*://*.outlookindia.com/*", "*://*.outsideonline.com/*", "*://*.oxygenmag.com/*", "*://*.paloaltoonline.com/*", @@ -666,5 +667,5 @@ "*://*.wsj.net/*", "*://webcache.googleusercontent.com/*" ], - "version": "2.6.4.6" + "version": "2.6.4.7" } diff --git a/sites.js b/sites.js index 1df5c38..5d46ca5 100644 --- a/sites.js +++ b/sites.js @@ -1277,6 +1277,10 @@ var defaultSites = { allow_cookies: 1, block_regex: /(\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-((sticky-)?ad|subscriptions)-.+\.js)/ }, + "Outlook India": { + domain: "outlookindia.com", + allow_cookies: 1 + }, "Outside magazines": { domain: "###_usa_outside_mag", group: [ diff --git a/sites_updated.json b/sites_updated.json index 3c7a21f..638f47d 100644 --- a/sites_updated.json +++ b/sites_updated.json @@ -24,5 +24,11 @@ "Nürnberger Nachrichten": { "domain": "nn.de", "block_regex": "(cdn\\.cxense\\.com\\/|\\.piano\\.io\\/)" + }, + "Outlook India": { + "domain": "outlookindia.com", + "allow_cookies": 1, + "ld_json": "div.paywall|div#articleBody", + "new_site": 1 } }