2007-11-11 23:59:29 +08:00
|
|
|
/*
|
|
|
|
* MooTools Extension script to support custom extensions to mootools
|
|
|
|
*/
|
2009-03-28 00:01:59 +08:00
|
|
|
var zmMooToolsVersion = '1.2.1';
|
2007-11-11 23:59:29 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Firstly, lets check that mootools has been included and thus is present
|
|
|
|
*/
|
|
|
|
if ( typeof(MooTools) == "undefined" )
|
|
|
|
{
|
|
|
|
alert( "MooTools not found! Please download from\nhttp://mootools.net and install in ZoneMinder web root." );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//console.log( "Got MooTools version "+MooTools.version );
|
|
|
|
|
|
|
|
/* Version check */
|
|
|
|
if ( MooTools.version < zmMooToolsVersion )
|
|
|
|
{
|
|
|
|
alert( "MooTools version "+MooTools.version+" found.\nVersion "+zmMooToolsVersion+" required, please upgrade." );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ajax class extenstion to allow for request timeouts
|
|
|
|
*/
|
2009-03-28 00:01:59 +08:00
|
|
|
Request = Request.extend({
|
2007-11-11 23:59:29 +08:00
|
|
|
request: function( data )
|
|
|
|
{
|
|
|
|
if ( this.options.timeout )
|
|
|
|
{
|
|
|
|
if ( this.timeoutTimer )
|
|
|
|
{
|
|
|
|
this.removeTimer();
|
|
|
|
}
|
|
|
|
this.timeoutTimer = window.setTimeout( this.callTimeout.bindAsEventListener(this), this.options.timeout );
|
|
|
|
this.addEvent( 'onComplete', this.removeTimer );
|
|
|
|
}
|
|
|
|
this.parent( data );
|
|
|
|
},
|
|
|
|
|
|
|
|
callTimeout: function ()
|
|
|
|
{
|
|
|
|
this.transport.abort();
|
|
|
|
this.onFailure();
|
|
|
|
if ( this.options.onTimeout )
|
|
|
|
{
|
|
|
|
this.options.onTimeout();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
removeTimer: function()
|
|
|
|
{
|
|
|
|
window.clearTimeout( this.timeoutTimer );
|
|
|
|
this.timeoutTimer = 0;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|