Fix popup (update notification; GitLab CORS issue)

This commit is contained in:
magnolia1234 2021-02-16 17:49:29 +01:00
parent 6041c8970d
commit 7206d979f0
7 changed files with 27 additions and 17 deletions

View file

@ -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

View file

@ -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)

View file

@ -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);
}

View file

@ -472,5 +472,5 @@
"*://*.userzoom.com/*",
"*://*.wsj.net/*"
],
"version": "2.0.8.1"
"version": "2.0.8.2"
}

View file

@ -22,7 +22,8 @@
<a href="https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/blob/master/README.md" style="color:black" target="_blank">GitLab</a> |
<a href="https://twitter.com/Magnolia1234B" style="color:black" target="_blank">Twitter</a></div>
<div><a href="https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/raw/master/changelog.txt" style="color:black" target="_blank">Changelog</a> |
<button id="clear_cookies" title="clear cookies (and local storage) for current site">clear cookies</button></div>
<button id="clear_cookies" title="clear cookies (and local storage) for current site">clear cookies</button> |
<button id="button-close" title="close popup">close</button></div>
<div><span id="version_new"></span></div>
<script src="version.js"></script>
<script src="popup.js"></script>

View file

@ -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);

View file

@ -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 => {