Reputation: 351
Say I have a repository on GitHub with 3 files:
myGreasemonekyScript.js
stores a Greasemonkey script:
// ==UserScript==
// @name facebook
// @namespace nms
// @include http://*.example.com/*
// @include https://*.example.com/*
// @version 1
// @grant none
// ==/UserScript==
// The rest of the script...
Is there a way just to call it from Greasemonkey so that the local Greasemonkey script file will have only an inclusion (an include) of the remote version that sits in GitHub?
Note: The reason I'd like to do that is minimalism, instead having two version localy (the GM script file and a backup in another folder), I would like to center the code editing in one place, without the need to copy changes between each files, each time anew.
Upvotes: 1
Views: 1652
Reputation: 53139
I can see four options to do this:
You will need to tweak the update interval.
All you need to do is to enter Raw view on github and greasemonkey will ask you to install the script. I created an example repository to demonstrate this.
After the script is installed, go into settings and set the auto updating to On
:
Further reading: How does user script updating work?
<script>
tagThis is pretty obvious solution but unsuitable for production for security reasons. You can just append script tag to the document, linking your script on github.
@require
commandThis has the flaw that Greasemonkey downloads @require
dependencies only once, so you'd need to change something (eg. ?random_number
) in URL to force refresh after updating the script.
I once made Node.js script that accepts path to userscript files anywhere on filesystem. It will then search those paths in process.env.appdata+"\\Mozilla\\Firefox\\Profiles\\ap7ptx7o.default\\gm_scripts"
(you might need to alter this path) and every time you modify the refference path (the one in your GitHub repo), it will copy it to your userscripts folder.
Upvotes: 1