Includes : CheckForUpdate [DISCONTINUED]

By w35l3y Last update Mar 25, 2011 — Installed 75,844 times.

I didn't like the alert messages.

in
Subscribe to I didn't like the alert messages. 1 post, 1 voice

w35l3y Script's Author

The function CheckForUpdate.init() has a second parameter that receives a reference to a function with five parameters.
1 : Type of response - CheckForUpdate.CallbackResponse
2 : Update was called manually by User Scripts menu - Boolean
3 : Header of the current version - Object
4 : Header of the new version (if possible) - Object
5 : Content of the new version (if possible) - String

params 4 and 5 are possible when param 1 is Changed or Unchanged

You can create your own set of alert()s by doing something like:

CheckForUpdate.init(<>
// ...
</>, myOwnFunction);

function myOwnFunction(type, manual, oheader, nheader, ncontent)
{
	with (CheckForUpdate.CallbackResponse)
	switch (type)
	{
		case Error:
			if (manual)
				alert('An error has occurred');
			break;
		case ForcedWaiting:
			if (manual)
				alert('You should wait 2 minutes');
			break;
		case Unchanged:
			if (manual)
				alert('Script is unchanged');
			break;
		case Changed:
			alert('Script has changed' + CheckForUpdate.changelog(oheader, nheader, ncontent));
			break;
		case NoReminder:
		case Waiting:
			// no alerts
			break;
	}
}

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel