Replace deprecated jQuery.throttle/debounce

This requires MediaWiki 1.38 for mw.util.throttle.

Bug: T213426
Change-Id: I3f689eea837ef72de9ab7afb68578093eab8db20
This commit is contained in:
Sébastien Beyou 2021-04-27 20:30:33 +02:00
parent 9f65108e8d
commit a10359e6e6
5 changed files with 8 additions and 9 deletions

View file

@ -28,7 +28,7 @@
"license-name": "GPL-2.0-or-later",
"type": "other",
"requires": {
"MediaWiki": ">= 1.35.0"
"MediaWiki": ">= 1.38.0"
},
"MessagesDirs": {
"MultimediaViewer": [
@ -106,7 +106,6 @@
"oojs",
"oojs-router",
"jquery.fullscreen",
"jquery.throttle-debounce",
"jquery.color",
"jquery.tipsy",
"mmv.bootstrap",

View file

@ -189,9 +189,9 @@
this.handleEvent( 'keydown', function ( e ) { ui.keydown( e ); } );
// mousemove generates a ton of events, which is why we throttle it
this.handleEvent( 'mousemove.lip', $.throttle( 250, function ( e ) {
this.handleEvent( 'mousemove.lip', mw.util.throttle( function ( e ) {
ui.mousemove( e );
} ) );
}, 250 ) );
this.handleEvent( 'mmv-faded-out', function ( e ) { ui.fadedOut( e ); } );
this.handleEvent( 'mmv-fade-stopped', function ( e ) { ui.fadeStopped( e ); } );

View file

@ -231,9 +231,9 @@
C.attach = function () {
var canvas = this;
$( window ).on( 'resize.mmv-canvas', $.debounce( 100, function () {
$( window ).on( 'resize.mmv-canvas', mw.util.debounce( function () {
canvas.$mainWrapper.trigger( $.Event( 'mmv-resize-end' ) );
} ) );
}, 100 ) );
this.$imageWrapper.on( 'click.mmv-canvas', function () {
if ( canvas.$container.closest( '.metadata-panel-is-open' ).length > 0 ) {

View file

@ -67,9 +67,9 @@
panel.keydown( e );
} );
$( window ).on( 'scroll.mmvp', $.throttle( 250, function () {
$( window ).on( 'scroll.mmvp', mw.util.throttle( function () {
panel.scroll();
} ) );
}, 250 ) );
this.$container.on( 'mmv-metadata-open', function () {
if ( !panel.hasOpenedMetadata && panel.localStorage.store ) {

View file

@ -106,7 +106,7 @@
};
TTFP.attach = function () {
$( window ).on( 'resize.mmv-ttf', $.debounce( 100, this.repaint.bind( this ) ) );
$( window ).on( 'resize.mmv-ttf', mw.util.debounce( this.repaint.bind( this ), 100 ) );
};
TTFP.unattach = function () {