diff --git a/background.js b/background.js index 82eee728..2fe46e14 100644 --- a/background.js +++ b/background.js @@ -878,7 +878,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { } // load toggleIcon.js (icon for dark or incognito mode in Chrome)) - if (typeof browser !== 'object') { + if (typeof browser !== 'object' && ['main_frame', 'xmlhttprequest'].includes(details.type)) { ext_api.tabs.query({ active: true, currentWindow: true diff --git a/changelog.txt b/changelog.txt index f7274fa0..a0b1f867 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release +Fix popup (update notification; GitLab CORS issue) Update limit contentScript (add image/sub_frame) * v2.0.8.0 (2021-02-14) diff --git a/contentScript.js b/contentScript.js index a98f1c76..af39dfda 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1521,7 +1521,9 @@ else if (matchDomain(['gelocal.it', 'ilsecoloxix.it'])) { if (!url.includes('/amp/')) { removeDOMElement(premium); } else { - document.querySelector('div[amp-access="showContent"]')?.removeAttribute('amp-access-hide'); ; + let paywall = document.querySelector('div[amp-access="showContent"]'); + if (paywall) + paywall.removeAttribute('amp-access-hide'); let amp_ads = document.querySelectorAll('amp-ad'); removeDOMElement(...amp_ads); } @@ -2045,10 +2047,15 @@ else if (matchDomain('stratfor.com') && window.location.href.match(/((\w)+(\-)+) } else if (matchDomain(es_epiberica_domains)) { - document.querySelector('div.article-body--truncated')?.classList.remove('article-body--truncated'); - document.querySelector('div.baldomero')?.classList.remove('baldomero'); + let truncated = document.querySelector('div.article-body--truncated'); + if (truncated) + truncated.classList.remove('article-body--truncated'); + let div_hidden = document.querySelector('div.baldomero'); + if (div_hidden) + div_hidden.classList.remove('baldomero'); window.setTimeout(function () { - document.querySelector('div.paywall')?.remove(); + let paywall = document.querySelector('div.paywall'); + removeDOMElement(paywall); }, 500); // Delay (in milliseconds) } @@ -2082,7 +2089,9 @@ else if (matchDomain(de_rp_medien_domains)) { } else if (matchDomain('time.com')) { - document.querySelector('body')?.setAttribute('style', 'position:relative !important;') + let body = document.querySelector('body'); + if (body) + body.setAttribute('style', 'position:relative !important;'); } else if (matchDomain('noz.de')) { @@ -2139,7 +2148,7 @@ function matchDomain(domains, hostname) { } function replaceDomElementExt(url, proxy, base64, selector, text_fail = '') { - let proxyurl = proxy ? 'https://cors-anywhere.herokuapp.com/' : ''; + let proxyurl = proxy ? 'https://bpc-cors-anywhere.herokuapp.com/' : ''; fetch(proxyurl + url, { headers: {"Content-Type": "text/plain", "X-Requested-With": "XMLHttpRequest" } }) .then(response => { let article = document.querySelector(selector); @@ -2168,13 +2177,6 @@ function replaceDomElementExt(url, proxy, base64, selector, text_fail = '') { a_link.href = url; a_link.target = '_blank'; text_fail_div.appendChild(a_link); - text_fail_div.appendChild(document.createElement('br')); - let cors_link = document.createElement('a'); - cors_link.innerText = '-> bpc: allow temporary access to cors-anywhere'; - cors_link.href = 'https://cors-anywhere.herokuapp.com/corsdemo'; - cors_link.target = '_blank'; - cors_link.setAttribute('style', 'font-weight: bold;'); - text_fail_div.appendChild(cors_link); } article.insertBefore(text_fail_div, article.firstChild); } diff --git a/manifest.json b/manifest.json index 71680ff5..2680cf37 100644 --- a/manifest.json +++ b/manifest.json @@ -472,5 +472,5 @@ "*://*.userzoom.com/*", "*://*.wsj.net/*" ], - "version": "2.0.8.1" + "version": "2.0.8.2" } \ No newline at end of file diff --git a/popup.html b/popup.html index f2044493..aa4a1d24 100644 --- a/popup.html +++ b/popup.html @@ -22,7 +22,8 @@ GitLab | Twitter
Changelog | -
+ | +
diff --git a/popup.js b/popup.js index d3e22966..3cf83a71 100644 --- a/popup.js +++ b/popup.js @@ -28,3 +28,9 @@ document.getElementById("clear_cookies").addEventListener('click', function () { ext_api.extension.getBackgroundPage().clear_cookies(); //open(location).close(); }); + +function closeButton() { + window.close(); +} + +document.getElementById("button-close").addEventListener('click', closeButton); diff --git a/version.js b/version.js index 1c8eae42..6ce5832d 100644 --- a/version.js +++ b/version.js @@ -7,7 +7,7 @@ var versionString_new = document.getElementById('version_new'); versionString_new.setAttribute('style', 'font-weight: bold;'); var anchorEl; -const proxyurl = ''; //"https://cors-anywhere.herokuapp.com/"; +const proxyurl = "https://bpc-cors-anywhere.herokuapp.com/"; const manifest_new = 'https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/raw/master/manifest.json'; fetch(proxyurl + manifest_new, { headers: { "Content-Type": "application/json", "X-Requested-With": "XMLHttpRequest" } }) .then(response => {