mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-13 01:34:16 +01:00
Update options: restore opt-in for custom sites
Synching with Chrome
This commit is contained in:
parent
1ffeff3eab
commit
f1a8335955
7 changed files with 39 additions and 13 deletions
|
@ -1340,6 +1340,27 @@ ext_api.storage.local.get(["optInShown", "customShown"], function (result) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// restore custom sites opt-in on reload (chrome-only, load upacked)
|
||||||
|
if (typeof browser !== 'object') {
|
||||||
|
ext_api.storage.local.get({
|
||||||
|
sites: {},
|
||||||
|
customOptIn: false
|
||||||
|
}, function (result) {
|
||||||
|
let options_restore_custom = Object.values(result.sites).includes('#options_restore_custom');
|
||||||
|
if (result.customOptIn && options_restore_custom) {
|
||||||
|
ext_api.permissions.contains({
|
||||||
|
origins: ["<all_urls>"]
|
||||||
|
}, function (result_perm) {
|
||||||
|
if (!result_perm) {
|
||||||
|
ext_api.tabs.create({
|
||||||
|
url: "options/optin/opt-in.html"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function filterObject(obj, callback) {
|
function filterObject(obj, callback) {
|
||||||
return Object.fromEntries(Object.entries(obj).
|
return Object.fromEntries(Object.entries(obj).
|
||||||
filter(([key, val]) => callback(val, key)));
|
filter(([key, val]) => callback(val, key)));
|
||||||
|
|
|
@ -16,8 +16,11 @@ function bpc_count_daily_users(dateStr) {
|
||||||
let count_json = 'https://bitbucket.org/bpc_redux/bpc-firefox-daily-users/downloads/bpc-daily-users-' + dateStr + '.json';
|
let count_json = 'https://bitbucket.org/bpc_redux/bpc-firefox-daily-users/downloads/bpc-daily-users-' + dateStr + '.json';
|
||||||
fetch(count_json, {mode: 'no-cors'});
|
fetch(count_json, {mode: 'no-cors'});
|
||||||
let count_mobile_json = 'https://bitbucket.org/bpc_redux/bpc-firefox-mobile-daily-users/downloads/bpc-daily-users-' + dateStr + '.json';
|
let count_mobile_json = 'https://bitbucket.org/bpc_redux/bpc-firefox-mobile-daily-users/downloads/bpc-daily-users-' + dateStr + '.json';
|
||||||
|
let count_desktop_json = 'https://bitbucket.org/bpc_redux/bpc-firefox-desktop-daily-users/downloads/bpc-daily-users-' + dateStr + '.json';
|
||||||
if (window.navigator && window.navigator.userAgent.match(/(mobile|android)/i))
|
if (window.navigator && window.navigator.userAgent.match(/(mobile|android)/i))
|
||||||
fetch(count_mobile_json, {mode: 'no-cors'});
|
fetch(count_mobile_json, {mode: 'no-cors'});
|
||||||
|
else
|
||||||
|
fetch(count_desktop_json, {mode: 'no-cors'});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ Add Billboard
|
||||||
Add La Tribune (France)
|
Add La Tribune (France)
|
||||||
Add Le Telegramme (France)
|
Add Le Telegramme (France)
|
||||||
Fix-update Mexico News Daily
|
Fix-update Mexico News Daily
|
||||||
|
Update options: restore opt-in for custom sites (on reload; Chrome-only)
|
||||||
|
|
||||||
* v2.1.4.0 (2021-03-28)
|
* v2.1.4.0 (2021-03-28)
|
||||||
Add Aachener Zeitung (Germany)
|
Add Aachener Zeitung (Germany)
|
||||||
|
|
|
@ -701,8 +701,8 @@ else if (matchDomain("theglobeandmail.com")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (matchDomain("sofrep.com")) {
|
else if (matchDomain("sofrep.com")) {
|
||||||
const banner = document.getElementById('scrollerCTA');
|
let banners = document.querySelectorAll('#scrollerCTA, #botCta');
|
||||||
removeDOMElement(banner);
|
removeDOMElement(...banners);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (matchDomain("newstatesman.com")) {
|
else if (matchDomain("newstatesman.com")) {
|
||||||
|
|
|
@ -499,5 +499,5 @@
|
||||||
"*://*.wallkit.net/*",
|
"*://*.wallkit.net/*",
|
||||||
"*://*.wsj.net/*"
|
"*://*.wsj.net/*"
|
||||||
],
|
],
|
||||||
"version": "2.1.4.4"
|
"version": "2.1.4.5"
|
||||||
}
|
}
|
|
@ -7,9 +7,7 @@ window.addEventListener("load", function () {
|
||||||
opt_in_enabled.innerText = result.optIn ? 'YES' : 'NO';
|
opt_in_enabled.innerText = result.optIn ? 'YES' : 'NO';
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("optin-enable").addEventListener(
|
document.getElementById("optin-enable").addEventListener("click", function () {
|
||||||
"click",
|
|
||||||
function () {
|
|
||||||
ext_api.storage.local.set({
|
ext_api.storage.local.set({
|
||||||
"optIn": true,
|
"optIn": true,
|
||||||
"optInShown": true
|
"optInShown": true
|
||||||
|
@ -17,9 +15,7 @@ window.addEventListener("load", function () {
|
||||||
opt_in_enabled.innerText = 'YES';
|
opt_in_enabled.innerText = 'YES';
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("optin-disable").addEventListener(
|
document.getElementById("optin-disable").addEventListener("click", function () {
|
||||||
"click",
|
|
||||||
function () {
|
|
||||||
ext_api.storage.local.set({
|
ext_api.storage.local.set({
|
||||||
"optIn": false,
|
"optIn": false,
|
||||||
"optInShown": true
|
"optInShown": true
|
||||||
|
@ -27,9 +23,7 @@ window.addEventListener("load", function () {
|
||||||
opt_in_enabled.innerText = 'NO';
|
opt_in_enabled.innerText = 'NO';
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("button-close").addEventListener(
|
document.getElementById("button-close").addEventListener("click", function () {
|
||||||
"click",
|
|
||||||
function () {
|
|
||||||
ext_api.storage.local.set({
|
ext_api.storage.local.set({
|
||||||
"optInShown": true,
|
"optInShown": true,
|
||||||
"customShown": true
|
"customShown": true
|
||||||
|
@ -54,6 +48,9 @@ window.addEventListener("load", function () {
|
||||||
}, function (granted) {
|
}, function (granted) {
|
||||||
if (granted) {
|
if (granted) {
|
||||||
custom_enabled.innerText = 'YES';
|
custom_enabled.innerText = 'YES';
|
||||||
|
ext_api.storage.local.set({
|
||||||
|
"customOptIn": true
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
custom_enabled.innerText = 'NO';
|
custom_enabled.innerText = 'NO';
|
||||||
}
|
}
|
||||||
|
@ -69,7 +66,10 @@ window.addEventListener("load", function () {
|
||||||
}, function (removed) {
|
}, function (removed) {
|
||||||
if (removed) {
|
if (removed) {
|
||||||
custom_enabled.innerText = 'NO';
|
custom_enabled.innerText = 'NO';
|
||||||
} else {}
|
ext_api.storage.local.set({
|
||||||
|
"customOptIn": false
|
||||||
|
});
|
||||||
|
}
|
||||||
ext_api.storage.local.set({
|
ext_api.storage.local.set({
|
||||||
"customShown": true
|
"customShown": true
|
||||||
});
|
});
|
||||||
|
|
1
sites.js
1
sites.js
|
@ -296,6 +296,7 @@ var defaultSites =
|
||||||
"TribDss": "tribdss.com",
|
"TribDss": "tribdss.com",
|
||||||
"* BPC settings": "###",
|
"* BPC settings": "###",
|
||||||
"Show options on update": "#options_on_update",
|
"Show options on update": "#options_on_update",
|
||||||
|
"Restore opt-in for custom sites (on reload; Chrome-only)": "#options_restore_custom",
|
||||||
"The Wall Street Journal - no Googlebot (http error 500)": "#options_disable_gb_wsj"
|
"The Wall Street Journal - no Googlebot (http error 500)": "#options_disable_gb_wsj"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue