Replace jQuery.proxy() with Function.prototype.bind()
Also, one immediate invocation of jQuery.proxy() is replaced by Function.prototype.call() Change-Id: Ibbdbe6413793c113d4de1c67cfcb7d95676565b2
This commit is contained in:
committed by
jenkins-bot
parent
c300951890
commit
9c0c918bab
@@ -295,7 +295,7 @@
|
||||
// Show common languages
|
||||
quickList: self.getCommonLanguages( languages ),
|
||||
noResultsTemplate: function () {
|
||||
var $defaultTemplate = $.proxy( $.fn.lcd.defaults.noResultsTemplate, this )();
|
||||
var $defaultTemplate = $.fn.lcd.defaults.noResultsTemplate.call( this );
|
||||
// Customize the message
|
||||
$defaultTemplate
|
||||
.find( '.uls-no-results-found-title' )
|
||||
|
||||
@@ -76,21 +76,21 @@
|
||||
*/
|
||||
listen: function () {
|
||||
// Register handlers for event logging triggers
|
||||
mw.hook( 'mw.uls.settings.open' ).add( $.proxy( this.ulsSettingsOpen, this ) );
|
||||
mw.hook( 'mw.uls.language.revert' ).add( $.proxy( this.ulsLanguageRevert, this ) );
|
||||
mw.hook( 'mw.uls.ime.enable' ).add( $.proxy( this.enableIME, this ) );
|
||||
mw.hook( 'mw.uls.ime.disable' ).add( $.proxy( this.disableIME, this ) );
|
||||
mw.hook( 'mw.uls.ime.change' ).add( $.proxy( this.changeIME, this ) );
|
||||
mw.hook( 'mw.uls.login.click' ).add( $.proxy( this.loginClick, this ) );
|
||||
mw.hook( 'mw.uls.ime.morelanguages' ).add( $.proxy( this.imeMoreLanguages, this ) );
|
||||
mw.hook( 'mw.uls.interface.morelanguages' ).add( $.proxy( this.interfaceMoreLanguages, this ) );
|
||||
mw.hook( 'mw.uls.interface.language.change' ).add( $.proxy( this.interfaceLanguageChange, this ) );
|
||||
mw.hook( 'mw.uls.font.change' ).add( $.proxy( this.fontChange, this ) );
|
||||
mw.hook( 'mw.uls.webfonts.enable' ).add( $.proxy( this.enableWebfonts, this ) );
|
||||
mw.hook( 'mw.uls.webfonts.disable' ).add( $.proxy( this.disableWebfonts, this ) );
|
||||
mw.hook( 'mw.uls.settings.open' ).add( this.ulsSettingsOpen.bind( this ) );
|
||||
mw.hook( 'mw.uls.language.revert' ).add( this.ulsLanguageRevert.bind( this ) );
|
||||
mw.hook( 'mw.uls.ime.enable' ).add( this.enableIME.bind( this ) );
|
||||
mw.hook( 'mw.uls.ime.disable' ).add( this.disableIME.bind( this ) );
|
||||
mw.hook( 'mw.uls.ime.change' ).add( this.changeIME.bind( this ) );
|
||||
mw.hook( 'mw.uls.login.click' ).add( this.loginClick.bind( this ) );
|
||||
mw.hook( 'mw.uls.ime.morelanguages' ).add( this.imeMoreLanguages.bind( this ) );
|
||||
mw.hook( 'mw.uls.interface.morelanguages' ).add( this.interfaceMoreLanguages.bind( this ) );
|
||||
mw.hook( 'mw.uls.interface.language.change' ).add( this.interfaceLanguageChange.bind( this ) );
|
||||
mw.hook( 'mw.uls.font.change' ).add( this.fontChange.bind( this ) );
|
||||
mw.hook( 'mw.uls.webfonts.enable' ).add( this.enableWebfonts.bind( this ) );
|
||||
mw.hook( 'mw.uls.webfonts.disable' ).add( this.disableWebfonts.bind( this ) );
|
||||
|
||||
$( 'body' ).on( 'noresults.uls', '.uls-menu .uls-languagefilter',
|
||||
$.proxy( this.noSearchResults, this )
|
||||
this.noSearchResults.bind( this )
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
@@ -74,14 +74,14 @@
|
||||
|
||||
// Register all event listeners to the ULS language settings here.
|
||||
listen: function () {
|
||||
this.$element.on( 'click', $.proxy( this.click, this ) );
|
||||
this.$element.on( 'click', this.click.bind( this ) );
|
||||
|
||||
this.$window.find( '#languagesettings-close, button.uls-settings-cancel' )
|
||||
.on( 'click', $.proxy( mw.hook( 'mw.uls.settings.cancel' ).fire, this ) );
|
||||
.on( 'click', mw.hook( 'mw.uls.settings.cancel' ).fire.bind( this ) );
|
||||
this.$window.find( 'button.uls-settings-apply' )
|
||||
.on( 'click', $.proxy( mw.hook( 'mw.uls.settings.apply' ).fire, this ) );
|
||||
.on( 'click', mw.hook( 'mw.uls.settings.apply' ).fire.bind( this ) );
|
||||
// Hide the window when clicked outside
|
||||
$( 'html' ).click( $.proxy( this.hide, this ) );
|
||||
$( 'html' ).click( this.hide.bind( this ) );
|
||||
|
||||
// ... but when clicked on window do not hide.
|
||||
this.$window.on( 'click', function ( event ) {
|
||||
@@ -168,8 +168,8 @@
|
||||
this.modules[ moduleName ] = module;
|
||||
|
||||
// Register cancel and apply hooks
|
||||
mw.hook( 'mw.uls.settings.cancel' ).add( $.proxy( module.cancel, module ) );
|
||||
mw.hook( 'mw.uls.settings.apply' ).add( $.proxy( module.apply, module ) );
|
||||
mw.hook( 'mw.uls.settings.cancel' ).add( module.cancel.bind( module ) );
|
||||
mw.hook( 'mw.uls.settings.apply' ).add( module.apply.bind( module ) );
|
||||
},
|
||||
|
||||
position: function () {
|
||||
|
||||
Reference in New Issue
Block a user