User Script Updates

By Richard Gibson Last update Dec 6, 2005 — Installed 260,778 times. Daily Installs: 137, 117, 150, 83, 111, 101, 137, 129, 119, 145, 119, 90, 112, 137, 130, 126, 131, 100, 102, 103, 129, 130, 111, 129, 98, 86, 112, 137, 151, 117, 128, 93
Script Summary:
Checks for updated versions of user scripts that request it, and notifies the user of their existence.
Version: 0.3
Recently Updated TopicsPosts
User Script Updates and Fir...1
Bug?1
Fix for it asking to update...3
0 uPDATES FOUND2

this script has 6 topics, 45 posts

Review Summary
5 stars
0 reviews (0)
4 stars
0 reviews (0)
3 stars
0 reviews (0)
2 stars
0 reviews (0)
1 star
1 reviews (1)

this script has 1 review

Description

Checks for updated versions of user scripts that request it, and notifies the user of their existence.

Screenshot

screenshot

How to use User Script Updates

User Script Updates works through script objects, which are JavaScript objects with the following required properties:

  • name: script name
  • namespace: script namespace
  • identifier: location of the script (.user.js)
  • version: script version, in "a.b.c..." format
  • date: date the script was last updated (JavaScript timestamp, i.e. (new Date()).getTime())

and the following optional properties:

  • description: script description
  • source: script homepage

Technically, only one of version and date is required, but including both makes version checking easier for me. If these properties seem familiar, that's good: name, namespace, and description are ==UserScript== metadata, and identifier, date, and source are defined in the Dublin Core.

Note that all data in the script object should be duplicated exactly in the ==UserScript== metadata, with date being an exception (it should be ISO yyyy-mm-dd format in the metadata and a timestamp in the object). If in doubt, refer to this user script for an example.

Once you have the script object, wait for the window to load and then pass it as the only argument to window.UserScriptUpdates.requestAutomaticUpdates, where window is the unwrapped/unsafe JavaScript-accessible window. User Script Updates will confirm that the user wants to check for automatic updates. Then, when you update your script, update the metadata and the script object, and place a copy of the new script at the URL pointed to by "identifier". User Script Updates will find it and inform the user. That's it! Again, refer to this user script if you are unsure of what to do.

Happy coding!

Changelog

* **0.3 (2006-06-20)**
** Improved: notification shows "above" framesets
* **0.2 (2005-12-07)**
** Fixed: removed testing code
* **0.1 (2005-12-07)**
** original release

Known Updating Scripts

At this time, the following scripts are known to update automatically: