mirror of
https://github.com/iamadamdev/bypass-paywalls-chrome
synced 2025-06-13 11:57:39 +02:00
Fix loading of contentScript
This commit is contained in:
@ -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 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).
|
* If none of these work, you can submit an issue [here](https://github.com/iamadamdev/bypass-paywalls-chrome/issues/new/choose).
|
||||||
|
|
||||||
### Pull Requests
|
### Contributing - Pull Requests
|
||||||
* PRs are welcome.
|
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
|
### Show your support
|
||||||
* I am not asking for donations or anything like that, all I ask is that you star this repo.
|
* I am not asking for donations or anything like that, all I ask is that you star this repo.
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/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"
|
DOC_FILES="../README.md"
|
||||||
IMG_FILES="../src/icons/bypass.png"
|
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
|
# Strip subdirectories for Firefox manifest
|
||||||
sed 's/src\/.*\///g' ../manifest-ff.json > temp-ff-manifest.json
|
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
|
# Strip subdirectories for options html file
|
||||||
sed 's/\.\.\/js\///g' ../src/html/options.html > temp-options.html
|
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
|
sed 's/\.\.\/js\///g' ../src/html/popup.html > temp-popup.html
|
||||||
|
|
||||||
HTML_FILES="temp-options.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"
|
GEN_FILES="$JS_FILES $HTML_FILES $DOC_FILES $IMG_FILES"
|
||||||
CH_FILES="$GEN_FILES temp-chrome-manifest.json ../src/updates/updates.xml"
|
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"
|
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
|
# Generate Chrome .crx extension package
|
||||||
7z a -tzip -mx9 $NAME.crx $CH_FILES
|
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)
|
# Generate Firefox .xpi extension package (Firefox manifest)
|
||||||
7z a -tzip -mx9 $NAME.xpi $FF_FILES
|
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
|
# Remove temp files
|
||||||
echo "\nDeleting 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
|
@ -7,13 +7,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"content_security_policy": "script-src 'self' https://www.google-analytics.com; object-src 'self'",
|
"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": {
|
"browser_action": {
|
||||||
"default_popup": "src/html/popup.html",
|
"default_popup": "src/html/popup.html",
|
||||||
"default_icon": {
|
"default_icon": {
|
||||||
|
@ -382,7 +382,7 @@ extensionApi.webRequest.onBeforeSendHeaders.addListener(function (details) {
|
|||||||
if (tabId !== -1) {
|
if (tabId !== -1) {
|
||||||
// run contentScript inside tab
|
// run contentScript inside tab
|
||||||
extensionApi.tabs.executeScript(tabId, {
|
extensionApi.tabs.executeScript(tabId, {
|
||||||
file: 'contentScript.js',
|
file: 'src/js/contentScript.js',
|
||||||
runAt: 'document_start'
|
runAt: 'document_start'
|
||||||
}, function (res) {
|
}, function (res) {
|
||||||
if (extensionApi.runtime.lastError || res[0]) {
|
if (extensionApi.runtime.lastError || res[0]) {
|
||||||
|
Reference in New Issue
Block a user