diff --git a/LICENSE b/LICENSE deleted file mode 100644 index d22cfb1..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Adam - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index a99fed8..22912bf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ -# Bypass Paywalls browser extension +

+ +

+ +

Bypass Paywalls

### Installation Instructions **Google Chrome** @@ -174,7 +178,4 @@ Usually premium articles cannot be bypassed as they are behind a hard paywall. * PRs are welcome. ### Show your support -* I am not asking for donations or anything like that, all I ask is that you star this repo. - -### License -Bypass Paywalls is [MIT-licensed](https://github.com/iamadamdev/bypass-paywalls-chrome/blob/master/LICENSE). +* I am not asking for donations or anything like that, all I ask is that you star this repo. \ No newline at end of file diff --git a/build.sh b/build.sh deleted file mode 100755 index a62b6f9..0000000 --- a/build.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -JS_FILES="background.js common.js contentScript.js options.js version.js" -HTML_FILES="options.html popup.html" -DOC_FILES="LICENSE README.md" -IMG_FILES="bypass.png" -GEN_FILES="$JS_FILES $HTML_FILES $DOC_FILES $IMG_FILES" -CH_FILES="$GEN_FILES manifest.json updates.xml" -FF_FILES="$GEN_FILES manifest-ff.json updates.json bypass-dark.png" - -NAME="bypass-paywalls" - -rm -f $NAME.crx $NAME.xpi - -# Chrome .crx extension package -7z a -tzip -mx9 $NAME.crx $CH_FILES -7z rn $NAME.crx manifest-ch.json manifest.json # doesn't exist yet; fails harmlessly - -# Firefox .xpi extension package (different manifest & update metadata) -7z a -tzip -mx9 $NAME.xpi $FF_FILES -7z rn $NAME.xpi manifest-ff.json manifest.json diff --git a/build/build.sh b/build/build.sh new file mode 100644 index 0000000..7449c26 --- /dev/null +++ b/build/build.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +JS_FILES="../src/js/common.js ../src/js/background.js ../src/js/sites.js ../src/js/contentScript.js ../src/js/options.js ../src/js/version.js" +DOC_FILES="../README.md" +IMG_FILES="../src/icons/bypass.png" + +# Strip subdirectories for Chrome manifest +sed 's/src\/.*\///g' ../manifest.json > temp-chrome-manifest.json + +# Strip subdirectories for Firefox manifest +sed 's/src\/.*\///g' ../manifest-ff.json > temp-ff-manifest.json + +# Strip subdirectories for options html file +sed 's/\.\.\/js\///g' ../src/html/options.html > temp-options.html + +# Strip subdirectories for popup html file +sed 's/\.\.\/js\///g' ../src/html/popup.html > temp-popup.html + +HTML_FILES="temp-options.html temp-popup.html" +GEN_FILES="$JS_FILES $HTML_FILES $DOC_FILES $IMG_FILES" +CH_FILES="$GEN_FILES temp-chrome-manifest.json ../src/updates/updates.xml" +FF_FILES="$GEN_FILES temp-ff-manifest.json ../src/updates/updates.json ../src/icons/bypass-dark.png" + +NAME="output/bypass-paywalls" + +# Remove existing files +rm -f $NAME.crx $NAME.xpi + +# Generate Chrome .crx extension package +7z a -tzip -mx9 $NAME.crx $CH_FILES +7z rn $NAME.crx temp-chrome-manifest.json manifest.json temp-options.html options.html temp-popup.html popup.html + +# Generate Firefox .xpi extension package (Firefox manifest) +7z a -tzip -mx9 $NAME.xpi $FF_FILES +7z rn $NAME.xpi temp-ff-manifest.json manifest.json temp-options.html options.html temp-popup.html popup.html + +# Remove temp files +echo "\nDeleting temp files..." +rm -v temp-chrome-manifest.json temp-ff-manifest.json temp-options.html temp-popup.html \ No newline at end of file diff --git a/bypass.svg b/legacy/bypass.svg similarity index 100% rename from bypass.svg rename to legacy/bypass.svg diff --git a/bypass_wsj_extension_screenshot.png b/legacy/bypass_wsj_extension_screenshot.png similarity index 100% rename from bypass_wsj_extension_screenshot.png rename to legacy/bypass_wsj_extension_screenshot.png diff --git a/changelog.txt b/legacy/changelog.txt similarity index 100% rename from changelog.txt rename to legacy/changelog.txt diff --git a/ft_screenshot.png b/legacy/ft_screenshot.png similarity index 100% rename from ft_screenshot.png rename to legacy/ft_screenshot.png diff --git a/manifest-ff.json b/manifest-ff.json index bd1c751..9398f94 100644 --- a/manifest-ff.json +++ b/manifest-ff.json @@ -1,8 +1,9 @@ { "background": { "scripts": [ - "common.js", - "background.js" + "src/js/common.js", + "src/js/sites.js", + "src/js/background.js" ] }, "content_scripts": [ @@ -50,7 +51,7 @@ "*://*.washingtonpost.com/*", "*://*.wsj.com/*" ], - "js": ["contentScript.js"] + "js": ["src/js/contentScript.js"] } ], "applications": { @@ -62,26 +63,26 @@ "browser_action": { "theme_icons": [ { - "light": "bypass-dark.png", - "dark": "bypass.png", + "light": "src/icons/bypass-dark.png", + "dark": "src/icons/bypass.png", "size": 128 } ], - "default_popup": "popup.html", + "default_popup": "src/html/popup.html", "default_icon": { - "128": "bypass.png" + "128": "src/icons/bypass.png" } }, "description": "Bypass News Sites' Paywalls", "homepage_url": "https://github.com/iamadamdev/bypass-paywalls-chrome/blob/master/README.md", "icons": { - "128": "bypass.png" + "128": "src/icon/bypass.png" }, "manifest_version": 2, "name": "Bypass Paywalls", "short_name": "Bypass Paywall", "options_ui": { - "page": "options.html" + "page": "src/html/options.html" }, "permissions": [ "cookies", diff --git a/manifest.json b/manifest.json index a581226..d786ec5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,21 +1,29 @@ { "background": { "scripts": [ - "common.js", - "background.js" + "src/js/common.js", + "src/js/sites.js", + "src/js/background.js" ] }, "content_security_policy": "script-src 'self' https://ssl.google-analytics.com; object-src 'self'", + "content_scripts": [ + { + "matches": [ + "" + ], + "js": ["src/js/contentScript.js"] + }], "browser_action": { - "default_popup": "popup.html", + "default_popup": "src/html/popup.html", "default_icon": { - "128": "bypass.png" + "128": "src/icons/bypass.png" } }, "description": "Bypass News Sites' Paywalls", "homepage_url": "https://github.com/iamadamdev/bypass-paywalls-chrome/blob/master/README.md", "icons": { - "128": "bypass.png" + "128": "src/icons/bypass.png" }, "manifest_version": 2, "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3PRmcRnHFZwHUlCgoTAdBjc9nUjmJo8l8kvkl/OZV6biZFAGUQGdxF1xoGhRccWA7qfQrZdPwcM1VQoVS/1F+87XiutKTe/HNsTAFvOcVS0tjCSH6DOHpewkMUBZujwTIeo7UXUVmCPQ1UbVd6m8KmHYtSHYlaX0uXRcguWhLmO5hASxw4onvAD0uql/t/ntxsIATwn4hVApg0VZhy0QAbMany8/5ByKPa19mCQwsIdRkcpG+PNHTLWPDgeGoDL7S0DxIduraRhTlrDX/zy5ETu6NWq6r+/jRzmXAjx+vSDCU5Ps2YG8QwdCL4Zl+CNVdQrnqz4X1zfPFJ1FFmUSpwIDAQAB", @@ -24,7 +32,7 @@ "short_name": "Bypass Paywall", "options_ui": { "chrome_style": true, - "page": "options.html" + "page": "src/html/options.html" }, "permissions": [ "cookies", diff --git a/options.html b/src/html/options.html similarity index 86% rename from options.html rename to src/html/options.html index 1ee904b..b224393 100644 --- a/options.html +++ b/src/html/options.html @@ -33,7 +33,8 @@

