NB. This is a test script
A test script for GM_update library. The test script can be seen in action at example.com
GM_Update is a library that allows you to update your script from any site that support meta.js standard or the main USO alternatives: OpenUserJS, Greasy Fork and MonkeyGuts.
Example script GM_update Tester
NB: Supports for FireFox, Chrome and Opera. It may function on other browsers but not tested
(OUJS now supports Meta files)
You can access the script's update window through Greasemonkey's command menu.
The update window allows the user to set the check period in days or turn of the scripts updater.
Guide
You must add the following to the user script header:
// @grant GM_xmlhttpRequest
// @grant GM_info
// @grant GM_getMetadata
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM_registerMenuCommand
// @homeURL <url>
// @homeURL <url>
is the homepage of the user script. Example values:
// @homeURL https://greasyfork.org/scripts/4336-ts-citrus-gfork
// @homeURL https://openuserjs.org/scripts/TimidScript/%5BTS%5D_Citrus_GFork
// @homeURL https://monkeyguts.com/code.php?id=288
Currently it gets the latest version information from the scripts homepage, unless
the metaURL is provided. It is not recommended to use the @metaURL property if you are using GF, OUJS or MG.
@homeURL should not point to a user.js file. The reason for this is mainly for security reasons. There currently no checks on this, but later release may disallow direct linkage to user.js files.
It is highly recommended to use GF or OUJS site as they are maintained by the community and have checks and balances.
Optional header properties.
// @metaURL <url>
is the link to the meta.js file. As of writing, this feature is not supported in MonkeyGuts, however if provided it will use the meta.js file to extract the latest version information instead of the script-url. This allows other sites to be supported.
Example of meta files:
https://openuserjs.org/meta/TimidScript/[TS]OUJS-1.meta.js
https://greasyfork.org/scripts/4336-ts-citrus-gfork/code/[TS]Citrus_GFork.meta.js
// @changelog <list of changes in html>
Allows you to provide changelog in html format, that will be displayed on the update dialog. This can only be extracted from the meta.js file. Only allows the following tags: uo, ol, li, b, strong, i, div and br
. All node attributes, apart from "style", will be removed.
// @gm_update manual
This will allow you to disable auto-update and then functions need to be called from your script. This will give the author more control on updates
Screenshot