Consistently use setTimeout, clearTimeout and location without window
Change-Id: Ie83313b3f2a7f9bc939eb19d7a82bc980f12b0b8
This commit is contained in:
@@ -98,7 +98,7 @@
|
|||||||
mw.hook( 'mw.uls.interface.language.change' ).fire( language, deferred );
|
mw.hook( 'mw.uls.interface.language.change' ).fire( language, deferred );
|
||||||
|
|
||||||
// Delay is zero if event logging is not enabled
|
// Delay is zero if event logging is not enabled
|
||||||
window.setTimeout( function () {
|
setTimeout( function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}, mw.config.get( 'wgULSEventLogging' ) * 500 );
|
}, mw.config.get( 'wgULSEventLogging' ) * 500 );
|
||||||
|
|
||||||
|
|||||||
@@ -197,13 +197,13 @@
|
|||||||
// if event logging is enabled, in can resole the promise
|
// if event logging is enabled, in can resole the promise
|
||||||
// immediately to avoid extra delays.
|
// immediately to avoid extra delays.
|
||||||
deferred.done( function () {
|
deferred.done( function () {
|
||||||
window.location.href = event.target.href;
|
location.href = event.target.href;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
mw.hook( 'mw.uls.login.click' ).fire( deferred );
|
mw.hook( 'mw.uls.login.click' ).fire( deferred );
|
||||||
|
|
||||||
// Delay is zero if event logging is not enabled
|
// Delay is zero if event logging is not enabled
|
||||||
window.setTimeout( function () {
|
setTimeout( function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}, mw.config.get( 'wgULSEventLogging' ) * 500 );
|
}, mw.config.get( 'wgULSEventLogging' ) * 500 );
|
||||||
} );
|
} );
|
||||||
|
|||||||
@@ -140,15 +140,15 @@
|
|||||||
|
|
||||||
// if the mouse is over the tooltip, do not hide
|
// if the mouse is over the tooltip, do not hide
|
||||||
$( '.uls-tipsy' ).on( 'mouseover', function () {
|
$( '.uls-tipsy' ).on( 'mouseover', function () {
|
||||||
window.clearTimeout( tipsyTimer );
|
clearTimeout( tipsyTimer );
|
||||||
} ).on( 'mouseout', function () {
|
} ).on( 'mouseout', function () {
|
||||||
tipsyTimer = window.setTimeout( hideTipsy, timeout );
|
tipsyTimer = setTimeout( hideTipsy, timeout );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// hide the tooltip when clicked on it
|
// hide the tooltip when clicked on it
|
||||||
$( '.uls-tipsy' ).on( 'click', hideTipsy );
|
$( '.uls-tipsy' ).on( 'click', hideTipsy );
|
||||||
|
|
||||||
tipsyTimer = window.setTimeout( hideTipsy, timeout );
|
tipsyTimer = setTimeout( hideTipsy, timeout );
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove any existing popups
|
// remove any existing popups
|
||||||
@@ -201,7 +201,7 @@
|
|||||||
mw.hook( 'mw.uls.language.revert' ).fire( deferred );
|
mw.hook( 'mw.uls.language.revert' ).fire( deferred );
|
||||||
|
|
||||||
// Delay is zero if event logging is not enabled
|
// Delay is zero if event logging is not enabled
|
||||||
window.setTimeout( function () {
|
setTimeout( function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}, mw.config.get( 'wgULSEventLogging' ) * 500 );
|
}, mw.config.get( 'wgULSEventLogging' ) * 500 );
|
||||||
} );
|
} );
|
||||||
@@ -221,7 +221,7 @@
|
|||||||
ulsPopup.$element.appendTo( 'body' );
|
ulsPopup.$element.appendTo( 'body' );
|
||||||
|
|
||||||
// The interlanguage position needs some time to settle down
|
// The interlanguage position needs some time to settle down
|
||||||
window.setTimeout( function () {
|
setTimeout( function () {
|
||||||
// Show the tipsy tooltip on page load.
|
// Show the tipsy tooltip on page load.
|
||||||
showTipsy( 6000 );
|
showTipsy( 6000 );
|
||||||
}, 700 );
|
}, 700 );
|
||||||
@@ -375,7 +375,7 @@
|
|||||||
|
|
||||||
// Allow styles to apply first and position to work by
|
// Allow styles to apply first and position to work by
|
||||||
// delaying the activation after them.
|
// delaying the activation after them.
|
||||||
window.setTimeout( function () {
|
setTimeout( function () {
|
||||||
$ulsTrigger.trigger( 'click', eventParams );
|
$ulsTrigger.trigger( 'click', eventParams );
|
||||||
}, 0 );
|
}, 0 );
|
||||||
} );
|
} );
|
||||||
|
|||||||
Reference in New Issue
Block a user