- - + + + diff --git a/popup.html b/src/html/popup.html similarity index 78% rename from popup.html rename to src/html/popup.html index add70f7..3bc4631 100644 --- a/popup.html +++ b/src/html/popup.html @@ -6,7 +6,7 @@
Bypass Paywalls by Adam
Options | GitHub |
- - + + diff --git a/bypass-dark.png b/src/icons/bypass-dark.png similarity index 100% rename from bypass-dark.png rename to src/icons/bypass-dark.png diff --git a/bypass.png b/src/icons/bypass.png similarity index 100% rename from bypass.png rename to src/icons/bypass.png diff --git a/background.js b/src/js/background.js similarity index 99% rename from background.js rename to src/js/background.js index dfcc374..f1e6c19 100644 --- a/background.js +++ b/src/js/background.js @@ -1,5 +1,3 @@ -/* Please respect alphabetical order when adding a site in any list */ - 'use strict'; const restrictions = { @@ -459,7 +457,7 @@ extension_api.webRequest.onCompleted.addListener(function(details) { urls: [""] }); -// Google Analytics to track DAU +// Google Analytics to track DAU (Chrome only) function init_GA() { var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-69824169-2']); diff --git a/src/js/common.js b/src/js/common.js new file mode 100644 index 0000000..19c0d2a --- /dev/null +++ b/src/js/common.js @@ -0,0 +1,8 @@ +const extension_api = + (typeof browser === 'object' && + typeof browser.runtime === 'object' && + typeof browser.runtime.getManifest === 'function') ? browser : + (typeof chrome === 'object' && + typeof chrome.runtime === 'object' && + typeof chrome.runtime.getManifest === 'function') ? chrome : + console.log('Cannot find extension_api under namespace "browser" or "chrome"'); \ No newline at end of file diff --git a/contentScript.js b/src/js/contentScript.js similarity index 100% rename from contentScript.js rename to src/js/contentScript.js diff --git a/options.js b/src/js/options.js similarity index 100% rename from options.js rename to src/js/options.js diff --git a/common.js b/src/js/sites.js similarity index 92% rename from common.js rename to src/js/sites.js index 80f150c..56bfff6 100644 --- a/common.js +++ b/src/js/sites.js @@ -1,12 +1,3 @@ -const extension_api = - (typeof browser === 'object' && - typeof browser.runtime === 'object' && - typeof browser.runtime.getManifest === 'function') ? browser : - (typeof chrome === 'object' && - typeof chrome.runtime === 'object' && - typeof chrome.runtime.getManifest === 'function') ? chrome : - console.log('Cannot find extension_api under namespace "browser" or "chrome"'); - // Cookies from this list are blocked by default const defaultSites = { 'Adweek': 'adweek.com', diff --git a/version.js b/src/js/version.js similarity index 100% rename from version.js rename to src/js/version.js diff --git a/updates.json b/src/updates/updates.json similarity index 100% rename from updates.json rename to src/updates/updates.json diff --git a/updates.xml b/src/updates/updates.xml similarity index 100% rename from updates.xml rename to src/updates/updates.xml