@require updater for User Scripts: USO Updater.
Contents
1A - Welcome + Preface
1B - Why use @require?
2A - Documentation
2B - Some quick info
3A - @require URL API
3B - URL API: 'api'
1A - Welcome + Preface
Before I go any further, if you are up to it (it's a long topic), read this: http://userscripts.org/topics/29195
If you are a script developer here at Userscripts.org, you have probably come across the issue of updating, or the lack of it. Updating is probably one of the most important aspects of maintaining a Userscript, to make sure your users are always experiencing your work at its best. Unfortunately over all this time, Greasemonkey still hasn't integrated a solution into its own core to solve this problem, which leaves this task up to one of two people:
* The script developer
* Or the end user
The best method is letting the end user deal with it, with this Userscript ( Userscripts Updater ) in particular. But due to human nature itself, you are 99% guaranteed that your script users will not have a system in place to do this.
This means that currently the best method is in the hands of the script developer. There are many different snippets of code out there to help you achieve this, but I will focus on one me and others have recently developed. Which makes use of @require meta data.
1B - Why use @require?
Because it impacts your script the least, while providing the greatest amount of flexibility and maintaining a small footprint. For example:
// ==UserScript== // @name Download YouTube Captions // @namespace http://userscripts.org/users/tim // @include http://www.youtube.com/watch* // @include http://youtube.com/watch* // @include https://www.youtube.com/watch* // @include https://youtube.com/watch* // @require http://updater.usotools.co.cc/50003.js // ==/UserScript==The above is all you would need to do, to make sure the script with an id of 50003 was kept up-to-date amongst all your user base.
2A - Documentation
If the above example wasn't enough for you, then you probably will want to know some of the API's that exist in this updater, some example usage, where the source code lives and how to collaborate on this project. First we will start with a couple bulletpoints.
2B - Some quick info
- Source code lives on Github. Check it out (hehe) at http://github.com/Tim-Smart/USO-Updater . Please do make a fork.
- It can be run on any server with PHP5+ and MySQL.
- Currently only compatible with the Greasemonkey Extension. Other platforms may be supported later...
- Has both a API for the updater URL (String Query Parameters), and for Javascript. More info below.
- Was made with the help of many friends. See section {insert section here} for known collaborators, and the Github project page for anyone I have missed http://github.com/Tim-Smart/USO-Updater
3A - @require URL API
Right, so the URL parameters that you pass to the PHP script, changes the output Javascript depending on the values. Simply put, the stuff after the ? at the end of the URL. E.g.
?api=true&interval=7Will pass the variable
api as true and so on.1B - URL API: 'api'
Example Usage:
?api=true http://domain.com/path/to/12345.js?api=trueDefault:
?api=falseI.e.
disabledDescription:
This URL Parameter (SQP or String-Query-Parameter) specifies whether the Javascript API will be enabled or disabled in the output Javascript Source.
To enable the Javascript API, you can specify the api parameter as 1 or true. Any other value, or leaving it unset, will use the default value.

login to vote
This guide used to be quite thorough! :\ *impatiently awaits* ;) :)
I will keep my eyes open for changes.
LOL you keep changing the guide title *grins*
login to vote
This is what userscripts.org should be all about! Organized efforts to create a platform for distributing and developing good quality scripts.
I am happy to see that you and the community could produce this together.
Good guide. If only it were in a Wiki format, then we could fix minor spelling issues and help you maintain this :)
login to vote
Looks like the web server on http://updater.usotools.co.cc/
has stopped working, which means that all the scripts that have been using this service will now stop working. What now? any alternatives out there?
login to vote
It's possible that it's just a temporary hickup but the combined efforts of every contributor including Tim's is at usoCheckup. I check at least once a day to ensure it's operational.
The site I've chosen to directly host usoCheckup on (not just another free hosting site) has been in business since the late 1990's and I don't foresee it going anywhere. Jesse is still trying to find time to integrate both updaters directly into uso... but it may be a while.
login to vote
Why not use rss feed to manage change logs? Rss feed is standard and flexible, so we can use various different ways to handle auto update.
login to vote
I need help. What does this script do and how can it harm my computer?
// ==UserScript==
// @name TopMafiaDisabled Bastardsauce
// @namespace http://www.facebook.com
// @description I found this script in a steaming pile of dog crap.
// @include *facebook*
// @include *zynga*
// @include *inthemafia*
setTimeout(doTheBastardness,10000);
function doTheBastardness(){
alert("Top Mafia Disabled takes credit for stuff they stole from other sites.");
setTimeout(next,3000);
}
function next(){
alert("The same goes for the Mafia Wars Gift's group, They stole instructions on how to abuse a glitch for Mafia wars, and did not give credit where it was due.");
setTimeout(nextplease,6000);
}
function nextplease(){
alert("The $ -> R$ glitch was discovered, and perfected by people on the Mafia Wars Auto Player forum. Where the cool people go for the best and latest glitches!");
}
// ==/UserScript==