WSJ fixes

master
ghost 2019-02-07 19:23:57 -08:00
parent 853110c4ba
commit 429e20404d
3 changed files with 23 additions and 8 deletions

View File

@ -13,7 +13,7 @@
1. Drag the `bypass-paywalls-chrome-master` folder anywhere on the page to import it. 1. Drag the `bypass-paywalls-chrome-master` folder anywhere on the page to import it.
Notes: Notes:
* Every time you open Chrome it may warn you about running extensions in developer mode, just hit 🗙 to keep the extension enabled. * 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 any site you have checked.
* This extension works best along side the adblocker uBlock Origin. * This extension works best along side the adblocker uBlock Origin.
@ -75,7 +75,7 @@ Wired (wired.com)
3. Click on the same article from the Google search results page. If it loads without a paywall you can [submit a request](https://github.com/iamadamdev/bypass-paywalls-firefox/issues/new) to add the site, otherwise my extension cannot bypass it either. 3. Click on the same article from the Google search results page. If it loads without a paywall you can [submit a request](https://github.com/iamadamdev/bypass-paywalls-firefox/issues/new) to add the site, otherwise my extension cannot bypass it either.
### Troubleshooting ### Troubleshooting
* If it doesn't work for an article try unchecking the site in Options, save, refresh the article, then re-check the site, save and refresh the article again. * On WSJ if you are already viewing an article and click into another article and the paywall comes up, try refreshing the page (and click 🗙 to close the "Continue reading your article with a WSJ membership" popup).
* For The Denver Post turn off uBlock. * For The Denver Post turn off uBlock.
### License ### License

View File

@ -144,7 +144,6 @@ chrome.storage.onChanged.addListener(function(changes, namespace) {
} }
}); });
// Set and show default options on install // Set and show default options on install
chrome.runtime.onInstalled.addListener(function (details) { chrome.runtime.onInstalled.addListener(function (details) {
if (details.reason == "install") { if (details.reason == "install") {
@ -159,10 +158,22 @@ chrome.webRequest.onBeforeRequest.addListener(function (details) {
if (!isSiteEnabled(details)) { if (!isSiteEnabled(details)) {
return; return;
} }
return { redirectUrl: details.url.replace(getParameterByName("mod", details.url), "rsswn") };
}, var param;
{urls:["*://*.wsj.com/*"]}, var updatedUrl;
["blocking"]
param = getParameterByName("mod", details.url);
if (param === null) {
updatedUrl = stripQueryStringAndHashFromPath(details.url);
updatedUrl += "?mod=rsswn";
} else {
updatedUrl = details.url.replace(param, "rsswn");
}
return { redirectUrl: updatedUrl};
},
{urls:["*://*.wsj.com/*"], types:["main_frame"]},
["blocking"]
); );
chrome.webRequest.onBeforeSendHeaders.addListener(function(details) { chrome.webRequest.onBeforeSendHeaders.addListener(function(details) {
@ -285,4 +296,8 @@ function getParameterByName(name, url) {
if (!results) return null; if (!results) return null;
if (!results[2]) return ''; if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' ')); return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
function stripQueryStringAndHashFromPath(url) {
return url.split("?")[0].split("#")[0];
} }

View File

@ -18,5 +18,5 @@
"page": "options.html" "page": "options.html"
}, },
"permissions": [ "cookies", "<all_urls>", "storage", "webRequest", "webRequestBlocking"], "permissions": [ "cookies", "<all_urls>", "storage", "webRequest", "webRequestBlocking"],
"version": "1.4.1" "version": "1.4.2"
} }