javascript - Including code from a URL into a Greasemonkey script to use it as the script? -
say have repository on github 3 files:
- mygreasemonekyscript.js
- readme.md
- license.md
mygreasemonekyscript.js
stores greasemonkey script:
// ==userscript== // @name facebook // @namespace nms // @include http://*.example.com/* // @include https://*.example.com/* // @version 1 // @grant none // ==/userscript== // rest of script...
is there way call greasemonkey local greasemonkey script file have inclusion (an include) of remote version sits in github?
note: reason i'd minimalism, instead having 2 version localy (the gm script file , backup in folder), center code editing in 1 place, without need copy changes between each files, each time anew.
i can see 4 options this:
1. install script github
you need tweak update interval.
all need enter raw view on github , greasemonkey ask install script. created example repository demonstrate this.
after script installed, go settings , set auto updating on
:
further reading: how user script updating work?
2. append <script>
tag
this pretty obvious solution unsuitable production security reasons. can append script tag document, linking script on github.
3. @require
command
this has flaw greasemonkey downloads @require
dependencies once, you'd need change (eg. ?random_number
) in url force refresh after updating script.
4. use refresher
i once made node.js script accepts path userscript files anywhere on filesystem. search paths in process.env.appdata+"\\mozilla\\firefox\\profiles\\ap7ptx7o.default\\gm_scripts"
(you might need alter path) , every time modify refference path (the 1 in github repo), copy userscripts folder.
Comments
Post a Comment