X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki.rcfilters%2Fui%2FRclTargetPageWidget.js;h=382b54c8e50bfdbaf76fd790cab425b77c1aa61e;hb=e3c745fea0c5231cc425a0223c9d4567152171a0;hp=6eb0d5b252de6d5a8add5e241efa2bd4545d3d45;hpb=713d917712f4d02366536a13af7765deb56fec13;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki.rcfilters/ui/RclTargetPageWidget.js b/resources/src/mediawiki.rcfilters/ui/RclTargetPageWidget.js index 6eb0d5b252..382b54c8e5 100644 --- a/resources/src/mediawiki.rcfilters/ui/RclTargetPageWidget.js +++ b/resources/src/mediawiki.rcfilters/ui/RclTargetPageWidget.js @@ -1,82 +1,80 @@ -( function () { - /** - * Widget to select and display target page on Special:RecentChangesLinked (AKA Related Changes) - * - * @class mw.rcfilters.ui.RclTargetPageWidget - * @extends OO.ui.Widget - * - * @constructor - * @param {mw.rcfilters.Controller} controller - * @param {mw.rcfilters.dm.FilterItem} targetPageModel - * @param {Object} [config] Configuration object - */ - var RclTargetPageWidget = function MwRcfiltersUiRclTargetPageWidget( - controller, targetPageModel, config - ) { - config = config || {}; +/** + * Widget to select and display target page on Special:RecentChangesLinked (AKA Related Changes) + * + * @class mw.rcfilters.ui.RclTargetPageWidget + * @extends OO.ui.Widget + * + * @constructor + * @param {mw.rcfilters.Controller} controller + * @param {mw.rcfilters.dm.FilterItem} targetPageModel + * @param {Object} [config] Configuration object + */ +var RclTargetPageWidget = function MwRcfiltersUiRclTargetPageWidget( + controller, targetPageModel, config +) { + config = config || {}; - // Parent - RclTargetPageWidget.parent.call( this, config ); + // Parent + RclTargetPageWidget.parent.call( this, config ); - this.controller = controller; - this.model = targetPageModel; + this.controller = controller; + this.model = targetPageModel; - this.titleSearch = new mw.widgets.TitleInputWidget( { - validate: false, - placeholder: mw.msg( 'rcfilters-target-page-placeholder' ), - showImages: true, - showDescriptions: true, - addQueryInput: false - } ); + this.titleSearch = new mw.widgets.TitleInputWidget( { + validate: false, + placeholder: mw.msg( 'rcfilters-target-page-placeholder' ), + showImages: true, + showDescriptions: true, + addQueryInput: false + } ); - // Events - this.model.connect( this, { update: 'updateUiBasedOnModel' } ); + // Events + this.model.connect( this, { update: 'updateUiBasedOnModel' } ); - this.titleSearch.$input.on( { - blur: this.onLookupInputBlur.bind( this ) - } ); + this.titleSearch.$input.on( { + blur: this.onLookupInputBlur.bind( this ) + } ); - this.titleSearch.lookupMenu.connect( this, { - choose: 'onLookupMenuItemChoose' - } ); + this.titleSearch.lookupMenu.connect( this, { + choose: 'onLookupMenuItemChoose' + } ); - // Initialize - this.$element - .addClass( 'mw-rcfilters-ui-rclTargetPageWidget' ) - .append( this.titleSearch.$element ); + // Initialize + this.$element + .addClass( 'mw-rcfilters-ui-rclTargetPageWidget' ) + .append( this.titleSearch.$element ); - this.updateUiBasedOnModel(); - }; + this.updateUiBasedOnModel(); +}; - /* Initialization */ +/* Initialization */ - OO.inheritClass( RclTargetPageWidget, OO.ui.Widget ); +OO.inheritClass( RclTargetPageWidget, OO.ui.Widget ); - /* Methods */ +/* Methods */ - /** - * Respond to the user choosing a title - */ - RclTargetPageWidget.prototype.onLookupMenuItemChoose = function () { - this.titleSearch.$input.trigger( 'blur' ); - }; +/** + * Respond to the user choosing a title + */ +RclTargetPageWidget.prototype.onLookupMenuItemChoose = function () { + this.titleSearch.$input.trigger( 'blur' ); +}; - /** - * Respond to titleSearch $input blur - */ - RclTargetPageWidget.prototype.onLookupInputBlur = function () { - this.controller.setTargetPage( this.titleSearch.getQueryValue() ); - }; +/** + * Respond to titleSearch $input blur + */ +RclTargetPageWidget.prototype.onLookupInputBlur = function () { + this.controller.setTargetPage( this.titleSearch.getQueryValue() ); +}; - /** - * Respond to the model being updated - */ - RclTargetPageWidget.prototype.updateUiBasedOnModel = function () { - var title = mw.Title.newFromText( this.model.getValue() ), - text = title ? title.toText() : this.model.getValue(); - this.titleSearch.setValue( text ); - this.titleSearch.setTitle( text ); - }; +/** + * Respond to the model being updated + */ +RclTargetPageWidget.prototype.updateUiBasedOnModel = function () { + var title = mw.Title.newFromText( this.model.getValue() ), + text = title ? title.toText() : this.model.getValue(); + this.titleSearch.setValue( text ); + this.titleSearch.setTitle( text ); +}; - module.exports = RclTargetPageWidget; -}() ); +module.exports = RclTargetPageWidget;