Skip to content

Commit

Permalink
full updates for 0.19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rushilsrivastava committed Feb 9, 2019
1 parent e5a0e25 commit 54ab9e3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 50 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ I made this because as a student, it isn't practical for me to pay each company
5. Enjoy!
6. The extension should automagically update, but you can also manually update by clicking the `Update` button on the Extensions page `chrome://extensions`.

### Broken integrations
* [Wall Street Journal](https://www.wsj.com/)

### Supported Tested Websites:
* [Wall Street Journal](https://www.wsj.com/)
* [New York Times](https://www.nytimes.com/)
* [Cooking New York Times](https://cooking.nytimes.com/)
* [Financial Times](https://www.ft.com/)
Expand Down
5 changes: 2 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "News Paywall Blocker by OpenNews",
"version": "0.19.1",
"version": "0.19.2",
"manifest_version": 2,
"description": "Experience a brand new FREE browsing experience bypassing pesky cookie Paywalls!",
"author": "Rushil Srivastava",
Expand Down Expand Up @@ -29,7 +29,6 @@
{
"matches": ["https://www.ft.com/*"],
"css": ["src/css/ft.css"],
"js": ["src/js/arrive.min.js", "src/js/ft.js"],
"run_at": "document_start"
},
{
Expand All @@ -39,7 +38,7 @@
},
{
"matches": ["https://www.wsj.com/*"],
"js": ["src/js/arrive.min.js", "src/js/wsj.js"],
"js": ["src/js/wsj.js"],
"run_at": "document_start"
}
],
Expand Down
2 changes: 1 addition & 1 deletion src/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ var cookieBasedURLs = Object.values(sites)
})
.map(site => site.url);

// add firefox and edge support with the global `browser` object
// add firefox and edge support with the global `browser` object #5
browser = typeof browser !== "undefined" ? browser : chrome;

// script blocking
Expand Down
15 changes: 0 additions & 15 deletions src/js/ft.js

This file was deleted.

41 changes: 13 additions & 28 deletions src/js/wsj.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
console.log("Disabling Paywall on WSJ.com");
// edit meta data
document.arrive('meta[name="cx_shield"]', function() {
this.setAttribute("content", "{\"campaign\":2000,\"placement\":\"cx-articlecover\", \"tag\":\"default\", \"type\":\"free\"}");
});
// make free article in first meta JSON
document.arrive('script[type="application/ld+json"]', function() {
let data = JSON.parse(this.innerHTML);
data["isAccessibleForFree"] = "true";
data["hasPart"]["isAccessibleForFree"] = "true";
this.innerHTML = JSON.stringify(data);
});
// make free article in second meta JSON
document.arrive('#article_body > script[type="text/javascript"]', function() {
let script = this.innerHTML;
if (script.includes("var utag_data =")) {
console.log("found")
let data = JSON.parse(script.replace("var utag_data =", '').replace(/ /g, '').replace(/;/g, ''))
data["page_access"] = "free";
data["cx_shield"] = {
"campaign": 2000,
"placement": "cx-articlecover",
"tag": "default",
"type": "free"
};
this.innerHTML = "var utag_data = " + JSON.stringify(data) + ";";
}
});
var url = window.location.href;
var redirect = true;

if (url.indexOf('?mod=rsswn') != -1)
redirect = false;
else if (url.indexOf('&mod=rsswn') != -1)
redirect = false;

// redirect
if (redirect) {
console.log("Disabling Paywall on " + window.location.pathname);
window.location = '//' + location.host + location.pathname + '?mod=rsswn';
}

0 comments on commit 54ab9e3

Please sign in to comment.