From 10775df785094a9ae8bbe408371664d99656ecdb Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Sun, 13 Sep 2015 16:51:19 +0100 Subject: [PATCH] Remove $ = this.$ from OOJSUI code This feature was removed a while ago. Change-Id: I2ae0147f9e605e0f86ea4d26e8c1eaba43db29e2 --- .../ext.templateDataGenerator.ui.tdDialog.js | 57 +++++-------------- ...plateDataGenerator.languageResultWidget.js | 8 +-- ...plateDataGenerator.languageSearchWidget.js | 3 +- ...emplateDataGenerator.optionImportWidget.js | 4 +- .../ext.templateDataGenerator.optionWidget.js | 8 +-- 5 files changed, 24 insertions(+), 56 deletions(-) diff --git a/modules/ext.templateDataGenerator.ui.tdDialog.js b/modules/ext.templateDataGenerator.ui.tdDialog.js index 15a7ba7a..7a0e012f 100644 --- a/modules/ext.templateDataGenerator.ui.tdDialog.js +++ b/modules/ext.templateDataGenerator.ui.tdDialog.js @@ -80,56 +80,40 @@ mw.TemplateData.Dialog.prototype.initialize = function () { this.$spinner = this.$( '
' ).addClass( 'tdg-spinner' ).text( 'working...' ); this.$body.append( this.$spinner ); - this.noticeLabel = new OO.ui.LabelWidget( { $: this.$ } ); + this.noticeLabel = new OO.ui.LabelWidget(); this.noticeLabel.$element.hide(); - this.panels = new OO.ui.StackLayout( { $: this.$, continuous: false } ); + this.panels = new OO.ui.StackLayout( { continuous: false } ); - this.listParamsPanel = new OO.ui.PanelLayout( { - $: this.$, - scrollable: true - } ); - this.editParamPanel = new OO.ui.PanelLayout( { - $: this.$ - } ); - this.languagePanel = new OO.ui.PanelLayout( { - $: this.$ - } ); - this.addParamPanel = new OO.ui.PanelLayout( { - $: this.$ - } ); + this.listParamsPanel = new OO.ui.PanelLayout( { scrollable: true } ); + this.editParamPanel = new OO.ui.PanelLayout(); + this.languagePanel = new OO.ui.PanelLayout(); + this.addParamPanel = new OO.ui.PanelLayout(); // Language panel - this.newLanguageSearchWidget = new mw.TemplateData.LanguageSearchWidget( { - $: this.$ - } ); + this.newLanguageSearchWidget = new mw.TemplateData.LanguageSearchWidget(); // Add parameter panel this.newParamInput = new OO.ui.TextInputWidget( { - $: this.$, placeholder: mw.msg( 'templatedata-modal-placeholder-paramkey' ) } ); this.addParamButton = new OO.ui.ButtonWidget( { - $: this.$, label: mw.msg( 'templatedata-modal-button-addparam' ) } ); addParamFieldlayout = new OO.ui.FieldsetLayout( { - $: this.$, label: mw.msg( 'templatedata-modal-title-addparam' ), items: [ this.newParamInput, this.addParamButton ] } ); // Param list panel (main) - this.languageDropdownWidget = new OO.ui.DropdownWidget( { $: this.$ } ); + this.languageDropdownWidget = new OO.ui.DropdownWidget(); this.languagePanelButton = new OO.ui.ButtonWidget( { - $: this.$, label: mw.msg( 'templatedata-modal-button-add-language' ) } ); languageActionFieldLayout = new OO.ui.ActionFieldLayout( this.languageDropdownWidget, this.languagePanelButton, { - $: this.$, align: 'left', label: mw.msg( 'templatedata-modal-title-language' ) } @@ -137,36 +121,31 @@ mw.TemplateData.Dialog.prototype.initialize = function () { // ParamOrder this.paramOrderWidget = new mw.TemplateData.DragDropWidget( { - $: this.$, orientation: 'horizontal' } ); paramOrderFieldset = new OO.ui.FieldsetLayout( { - $: this.$, label: mw.msg( 'templatedata-modal-title-paramorder' ), items: [ this.paramOrderWidget ] } ); this.descriptionInput = new OO.ui.TextInputWidget( { - $: this.$, multiline: true, autosize: true } ); this.templateDescriptionFieldset = new OO.ui.FieldsetLayout( { - $: this.$, items: [ this.descriptionInput ] } ); - this.paramListNoticeLabel = new OO.ui.LabelWidget( { $: this.$ } ); + this.paramListNoticeLabel = new OO.ui.LabelWidget(); this.paramListNoticeLabel.$element.hide(); this.paramSelectWidget = new OO.ui.SelectWidget(); templateParamsFieldset = new OO.ui.FieldsetLayout( { - $: this.$, label: mw.msg( 'templatedata-modal-title-templateparams' ) } ); templateParamsFieldset.$element.append( this.paramSelectWidget.$element ); // Param details panel - this.$paramDetailsContainer = this.$( '
' ) + this.$paramDetailsContainer = $( '
' ) .addClass( 'tdg-TemplateDataDialog-paramDetails' ); this.listParamsPanel.$element @@ -178,7 +157,7 @@ mw.TemplateData.Dialog.prototype.initialize = function () { paramOrderFieldset.$element, templateParamsFieldset.$element ); - this.paramEditNoticeLabel = new OO.ui.LabelWidget( { $: this.$ } ); + this.paramEditNoticeLabel = new OO.ui.LabelWidget(); this.paramEditNoticeLabel.$element.hide(); // Edit panel this.editParamPanel.$element @@ -268,7 +247,6 @@ mw.TemplateData.Dialog.prototype.onModelChangeParamOrder = function ( paramOrder for ( i = 0; i < paramOrderArray.length; i++ ) { items.push( new mw.TemplateData.DragDropItemWidget( { - $: this.$, data: paramOrderArray[i], label: paramOrderArray[i] } ) @@ -286,7 +264,6 @@ mw.TemplateData.Dialog.prototype.onModelChangeParamOrder = function ( paramOrder */ mw.TemplateData.Dialog.prototype.onModelAddKeyParamOrder = function ( key ) { var dragItem = new mw.TemplateData.DragDropItemWidget( { - $: this.$, data: key, label: key } ); @@ -361,7 +338,6 @@ mw.TemplateData.Dialog.prototype.newLanguageSearchWidgetSelect = function ( data this.availableLanguages.push( newLanguage ); languageButton = new OO.ui.OptionWidget( { data: newLanguage, - $: this.$, label: $.uls.data.getAutonym( newLanguage ) } ); this.languageDropdownWidget.getMenu().addItems( [ languageButton ] ); @@ -532,7 +508,6 @@ mw.TemplateData.Dialog.prototype.repopulateParamSelectWidget = function () { this.paramSelectWidget.addItems( [ new mw.TemplateData.OptionImportWidget( { data: 'tdg-importParameters', - $: this.$, params: missingParams } ) ] ); @@ -596,8 +571,7 @@ mw.TemplateData.Dialog.prototype.addParamToSelectWidget = function ( paramKey ) name: data.name, aliases: data.aliases, description: this.model.getParamDescription( paramKey, this.language ) - }, - $: this.$ + } } ); this.paramSelectWidget.addItems( [ paramItem ] ); @@ -615,13 +589,10 @@ mw.TemplateData.Dialog.prototype.createParamDetails = function () { paramProperties = mw.TemplateData.Model.static.getAllProperties( true ); // Fieldset - paramFieldset = new OO.ui.FieldsetLayout( { - $: this.$ - } ); + paramFieldset = new OO.ui.FieldsetLayout(); for ( props in paramProperties ) { config = { - $: this.$, multiline: paramProperties[props].multiline }; if ( paramProperties[props].multiline ) { @@ -634,7 +605,6 @@ mw.TemplateData.Dialog.prototype.createParamDetails = function () { for ( type in paramProperties[props].children ) { typeItemArray.push( new OO.ui.OptionWidget( { data: paramProperties[props].children[type], - $: this.$, label: mw.msg( 'templatedata-modal-table-param-type-' + paramProperties[props].children[type] ) } ) ); } @@ -842,7 +812,6 @@ mw.TemplateData.Dialog.prototype.getSetupProcess = function ( data ) { // Create a DragDrop widget items.push( new mw.TemplateData.DragDropItemWidget( { - $: this.$, data: paramOrderArray[i], label: paramOrderArray[i] } ) diff --git a/modules/widgets/ext.templateDataGenerator.languageResultWidget.js b/modules/widgets/ext.templateDataGenerator.languageResultWidget.js index 3e0dcbf1..a9ea6c78 100644 --- a/modules/widgets/ext.templateDataGenerator.languageResultWidget.js +++ b/modules/widgets/ext.templateDataGenerator.languageResultWidget.js @@ -14,8 +14,8 @@ mw.TemplateData.LanguageResultWidget = function mwTemplateDataLanguageResultWidg // Initialization this.$element.addClass( 'tdg-languageResultWidget' ); - this.$name = this.$( '
' ).addClass( 'tdg-languageResultWidget-name' ); - this.$otherMatch = this.$( '
' ).addClass( 'tdg-languageResultWidget-otherMatch' ); + this.$name = $( '
' ).addClass( 'tdg-languageResultWidget-name' ); + this.$otherMatch = $( '
' ).addClass( 'tdg-languageResultWidget-otherMatch' ); this.setLabel( this.$otherMatch.add( this.$name ) ); }; @@ -60,7 +60,7 @@ mw.TemplateData.LanguageResultWidget.prototype.updateLabel = function ( query, m * @returns {jQuery} Text with query substring wrapped in highlighted span */ mw.TemplateData.LanguageResultWidget.prototype.highlightQuery = function ( text, query ) { - var $result = this.$( '' ), + var $result = $( '' ), offset = text.toLowerCase().indexOf( query.toLowerCase() ); if ( !query.length || offset === -1 ) { @@ -68,7 +68,7 @@ mw.TemplateData.LanguageResultWidget.prototype.highlightQuery = function ( text, } $result.append( document.createTextNode( text.slice( 0, offset ) ), - this.$( '' ) + $( '' ) .addClass( 'tdg-languageResultWidget-highlight' ) .text( text.substr( offset, query.length ) ), document.createTextNode( text.slice( offset + query.length ) ) diff --git a/modules/widgets/ext.templateDataGenerator.languageSearchWidget.js b/modules/widgets/ext.templateDataGenerator.languageSearchWidget.js index f835ec5c..89eaac6b 100644 --- a/modules/widgets/ext.templateDataGenerator.languageSearchWidget.js +++ b/modules/widgets/ext.templateDataGenerator.languageSearchWidget.js @@ -31,8 +31,7 @@ mw.TemplateData.LanguageSearchWidget = function mwTemplateDataLanguageSearchWidg code: languageCode, name: $.uls.data.getAutonym( languageCode ), autonym: $.uls.data.getAutonym( languageCode ) - }, - $: this.$ + } } ) ); } diff --git a/modules/widgets/ext.templateDataGenerator.optionImportWidget.js b/modules/widgets/ext.templateDataGenerator.optionImportWidget.js index 1d8a526f..050e053e 100644 --- a/modules/widgets/ext.templateDataGenerator.optionImportWidget.js +++ b/modules/widgets/ext.templateDataGenerator.optionImportWidget.js @@ -25,9 +25,9 @@ OO.inheritClass( mw.TemplateData.OptionImportWidget, OO.ui.DecoratedOptionWidget */ mw.TemplateData.OptionImportWidget.prototype.buildParamLabel = function () { var paramNames = this.params.slice( 0, 9 ).join( mw.msg( 'comma-separator' ) ), - $paramName = this.$( '
' ) + $paramName = $( '
' ) .addClass( 'tdg-TemplateDataOptionWidget-param-name' ), - $description = this.$( '
' ) + $description = $( '
' ) .addClass( 'tdg-TemplateDataOptionWidget-param-description' ); $paramName.text( mw.msg( 'templatedata-modal-table-param-importoption', this.params.length ) ); diff --git a/modules/widgets/ext.templateDataGenerator.optionWidget.js b/modules/widgets/ext.templateDataGenerator.optionWidget.js index 6ddfede7..7b5bed4f 100644 --- a/modules/widgets/ext.templateDataGenerator.optionWidget.js +++ b/modules/widgets/ext.templateDataGenerator.optionWidget.js @@ -30,11 +30,11 @@ OO.inheritClass( mw.TemplateData.OptionWidget, OO.ui.DecoratedOptionWidget ); */ mw.TemplateData.OptionWidget.prototype.buildParamLabel = function () { var i, len, - $paramName = this.$( '
' ) + $paramName = $( '
' ) .addClass( 'tdg-TemplateDataOptionWidget-param-name' ), - $aliases = this.$( '
' ) + $aliases = $( '
' ) .addClass( 'tdg-TemplateDataOptionWidget-param-aliases' ), - $description = this.$( '
' ) + $description = $( '
' ) .addClass( 'tdg-TemplateDataOptionWidget-param-description' ); $paramName.text( this.name ); @@ -43,7 +43,7 @@ mw.TemplateData.OptionWidget.prototype.buildParamLabel = function () { if ( this.aliases !== undefined ) { for ( i = 0, len = this.aliases.length; i < len; i++ ) { $aliases.append( - this.$( '' ) + $( '' ) .addClass( 'tdg-TemplateDataOptionWidget-param-alias' ) .text( this.aliases[i] ) );