From: Timo Tijhof Date: Thu, 5 Sep 2019 21:14:16 +0000 (+0100) Subject: mediawiki.htmlform.checker: Remove use of deprecated jquery.throttle-debounce X-Git-Tag: 1.34.0-rc.0~366^2 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=4b7e22a01251110dbf934edc2edae0a122ff5c0e;p=lhc%2Fweb%2Fwiklou.git mediawiki.htmlform.checker: Remove use of deprecated jquery.throttle-debounce Bug: T213426 Change-Id: I21874161dbe258c56376f3761e523dac543db8f4 --- diff --git a/resources/Resources.php b/resources/Resources.php index 8234e8970c..9dc99ff55c 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -942,9 +942,6 @@ return [ 'scripts' => [ 'resources/src/mediawiki.htmlform.checker.js', ], - 'dependencies' => [ - 'jquery.throttle-debounce', - ], 'targets' => [ 'desktop', 'mobile' ], ], 'mediawiki.htmlform.ooui' => [ diff --git a/resources/src/mediawiki.htmlform.checker.js b/resources/src/mediawiki.htmlform.checker.js index 674584b14a..33207d49a7 100644 --- a/resources/src/mediawiki.htmlform.checker.js +++ b/resources/src/mediawiki.htmlform.checker.js @@ -3,6 +3,14 @@ // FIXME: mw.htmlform.Element also sets this to empty object mw.htmlform = {}; + function debounce( delay, callback ) { + var timeout; + return function () { + clearTimeout( timeout ); + timeout = setTimeout( Function.prototype.apply.bind( callback, this, arguments ), delay ); + }; + } + /** * @class mw.htmlform.Checker */ @@ -52,7 +60,7 @@ if ( $extraElements ) { $e = $e.add( $extraElements ); } - $e.on( events, $.debounce( 1000, this.validate.bind( this ) ) ); + $e.on( events, debounce( 1000, this.validate.bind( this ) ) ); return this; };