Since 2003, the online home of Jordon Kalilich, software engineer in Seattle, Washington, USA.
As of December 20, 2009, this script is deprecated as I am moving my scripts to usoCheckup. This script may be removed at any time. The following documentation remains for current users.
This page contains information for developers on using my update notifier for Greasemonkey user scripts. It's a JavaScript function that you can reference from your own scripts. With a small amount of work on your part, it can inform the users of your scripts of updates almost immediately.
This document refers to version 14 of the Update Notifier, unleashed to the world on October 12, 2009. It is released under the GNU GPL (version 3 or later), and as such, it comes with no warranty. Some of my older scripts contain earlier versions of the Update Notifier. They are forward-compatible with later versions. However, I recommend using the latest release, which can be found here.
Why not choose another update notifier? Because with this one, you can
The Update Notifier is a JavaScript function that is referenced a Greasemonkey user script. When the Update Notifier is run, it checks to see whether a certain interval has elapsed since it last checked for updates. If the interval has elapsed, it loads a text file hosted on a remote server. The text file either gives the latest version number of the script or says that the script will no longer be updated.
If it gives a version number that is higher than the version that the user is running, the Update Notifier will display a message at the top of the current web page:

The first option is a link to the script's home page, where the user can review changes and, if desired, upgrade. The second option sets the Update Notifier not to notify the user of updates until the next version is released. The third option sets the Update Notifier never to check for updates. The third option simply closes the notification box; if the second or third options haven't been chosen, it will be displayed again after the specified interval has elapsed.
If the text file indicates that the script will no longer be updated, the Update Notifier will stop checking for updates. It may either do this quietly or display a message with a link where users can find more information:

To use the Update Notifier in your own script, your script must be licensed under the GNU GPL, version 3 or later.
You will need access to a web server that can host text files. Prevent the caching of them for too long if you can. I use the following .htaccess rule, but I'm not sure how well it helps. In any case, the amount of traffic the server will receive from this script is (probably) negligible.
<FilesMatch "\.txt$">
Header set Cache-Control "max-age=3500, must-revalidate"
</FilesMatch>
Add the following single line to your script's metadata block:
// @require http://www.theworldofstuff.com/greasemonkey/updatenotifier.js
Within the code, include the following function:
updateNotifier(scriptName, scriptURL, scriptVersion, updateURL, updateInterval);
For information on the function's arguments, see "Parameters" below.
The Update Notifier function uses five parameters that can be unique for each script:
scriptNamescriptURLscriptVersionscriptVersion must be numerically greater than the last. (I may change this in the future, but it would break forward-compatibility.)updateURLupdateIntervalThe following examples represent options available for the text file. There are no spaces before, between, or after anything.
0.2scriptURL as given in the script.0.2;http://www.example.com/newscripturl.htmlscriptURL to the URL given. (Include the new URL in the text file for as long as possible to ensure that users who are slow to upgrade will eventually be able to do so.)--;http://www.example.com/explanation.htmlIn having scripts "phone home" periodically, I have tried to minimize the privacy issues involved. The GM_xmlhttprequest for the text file sends only two headers, which indicate that the user agent is Greasemonkey and that plaintext responses should be accepted. No information about what pages users visit or the contents of those pages is transmitted. The only information you could get this way are IP addresses, which are good for very little except to say "Someone in country X ran this script Y times today." In case a user objects even to this, he or she can stop the Update Notifier from contacting the remote server by clicking "Turn off these notifications" when being told of an update, by toggling checkForUpdates to false in about:config, or by simply removing the updateNotifier function call in the script.
If you have any other questions about using the Update Notifier, contact me.
Last updated September 27, 2009
Created May 7, 2008
Subscribe now, get an e-mail for every new post. No spam, I promise.
“It's a beautiful day, and Kate is here!” (5 days ago)
Subscribe in your favorite reader.
This page consists of valid XHTML + RDFa with valid CSS 3.