-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Userscript (Fixes #564) #565
base: master
Are you sure you want to change the base?
Conversation
General comment: please follow the dev guidelines: https://github.com/infokiller/web-search-navigator#coding-style |
src/browser_polyfill.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add this empty file?
OPTIONS_JS=$(cat "$PTH/options.js" | base64) | ||
BROWSER_POLYFILL_JS=$(cat "$PTH/userscript-polyfill.js" "$PTH/browser-polyfill.js" | base64) | ||
|
||
FINAL=$(echo "${USERSCRIPT_OPTIONS//__OPTIONS_HTML__/$OPTIONS_HTML}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to use echo
here and below
tools/make-userscript.sh
Outdated
@@ -0,0 +1,46 @@ | |||
mkdir -p build/userscript |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a proper shebang line (look at other files and follow their style)
@@ -0,0 +1,34 @@ | |||
globalThis.IS_USERSCRIPT = true; | |||
|
|||
globalThis._localStorage_browser_polyfill = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_browser_userscript_polyfill
and _localStorage_browser_polyfill
have inconsistent names (camel case mixed in, different order).
} | ||
|
||
save() { | ||
localStorage.setItem(STORAGE_KEY, JSON.stringify(this.values)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is localStorage
defined? Is it from the userscript manager?
@infokiller Appreciate your review - Working on implementing an options page, will use GM_setValue and GM_getValue in userscript environments, then I'll rewrite commit msgs. Might not get a chance for a few weeks though. |
@Explosion-Scratch no worries, and I also don't expect changes that will make it hard to merge your fork in the near future. |
Fixes #564