Update custom sites (auto-enable in options)
This commit is contained in:
parent
4f2968dc26
commit
cb10955352
14
README.md
14
README.md
@ -20,7 +20,7 @@ The following instructions are needed to install third-party extensions in [Chro
|
||||
4. Go to the extensions page (`chrome://extensions` or `edge://extensions`).
|
||||
5. Enable Developer Mode.
|
||||
6. Click `Load unpacked` and select the extension folder.
|
||||
* in Chrome disable the developer mode extensions popup by enabling the extensions toolbar menu under (experimental) chrome flags: chrome://flags/#extensions-toolbar-menu
|
||||
* in Chrome/Opera/Brave disable the developer mode extensions popup by enabling the extensions toolbar menu under (experimental) chrome flags: chrome://flags/#extensions-toolbar-menu
|
||||
|
||||
#### Other Chromium browsers (Opera/Vivaldi)
|
||||
1. Download the extension as a .crx file from the [download page](https://bitbucket.org/magnolia1234/bypass-paywalls-chrome-clean/downloads).
|
||||
@ -38,11 +38,11 @@ Visit the [Firefox repository](https://bitbucket.org/magnolia1234/bypass-paywall
|
||||
|
||||
**Notes**
|
||||
* This extension works best alongside the adblocker [uBlock Origin](https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm?hl=en).
|
||||
* On Yandex Android use uBlock Origin dev-release.
|
||||
* If you live in the EU, also consider installing the extension [I don't care about cookies](https://chrome.google.com/webstore/detail/i-dont-care-about-cookies/fihnjjcciajhdojfnbdddfaoknhalnja) in order to remove cookie warnings.
|
||||
* Do not delete extension's folder from your computer/smartphone or Bypass Paywalls Clean will disappear at restart.
|
||||
* On Yandex Android use [uBlock Origin development build](https://chrome.google.com/webstore/detail/ublock-origin-dev-build/cgbcahbpdhpcegmbfconppldiemgcoii).
|
||||
* If you live in the EU, also consider installing the extension [I don't care about cookies](https://chrome.google.com/webstore/detail/i-dont-care-about-cookies/fihnjjcciajhdojfnbdddfaoknhalnja) in order to remove cookie warnings (or use filter Easylist Cookies in uBlock Origin).
|
||||
* Do not delete extension's folder from your computer/smartphone or Bypass Paywalls Clean (in developer mode) will disappear at restart.
|
||||
* Every time you open Chrome it may warn you about running extensions in developer mode, just click 🗙 to keep the extension enabled.
|
||||
* You will be logged out for any site you have checked.
|
||||
* You will be logged out for most of the sites you have checked.
|
||||
|
||||
### List of supported websites
|
||||
##### World news
|
||||
@ -341,13 +341,13 @@ Remember to check the [previous requests](https://bitbucket.org/magnolia1234/byp
|
||||
1. Visit an article on the site you want to bypass the paywall for and copy the article title.
|
||||
2. Open up a new incognito window (Ctrl+Shift+N) and paste the article title into Google.
|
||||
3. Click on the same article from the Google search results page. Or you can:
|
||||
4. Disable javascript on the website by clicking the button right icon </> on the uBlock panel.
|
||||
4. Disable javascript on the website by clicking the button right icon </> on the uBlock Origin panel.
|
||||
5. Refresh the page.
|
||||
|
||||
### Add custom site
|
||||
Add your own custom site (also for testing).
|
||||
Check 'Options'-link in popup-menu and go to custom sites.
|
||||
By default sites' cookies are removed after page loads (to bypass article limit).
|
||||
By default sites' cookies/local storage are removed after page loads (to bypass article limit).
|
||||
Also you can enable Googlebot user-agent or disable Javascript for (sub)domain(s)/external sources.
|
||||
|
||||
### Troubleshooting
|
||||
|
@ -304,6 +304,28 @@ ext_api.storage.onChanged.addListener(function (changes, namespace) {
|
||||
}
|
||||
if (key === 'sites_custom') {
|
||||
var sites_custom = storageChange.newValue;
|
||||
var sites_custom_old = storageChange.oldValue;
|
||||
|
||||
// add/remove custom sites in options
|
||||
var sites_custom_added = Object.keys(sites_custom).filter(x => !Object.keys(sites_custom_old).includes(x) && !defaultSites.hasOwnProperty(x));
|
||||
var sites_custom_removed = Object.keys(sites_custom_old).filter(x => !Object.keys(sites_custom).includes(x) && !defaultSites.hasOwnProperty(x));
|
||||
|
||||
chrome.storage.sync.get({
|
||||
sites: {}
|
||||
}, function (items) {
|
||||
var sites = items.sites;
|
||||
for (var key of sites_custom_added)
|
||||
sites[key] = sites_custom[key].domain;
|
||||
for (var key of sites_custom_removed)
|
||||
delete sites[key];
|
||||
|
||||
chrome.storage.sync.set({
|
||||
sites: sites
|
||||
}, function () {
|
||||
true;
|
||||
});
|
||||
});
|
||||
|
||||
use_google_bot = use_google_bot_default.slice();
|
||||
block_js_custom = [];
|
||||
block_js_custom_ext = [];
|
||||
@ -323,6 +345,18 @@ ext_api.storage.onChanged.addListener(function (changes, namespace) {
|
||||
// reset disableJavascriptOnListedSites eventListener
|
||||
ext_api.webRequest.onBeforeRequest.removeListener(disableJavascriptOnListedSites);
|
||||
ext_api.webRequest.handlerBehaviorChanged();
|
||||
|
||||
// Refresh the current tab
|
||||
ext_api.tabs.query({
|
||||
active: true,
|
||||
currentWindow: true
|
||||
}, function (tabs) {
|
||||
if (tabs[0].url && tabs[0].url.indexOf("http") !== -1) {
|
||||
ext_api.tabs.update(tabs[0].id, {
|
||||
url: tabs[0].url
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -16,8 +16,8 @@
|
||||
<body>
|
||||
<h2>Custom Sites</h2>
|
||||
<div style="width:90%;">
|
||||
To add new site, enter a unique title/domain (without www.) and select options for googlebot/block javascript (block on (sub)domain of site and/or external domains).
|
||||
Then enable your new site in <a href="options.html" style="color:black">options</a> (cookies will be removed by default).
|
||||
To add new site, enter a unique title/domain (without www.) and select options for Googlebot/block Javascript (block on (sub)domain(s) of site and/or external domains).<br>
|
||||
Custom sites are enabled automatically in <a href="options.html" style="color:black">options</a> (cookies will be removed by default).
|
||||
<br/><br/>
|
||||
</div>
|
||||
<div id='add_site'></div>
|
||||
@ -29,8 +29,7 @@
|
||||
<div style="clear:both;"></div>
|
||||
<div>
|
||||
<h3>List of custom sites</h3>
|
||||
Disable deleted sites in <a href="options.html" style="color:black">options</a>.
|
||||
<br/><br/>
|
||||
<br/>
|
||||
</div>
|
||||
<div id='custom_sites'></div>
|
||||
<br/>
|
||||
|
@ -124,7 +124,7 @@ function add_options() {
|
||||
}, function () {
|
||||
// Update status to let user know new custom site was added.
|
||||
var status_add = document.getElementById('status_add');
|
||||
status_add.textContent = 'Site added. Also enable site in options (save).';
|
||||
status_add.textContent = 'Site added.';
|
||||
setTimeout(function () {
|
||||
//status.textContent = '';
|
||||
renderOptions();
|
||||
@ -151,7 +151,7 @@ function delete_options() {
|
||||
}, function () {
|
||||
// Update status to let user know custom site was deleted.
|
||||
var status_delete = document.getElementById('status_delete');
|
||||
status_delete.textContent = 'Site deleted. Also disable site in options (save).';
|
||||
status_delete.textContent = 'Site deleted.';
|
||||
setTimeout(function () {
|
||||
//status.textContent = '';
|
||||
renderOptions();
|
||||
@ -221,7 +221,6 @@ function renderOptions() {
|
||||
selectEl.add(optionEl);
|
||||
}
|
||||
labelEl.appendChild(selectEl);
|
||||
//labelEl.appendChild(document.createTextNode(''));
|
||||
custom_sitesEl.appendChild(labelEl);
|
||||
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user