@require Another Auto Updater Instructions

Written by sizzlemctwizzle — Last update Apr 27, 2013

34 points

The Basics

The number one goal of my @require updater is to keep things super simple and not much explanation is needed, but here are the basics. To @require my script place this in the header of your script:
// @require http://update.sizzlemctwizzle.com/your script id.js
That is all you need to make sure your users get notified when there is an update available. If @version isn't present in your metadata, the version number Userscripts.org assigns your script automatically every time you upload a new version will be used for update checking.

Extras

Some optional query values you can set:
  • days - obviously sets the number of days to wait between update checks.
    Example:
    • // @require http://update.sizzlemctwizzle.com/your script id.js?days=7
  • uso - a flag that forces the Userscripts.org version number to be used for update checking even when an @version value is present in your metadata.
    Example:
    • // @require http://update.sizzlemctwizzle.com/your script id.js?uso
  • meta - set this flag to a variable used to store wrapped metadata. Users of my old updater will be familiar with this method. It allows my updater to use the metadata present in your script rather than the metadata obtained from Userscripts.org at the time of install. You wrap your own script metadata using E4X like this:
    • var scr_meta=<><![CDATA[ // Make sure to copy this line right above the script metadata
      // ==UserScript==
      // @name           Another Auto Update Script
      // @namespace      sizzlemctwizzle
      // @description    Include the code in your user scripts so they check for updates automatically
      // @version        1.1.7
      // @include        *
      // ==/UserScript==
      ]]></>.toString(); // Make sure to copy this line right below
    The actual value is optional and scr_meta will be used by default.
    Example:
    • // @require http://update.sizzlemctwizzle.com/your script id.js?meta=name of metadata variable
    The disadvantage of using this method is that E4X is not compatible with other browsers and will prevent your script from running. I recommend against using this method for this reason.

  • show - a flag that sends a user to the script's description page when they are notified of an update to the script. The default behavior is a prompt to install the latest version.
    Example:
    • // @require http://update.sizzlemctwizzle.com/your script id.js?show
  • var - by default this value is set to your script id. It is used to provide a unique name for the variable name of your updater object and the name used to save the date of the last update check.
    Example:
    • // @require http://update.sizzlemctwizzle.com/your script id.js?var=some string

Hosting

Since sizzlemctwizzle.com runs on an old Pentium 4 in my basement (lighttpd + FastCGI + PHP5), you may want to host the updater yourself. The updater source is open and under public domain. If you're using lighttpd and want my rewrite rules, just ask.

Browser Compatibility

If you install a script with my updater in Google Chrome or GreaseKit, it should be ignored and not cause any errors. If you install my updater in either NinjaKit or Tampermonkey I can't assure you that it won't break your script. Both extensions have been banned from using my updater because they improperly implement @require which causes too much traffic.

Mirrors

If you'd like to be listed as a mirror, please PM me.