Script Summary: Code that is easy to include in your own and keeps your script updated. Fully customizable and doesn't require anything extra.
Version: 1
License: cc-by-sa
WARNING: This script is pretty awful and if you are looking to use it in your own code I recommend some other auto-update library.
This script isn't like those other auto-update scripts, that make you add something before the metadata block, or require you to host something external, or annoy your users with a pop up window, or anything like that.
The script is very simple to use: simply copy the code provided and add the @version and the optional @changes metadata keys. Then, change the Update.id to the ID of your script, Update.curVersion to the current version, and Update.callback is the function that will be called when the version declared in your script differs from the version that the script detects on the server.
Then, call Update.check() from anywhere in your code that is appropriate. If an update is detected, Update.callback() will get called and you can access the metadata block of the new script with the Update.keys object. Valid identifers for the object are anything parsed out of the metadata.
Update: With the advent of the @require metadata statement, you can simply add @require http://userscripts.org/scripts/source/45904.user.js and set Update.curVersion, Update.id, and Update.callback anywhere in your code. Call Update.check() whenever necessary. This should streamline the implementation of this library.



