Fix loading of contentScript

This commit is contained in:
Adam
2020-04-26 22:45:19 -07:00
parent 08f2db9ec5
commit 939beeb0f0
4 changed files with 14 additions and 14 deletions

View File

@ -185,8 +185,12 @@ Usually premium articles cannot be bypassed as they are behind a hard paywall.
* If a site is having problems try unchecking "\*General Paywall Bypass\*" in Options.
* If none of these work, you can submit an issue [here](https://github.com/iamadamdev/bypass-paywalls-chrome/issues/new/choose).
### Pull Requests
* PRs are welcome.
### Contributing - Pull Requests
PRs are welcome.
1. If making a PR to add a new site, confirm your changes actually bypass the paywall.
2. At a minimum these files need to be updated: `README.md`, `manifest-ff.json`, `src/js/sites.js`, and possibly `src/js/background.js`, and/or `src/js/contentScript.js`.
3. Follow existing code-style and use camelCase.
4. Use [JavaScript Semi-Standard Style linter](https://github.com/standard/semistandard). Don't need to follow it exactly. There will be some errors (e.g., do not use it on `sites.js`).
### Show your support
* I am not asking for donations or anything like that, all I ask is that you star this repo.

View File

@ -1,6 +1,5 @@
#!/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"
@ -10,6 +9,9 @@ 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 background.js
sed 's/src\/.*\///g' ../src/js/background.js > temp-background.js
# Strip subdirectories for options html file
sed 's/\.\.\/js\///g' ../src/html/options.html > temp-options.html
@ -17,6 +19,7 @@ sed 's/\.\.\/js\///g' ../src/html/options.html > temp-options.html
sed 's/\.\.\/js\///g' ../src/html/popup.html > temp-popup.html
HTML_FILES="temp-options.html temp-popup.html"
JS_FILES="../src/js/common.js ../src/js/sites.js ../src/js/contentScript.js ../src/js/options.js ../src/js/version.js temp-background.js"
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"
@ -28,12 +31,12 @@ 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
7z rn $NAME.crx temp-chrome-manifest.json manifest.json temp-background.js background.js 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
7z rn $NAME.xpi temp-ff-manifest.json manifest.json temp-background.js background.js 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
rm -v temp-chrome-manifest.json temp-ff-manifest.json temp-background.js temp-options.html temp-popup.html

View File

@ -7,13 +7,6 @@
]
},
"content_security_policy": "script-src 'self' https://www.google-analytics.com; object-src 'self'",
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": ["src/js/contentScript.js"]
}],
"browser_action": {
"default_popup": "src/html/popup.html",
"default_icon": {

View File

@ -382,7 +382,7 @@ extensionApi.webRequest.onBeforeSendHeaders.addListener(function (details) {
if (tabId !== -1) {
// run contentScript inside tab
extensionApi.tabs.executeScript(tabId, {
file: 'contentScript.js',
file: 'src/js/contentScript.js',
runAt: 'document_start'
}, function (res) {
if (extensionApi.runtime.lastError || res[0]) {