Repository restored
This commit is contained in:
7
options/optin/opt-in.css
Normal file
7
options/optin/opt-in.css
Normal file
@@ -0,0 +1,7 @@
|
||||
html, body {
|
||||
padding-left: 0.5em;
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
button {
|
||||
margin: 0.2em 0.2em 0.5em 0;
|
||||
}
|
||||
64
options/optin/opt-in.html
Normal file
64
options/optin/opt-in.html
Normal file
@@ -0,0 +1,64 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Bypass Paywalls Clean (setCookie, custom sites & check update opt-in)</title>
|
||||
<link rel="stylesheet" href="../options_all.css"/>
|
||||
<link rel="stylesheet" href="opt-in.css"/>
|
||||
<script src="opt-in.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div>
|
||||
<p><strong>Bypass Paywalls Clean<br> - setCookie, custom sites & check update opt-in</strong></p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="opt-in-prompt">
|
||||
<p><strong>setCookie opt-in</strong></p>
|
||||
<p>For some sites a necessary cookie has to be set (this cookie doesn't contain any personal information about the user or device):<br><br>
|
||||
None</p>
|
||||
<p>setCookie opt-in enabled: <span id="opt-in-enabled"></span></p>
|
||||
<div id="optin-container">
|
||||
<button id="optin-enable">Enable</button>
|
||||
<button id="optin-disable">Disable</button>
|
||||
</div>
|
||||
<div id="custom-prompt">
|
||||
<p><strong>custom sites opt-in</strong></p>
|
||||
<p>If you want to enable custom sites and also have the option to remove cookies/block general paywall-scripts of 'unlisted' sites:</br>
|
||||
<p>custom sites enabled: <span id="custom-enabled"></span></p>
|
||||
<div id="custom-container">
|
||||
<button id="custom-enable">Enable</button>
|
||||
<button id="custom-disable">Disable</button>
|
||||
</div>
|
||||
<p>You can also just request permissions for the <a href="../options_custom.html">custom sites</a> you added yourself.</p>
|
||||
</div>
|
||||
<div id="update-prompt">
|
||||
<p><strong>check update opt-in</strong></p>
|
||||
<p>Check for update of version (on startup and when opening options):</br>
|
||||
<p>check update enabled: <span id="update-enabled"></span></p>
|
||||
<div id="update-container">
|
||||
<button id="update-enable">Enable</button>
|
||||
<button id="update-disable">Disable</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="counter-prompt">
|
||||
<p><strong>daily users counter opt-in</strong></p>
|
||||
<p>Very basic daily users counter (by counting the download of an empty json-file (no personal information is shared)):</br>
|
||||
<p>daily users counter enabled: <span id="counter-enabled"></span></p>
|
||||
<div id="custom-container">
|
||||
<button id="counter-enable">Enable</button>
|
||||
<button id="counter-disable">Disable</button>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<div style='float:left;padding-bottom:50px'>
|
||||
<small><button><a href="../options.html" style="text-decoration:none;color:inherit">Options</a></button></small>
|
||||
<small><button><a href="../options_custom.html" style="text-decoration:none;color:inherit">Custom sites</a></button></small>
|
||||
<small><button id="button-close">Close</button></small>
|
||||
</div>
|
||||
</p>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
125
options/optin/opt-in.js
Normal file
125
options/optin/opt-in.js
Normal file
@@ -0,0 +1,125 @@
|
||||
var ext_api = (typeof browser === 'object') ? browser : chrome;
|
||||
var url_loc = (typeof browser === 'object') ? 'firefox' : 'chrome';
|
||||
var manifestData = ext_api.runtime.getManifest();
|
||||
var navigator_ua = navigator.userAgent;
|
||||
var navigator_ua_mobile = navigator_ua.toLowerCase().includes('mobile');
|
||||
var yandex_browser = navigator_ua_mobile && (url_loc === 'chrome') && navigator_ua.toLowerCase().includes('yabrowser');
|
||||
var custom_switch = ((manifestData.optional_permissions && manifestData.optional_permissions.length) || (manifestData.optional_host_permissions && manifestData.optional_host_permissions.length)) && !(navigator_ua_mobile && (url_loc === 'chrome') && !yandex_browser);
|
||||
|
||||
window.addEventListener("load", function () {
|
||||
document.getElementById("button-close").addEventListener("click", function () {
|
||||
ext_api.storage.local.set({
|
||||
"optInShown": true,
|
||||
"customShown": true
|
||||
});
|
||||
window.close();
|
||||
});
|
||||
|
||||
var opt_in_enabled = document.getElementById('opt-in-enabled');
|
||||
ext_api.storage.local.get("optIn", function (result) {
|
||||
opt_in_enabled.innerText = result.optIn ? 'YES' : 'NO';
|
||||
});
|
||||
|
||||
document.getElementById("optin-enable").addEventListener("click", function () {
|
||||
ext_api.storage.local.set({
|
||||
"optIn": true,
|
||||
"optInShown": true
|
||||
});
|
||||
opt_in_enabled.innerText = 'YES';
|
||||
});
|
||||
|
||||
document.getElementById("optin-disable").addEventListener("click", function () {
|
||||
ext_api.storage.local.set({
|
||||
"optIn": false,
|
||||
"optInShown": true
|
||||
});
|
||||
opt_in_enabled.innerText = 'NO';
|
||||
});
|
||||
|
||||
var custom_enabled = document.getElementById('custom-enabled');
|
||||
ext_api.permissions.contains({
|
||||
origins: ["*://*/*"]
|
||||
}, function (result) {
|
||||
if (result) {
|
||||
custom_enabled.innerText = 'YES';
|
||||
} else {
|
||||
custom_enabled.innerText = 'NO';
|
||||
}
|
||||
});
|
||||
|
||||
if (custom_switch) {
|
||||
|
||||
document.querySelector('#custom-enable').addEventListener('click', function (event) {
|
||||
ext_api.permissions.request({
|
||||
origins: ["*://*/*"]
|
||||
}, function (granted) {
|
||||
if (granted) {
|
||||
custom_enabled.innerText = 'YES';
|
||||
ext_api.storage.local.set({
|
||||
"customOptIn": true
|
||||
});
|
||||
} else {
|
||||
custom_enabled.innerText = 'NO';
|
||||
}
|
||||
ext_api.storage.local.set({
|
||||
"customShown": true
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelector('#custom-disable').addEventListener('click', function (event) {
|
||||
ext_api.permissions.remove({
|
||||
origins: ["*://*/*", "<all_urls>"]
|
||||
}, function (removed) {
|
||||
if (removed) {
|
||||
custom_enabled.innerText = 'NO';
|
||||
ext_api.storage.local.set({
|
||||
"customOptIn": false
|
||||
});
|
||||
}
|
||||
ext_api.storage.local.set({
|
||||
"customShown": true
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}// custom_switch
|
||||
|
||||
var update_enabled = document.getElementById('update-enabled');
|
||||
ext_api.storage.local.get({optInUpdate: true}, function (result) {
|
||||
update_enabled.innerText = result.optInUpdate ? 'YES' : 'NO';
|
||||
});
|
||||
|
||||
document.getElementById("update-enable").addEventListener("click", function () {
|
||||
ext_api.storage.local.set({
|
||||
"optInUpdate": true
|
||||
});
|
||||
update_enabled.innerText = 'YES';
|
||||
});
|
||||
|
||||
document.getElementById("update-disable").addEventListener("click", function () {
|
||||
ext_api.storage.local.set({
|
||||
"optInUpdate": false
|
||||
});
|
||||
update_enabled.innerText = 'NO';
|
||||
});
|
||||
|
||||
var counter_enabled = document.getElementById('counter-enabled');
|
||||
ext_api.storage.local.get({counter: true}, function (result) {
|
||||
counter_enabled.innerText = result.counter ? 'YES' : 'NO';
|
||||
});
|
||||
|
||||
document.getElementById("counter-enable").addEventListener("click", function () {
|
||||
ext_api.storage.local.set({
|
||||
"counter": true
|
||||
});
|
||||
counter_enabled.innerText = 'YES';
|
||||
});
|
||||
|
||||
document.getElementById("counter-disable").addEventListener("click", function () {
|
||||
ext_api.storage.local.set({
|
||||
"counter": false
|
||||
});
|
||||
counter_enabled.innerText = 'NO';
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user