Script Summary: Code to add to any Greasemonkey script to let it check for updates.
DescriptionThis is a tool for Greasemonkey script writers. If you don't write scripts, don't bother installing it.
This paste-in code snippet will check for new versions of an installed script and prompt the user to update.
Notes (also in the source code):
- Feel free to copy this into any script you write; that's what it's here for. A credit and/or URL back to here would be appreciated, though.
- I was careful to use as few variables as I could so it would be easy to paste right into an existing script. All the ones you need to set are at the very top.
- The target script needs to be uploaded to userscripts.org. The update checks will not increase the install count for the script there.
- This script is set up to check for updates to itself by default. It may be a good idea to leave it like this.
Scripts Using Update CheckerLeave a comment if you'd like to be listed here.
- Everything I've written
- lazygirls.info by nick_name
- Facebook Fixer by Vaughan Chandler
- BattleKnight Autologin by Astaroth
- [04/29/09]: Several major upgrades: now uses the meta.js file to automatically get version from US.o, so no more manually entering version timestamps. Added a try..catch block around the entire script because Opera's userscript functionality lacks GM_ functions, so it was breaking entire scripts in Opera. Made a few other minor tweaks to the code.
- [02/16/08]: A recent change to userscripts.org made update checks count as installs, so the script now checks for updates through the "View Script Source" page instead of the actual .user.js file. Script now brings the user to the script's information page instead of straight to the source file. You no longer need to paste in the entire URL to the script, only the script's ID number. Added menu option to check for updates manually (thanks, ngattuso!).
- [01/16/08]: Changed the window.open() to GM_openInTab() to avoid popup blockers. Thanks, BlindWanderer!
- [01/15/08]: Added a compacted version of the script (it's down there at the bottom, commented out).