ef95f2f243443e395519f9c04e4b04314cded6d6
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / ui / mw.rcfilters.ui.FilterTagMultiselectWidget.js
1 ( function ( mw ) {
2 /**
3 * List displaying all filter groups
4 *
5 * @class
6 * @extends OO.ui.MenuTagMultiselectWidget
7 * @mixins OO.ui.mixin.PendingElement
8 *
9 * @constructor
10 * @param {mw.rcfilters.Controller} controller Controller
11 * @param {mw.rcfilters.dm.FiltersViewModel} model View model
12 * @param {mw.rcfilters.dm.SavedQueriesModel} savedQueriesModel Saved queries model
13 * @param {Object} config Configuration object
14 * @cfg {jQuery} [$overlay] A jQuery object serving as overlay for popups
15 */
16 mw.rcfilters.ui.FilterTagMultiselectWidget = function MwRcfiltersUiFilterTagMultiselectWidget( controller, model, savedQueriesModel, config ) {
17 var rcFiltersRow,
18 title = new OO.ui.LabelWidget( {
19 label: mw.msg( 'rcfilters-activefilters' ),
20 classes: [ 'mw-rcfilters-ui-filterTagMultiselectWidget-wrapper-content-title' ]
21 } ),
22 $contentWrapper = $( '<div>' )
23 .addClass( 'mw-rcfilters-ui-filterTagMultiselectWidget-wrapper' );
24
25 config = config || {};
26
27 this.controller = controller;
28 this.model = model;
29 this.queriesModel = savedQueriesModel;
30 this.$overlay = config.$overlay || this.$element;
31 this.matchingQuery = null;
32 this.currentView = this.model.getCurrentView();
33
34 // Parent
35 mw.rcfilters.ui.FilterTagMultiselectWidget.parent.call( this, $.extend( true, {
36 label: mw.msg( 'rcfilters-filterlist-title' ),
37 placeholder: mw.msg( 'rcfilters-empty-filter' ),
38 inputPosition: 'outline',
39 allowArbitrary: false,
40 allowDisplayInvalidTags: false,
41 allowReordering: false,
42 $overlay: this.$overlay,
43 menu: {
44 hideWhenOutOfView: false,
45 hideOnChoose: false,
46 width: 650,
47 footers: [
48 {
49 name: 'viewSelect',
50 sticky: false,
51 // View select menu, appears on default view only
52 $element: $( '<div>' )
53 .append( new mw.rcfilters.ui.ViewSwitchWidget( this.controller, this.model ).$element ),
54 views: [ 'default' ]
55 },
56 {
57 name: 'feedback',
58 // Feedback footer, appears on all views
59 $element: $( '<div>' )
60 .append(
61 new OO.ui.ButtonWidget( {
62 framed: false,
63 icon: 'feedback',
64 flags: [ 'progressive' ],
65 label: mw.msg( 'rcfilters-filterlist-feedbacklink' ),
66 href: 'https://www.mediawiki.org/wiki/Help_talk:New_filters_for_edit_review'
67 } ).$element
68 )
69 }
70 ]
71 },
72 input: {
73 icon: 'menu',
74 placeholder: mw.msg( 'rcfilters-search-placeholder' )
75 }
76 }, config ) );
77
78 this.savedQueryTitle = new OO.ui.LabelWidget( {
79 label: '',
80 classes: [ 'mw-rcfilters-ui-filterTagMultiselectWidget-wrapper-content-savedQueryTitle' ]
81 } );
82
83 this.resetButton = new OO.ui.ButtonWidget( {
84 framed: false,
85 classes: [ 'mw-rcfilters-ui-filterTagMultiselectWidget-resetButton' ]
86 } );
87
88 if ( !mw.user.isAnon() ) {
89 this.saveQueryButton = new mw.rcfilters.ui.SaveFiltersPopupButtonWidget(
90 this.controller,
91 this.queriesModel
92 );
93
94 this.saveQueryButton.$element.on( 'mousedown', function ( e ) { e.stopPropagation(); } );
95
96 this.saveQueryButton.connect( this, {
97 click: 'onSaveQueryButtonClick',
98 saveCurrent: 'setSavedQueryVisibility'
99 } );
100 this.queriesModel.connect( this, {
101 itemUpdate: 'onSavedQueriesItemUpdate',
102 initialize: 'onSavedQueriesInitialize',
103 'default': 'reevaluateResetRestoreState'
104 } );
105 }
106
107 this.emptyFilterMessage = new OO.ui.LabelWidget( {
108 label: mw.msg( 'rcfilters-empty-filter' ),
109 classes: [ 'mw-rcfilters-ui-filterTagMultiselectWidget-emptyFilters' ]
110 } );
111 this.$content.append( this.emptyFilterMessage.$element );
112
113 // Events
114 this.resetButton.connect( this, { click: 'onResetButtonClick' } );
115 // Stop propagation for mousedown, so that the widget doesn't
116 // trigger the focus on the input and scrolls up when we click the reset button
117 this.resetButton.$element.on( 'mousedown', function ( e ) { e.stopPropagation(); } );
118 this.model.connect( this, {
119 initialize: 'onModelInitialize',
120 update: 'onModelUpdate',
121 itemUpdate: 'onModelItemUpdate',
122 highlightChange: 'onModelHighlightChange'
123 } );
124 this.input.connect( this, { change: 'onInputChange' } );
125
126 // The filter list and button should appear side by side regardless of how
127 // wide the button is; the button also changes its width depending
128 // on language and its state, so the safest way to present both side
129 // by side is with a table layout
130 rcFiltersRow = $( '<div>' )
131 .addClass( 'mw-rcfilters-ui-row' )
132 .append(
133 this.$content
134 .addClass( 'mw-rcfilters-ui-cell' )
135 .addClass( 'mw-rcfilters-ui-filterTagMultiselectWidget-cell-filters' )
136 );
137
138 if ( !mw.user.isAnon() ) {
139 rcFiltersRow.append(
140 $( '<div>' )
141 .addClass( 'mw-rcfilters-ui-cell' )
142 .addClass( 'mw-rcfilters-ui-filterTagMultiselectWidget-cell-save' )
143 .append( this.saveQueryButton.$element )
144 );
145 }
146
147 // Add a selector at the right of the input
148 this.viewsSelectWidget = new OO.ui.ButtonSelectWidget( {
149 classes: [ 'mw-rcfilters-ui-filterTagMultiselectWidget-views-select-widget' ],
150 items: [
151 new OO.ui.ButtonOptionWidget( {
152 framed: false,
153 data: '',
154 disabled: true,
155 classes: [ 'mw-rcfilters-ui-filterTagMultiselectWidget-views-select-widget-label' ],
156 label: mw.msg( 'rcfilters-view-advanced-filters-label' )
157 } ),
158 new OO.ui.ButtonOptionWidget( {
159 framed: false,
160 data: 'namespaces',
161 icon: 'article',
162 title: mw.msg( 'rcfilters-view-namespaces-tooltip' )
163 } ),
164 new OO.ui.ButtonOptionWidget( {
165 framed: false,
166 data: 'tags',
167 icon: 'tag',
168 title: mw.msg( 'rcfilters-view-tags-tooltip' )
169 } )
170 ]
171 } );
172
173 // Rearrange the UI so the select widget is at the right of the input
174 this.$element.append(
175 $( '<div>' )
176 .addClass( 'mw-rcfilters-ui-table' )
177 .append(
178 $( '<div>' )
179 .addClass( 'mw-rcfilters-ui-row' )
180 .append(
181 $( '<div>' )
182 .addClass( 'mw-rcfilters-ui-cell' )
183 .addClass( 'mw-rcfilters-ui-filterTagMultiselectWidget-views-input' )
184 .append( this.input.$element ),
185 $( '<div>' )
186 .addClass( 'mw-rcfilters-ui-cell' )
187 .addClass( 'mw-rcfilters-ui-filterTagMultiselectWidget-views-select' )
188 .append( this.viewsSelectWidget.$element )
189 )
190 )
191 );
192
193 // Event
194 this.viewsSelectWidget.connect( this, { choose: 'onViewsSelectWidgetChoose' } );
195
196 rcFiltersRow.append(
197 $( '<div>' )
198 .addClass( 'mw-rcfilters-ui-cell' )
199 .addClass( 'mw-rcfilters-ui-filterTagMultiselectWidget-cell-reset' )
200 .append( this.resetButton.$element )
201 );
202
203 // Build the content
204 $contentWrapper.append(
205 title.$element,
206 this.savedQueryTitle.$element,
207 $( '<div>' )
208 .addClass( 'mw-rcfilters-ui-table' )
209 .append(
210 rcFiltersRow
211 )
212 );
213
214 // Initialize
215 this.$handle.append( $contentWrapper );
216 this.emptyFilterMessage.toggle( this.isEmpty() );
217 this.savedQueryTitle.toggle( false );
218
219 this.$element
220 .addClass( 'mw-rcfilters-ui-filterTagMultiselectWidget' );
221
222 this.reevaluateResetRestoreState();
223 };
224
225 /* Initialization */
226
227 OO.inheritClass( mw.rcfilters.ui.FilterTagMultiselectWidget, OO.ui.MenuTagMultiselectWidget );
228
229 /* Methods */
230
231 /**
232 * Respond to view select widget choose event
233 *
234 * @param {OO.ui.ButtonOptionWidget} buttonOptionWidget Chosen widget
235 */
236 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onViewsSelectWidgetChoose = function ( buttonOptionWidget ) {
237 this.controller.switchView( buttonOptionWidget.getData() );
238 this.viewsSelectWidget.selectItem( null );
239 this.focus();
240 };
241
242 /**
243 * Respond to input change event
244 *
245 * @param {string} value Value of the input
246 */
247 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onInputChange = function ( value ) {
248 var view;
249
250 value = value.trim();
251
252 view = this.model.getViewByTrigger( value.substr( 0, 1 ) );
253
254 this.controller.switchView( view );
255 };
256 /**
257 * Respond to query button click
258 */
259 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onSaveQueryButtonClick = function () {
260 this.getMenu().toggle( false );
261 };
262
263 /**
264 * Respond to save query model initialization
265 */
266 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onSavedQueriesInitialize = function () {
267 this.setSavedQueryVisibility();
268 };
269
270 /**
271 * Respond to save query item change. Mainly this is done to update the label in case
272 * a query item has been edited
273 *
274 * @param {mw.rcfilters.dm.SavedQueryItemModel} item Saved query item
275 */
276 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onSavedQueriesItemUpdate = function ( item ) {
277 if ( this.matchingQuery === item ) {
278 // This means we just edited the item that is currently matched
279 this.savedQueryTitle.setLabel( item.getLabel() );
280 }
281 };
282
283 /**
284 * Respond to menu toggle
285 *
286 * @param {boolean} isVisible Menu is visible
287 */
288 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onMenuToggle = function ( isVisible ) {
289 // Parent
290 mw.rcfilters.ui.FilterTagMultiselectWidget.parent.prototype.onMenuToggle.call( this );
291
292 if ( isVisible ) {
293 mw.hook( 'RcFilters.popup.open' ).fire();
294
295 if ( !this.getMenu().getSelectedItem() ) {
296 // If there are no selected items, scroll menu to top
297 // This has to be in a setTimeout so the menu has time
298 // to be positioned and fixed
299 setTimeout( function () { this.getMenu().scrollToTop(); }.bind( this ), 0 );
300 }
301 } else {
302 // Clear selection
303 this.selectTag( null );
304
305 // Clear input if the only thing in the input is the prefix
306 if (
307 this.input.getValue().trim() === this.model.getViewTrigger( this.model.getCurrentView() )
308 ) {
309 // Clear the input
310 this.input.setValue( '' );
311 }
312
313 // Log filter grouping
314 this.controller.trackFilterGroupings( 'filtermenu' );
315 }
316
317 this.input.setIcon( isVisible ? 'search' : 'menu' );
318 };
319
320 /**
321 * @inheritdoc
322 */
323 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onInputFocus = function () {
324 // Parent
325 mw.rcfilters.ui.FilterTagMultiselectWidget.parent.prototype.onInputFocus.call( this );
326
327 // Only scroll to top of the viewport if:
328 // - The widget is more than 20px from the top
329 // - The widget is not above the top of the viewport (do not scroll downwards)
330 // (This isn't represented because >20 is, anyways and always, bigger than 0)
331 this.scrollToTop( this.$element, 0, { min: 20, max: Infinity } );
332 };
333
334 /**
335 * @inheritdoc
336 */
337 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.doInputEscape = function () {
338 // Parent
339 mw.rcfilters.ui.FilterTagMultiselectWidget.parent.prototype.doInputEscape.call( this );
340
341 // Blur the input
342 this.input.$input.blur();
343 };
344
345 /**
346 * @inheritdoc
347 */
348 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onChangeTags = function () {
349 // Parent method
350 mw.rcfilters.ui.FilterTagMultiselectWidget.parent.prototype.onChangeTags.call( this );
351
352 this.emptyFilterMessage.toggle( this.isEmpty() );
353 };
354
355 /**
356 * Respond to model initialize event
357 */
358 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onModelInitialize = function () {
359 this.setSavedQueryVisibility();
360 };
361
362 /**
363 * Respond to model update event
364 */
365 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onModelUpdate = function () {
366 this.updateElementsForView();
367 };
368
369 /**
370 * Update the elements in the widget to the current view
371 */
372 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.updateElementsForView = function () {
373 var view = this.model.getCurrentView(),
374 inputValue = this.input.getValue().trim(),
375 inputView = this.model.getViewByTrigger( inputValue.substr( 0, 1 ) );
376
377 if ( inputView !== 'default' ) {
378 // We have a prefix already, remove it
379 inputValue = inputValue.substr( 1 );
380 }
381
382 if ( inputView !== view ) {
383 // Add the correct prefix
384 inputValue = this.model.getViewTrigger( view ) + inputValue;
385 }
386
387 // Update input
388 this.input.setValue( inputValue );
389
390 if ( this.currentView !== view ) {
391 this.scrollToTop( this.$element );
392 this.currentView = view;
393 }
394 };
395
396 /**
397 * Set the visibility of the saved query button
398 */
399 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.setSavedQueryVisibility = function () {
400 if ( mw.user.isAnon() ) {
401 return;
402 }
403
404 this.matchingQuery = this.controller.findQueryMatchingCurrentState();
405
406 this.savedQueryTitle.setLabel(
407 this.matchingQuery ? this.matchingQuery.getLabel() : ''
408 );
409 this.savedQueryTitle.toggle( !!this.matchingQuery );
410 this.saveQueryButton.toggle( !this.matchingQuery );
411
412 if ( this.matchingQuery ) {
413 this.emphasize();
414 }
415 };
416
417 /**
418 * Respond to model itemUpdate event
419 *
420 * @param {mw.rcfilters.dm.FilterItem} item Filter item model
421 */
422 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onModelItemUpdate = function ( item ) {
423 if ( !item.getGroupModel().isHidden() ) {
424 if (
425 item.isSelected() ||
426 (
427 this.model.isHighlightEnabled() &&
428 item.isHighlightSupported() &&
429 item.getHighlightColor()
430 )
431 ) {
432 this.addTag( item.getName(), item.getLabel() );
433 } else {
434 this.removeTagByData( item.getName() );
435 }
436 }
437
438 this.setSavedQueryVisibility();
439
440 // Re-evaluate reset state
441 this.reevaluateResetRestoreState();
442 };
443
444 /**
445 * @inheritdoc
446 */
447 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.isAllowedData = function ( data ) {
448 return (
449 this.model.getItemByName( data ) &&
450 !this.isDuplicateData( data )
451 );
452 };
453
454 /**
455 * @inheritdoc
456 */
457 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onMenuChoose = function ( item ) {
458 this.controller.toggleFilterSelect( item.model.getName() );
459
460 // Select the tag if it exists, or reset selection otherwise
461 this.selectTag( this.getItemFromData( item.model.getName() ) );
462
463 this.focus();
464 };
465
466 /**
467 * Respond to highlightChange event
468 *
469 * @param {boolean} isHighlightEnabled Highlight is enabled
470 */
471 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onModelHighlightChange = function ( isHighlightEnabled ) {
472 var highlightedItems = this.model.getHighlightedItems();
473
474 if ( isHighlightEnabled ) {
475 // Add capsule widgets
476 highlightedItems.forEach( function ( filterItem ) {
477 this.addTag( filterItem.getName(), filterItem.getLabel() );
478 }.bind( this ) );
479 } else {
480 // Remove capsule widgets if they're not selected
481 highlightedItems.forEach( function ( filterItem ) {
482 if ( !filterItem.isSelected() ) {
483 this.removeTagByData( filterItem.getName() );
484 }
485 }.bind( this ) );
486 }
487 };
488
489 /**
490 * @inheritdoc
491 */
492 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onTagSelect = function ( tagItem ) {
493 var widget = this,
494 menuOption = this.menu.getItemFromModel( tagItem.getModel() ),
495 oldInputValue = this.input.getValue().trim();
496
497 this.menu.setUserSelecting( true );
498
499 // Reset input
500 this.input.setValue( '' );
501
502 // Switch view
503 this.controller.switchView( tagItem.getView() );
504
505 // Parent method
506 mw.rcfilters.ui.FilterTagMultiselectWidget.parent.prototype.onTagSelect.call( this, tagItem );
507
508 this.menu.selectItem( menuOption );
509 this.selectTag( tagItem );
510
511 // Scroll to the item
512 if ( this.model.removeViewTriggers( oldInputValue ) ) {
513 // We're binding a 'once' to the itemVisibilityChange event
514 // so this happens when the menu is ready after the items
515 // are visible again, in case this is done right after the
516 // user filtered the results
517 this.getMenu().once(
518 'itemVisibilityChange',
519 function () {
520 widget.scrollToTop( menuOption.$element );
521 widget.menu.setUserSelecting( false );
522 }
523 );
524 } else {
525 this.scrollToTop( menuOption.$element );
526 this.menu.setUserSelecting( false );
527 }
528
529 };
530
531 /**
532 * Select a tag by reference. This is what OO.ui.SelectWidget is doing.
533 * If no items are given, reset selection from all.
534 *
535 * @param {mw.rcfilters.ui.FilterTagItemWidget} [item] Tag to select,
536 * omit to deselect all
537 */
538 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.selectTag = function ( item ) {
539 var i, len, selected;
540
541 for ( i = 0, len = this.items.length; i < len; i++ ) {
542 selected = this.items[ i ] === item;
543 if ( this.items[ i ].isSelected() !== selected ) {
544 this.items[ i ].toggleSelected( selected );
545 }
546 }
547 };
548 /**
549 * @inheritdoc
550 */
551 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onTagRemove = function ( tagItem ) {
552 // Parent method
553 mw.rcfilters.ui.FilterTagMultiselectWidget.parent.prototype.onTagRemove.call( this, tagItem );
554
555 this.controller.clearFilter( tagItem.getName() );
556
557 tagItem.destroy();
558 };
559
560 /**
561 * Respond to click event on the reset button
562 */
563 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onResetButtonClick = function () {
564 if ( this.model.areCurrentFiltersEmpty() ) {
565 // Reset to default filters
566 this.controller.resetToDefaults();
567 } else {
568 // Reset to have no filters
569 this.controller.emptyFilters();
570 }
571 };
572
573 /**
574 * Reevaluate the restore state for the widget between setting to defaults and clearing all filters
575 */
576 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.reevaluateResetRestoreState = function () {
577 var defaultsAreEmpty = this.controller.areDefaultsEmpty(),
578 currFiltersAreEmpty = this.model.areCurrentFiltersEmpty(),
579 hideResetButton = currFiltersAreEmpty && defaultsAreEmpty;
580
581 this.resetButton.setIcon(
582 currFiltersAreEmpty ? 'history' : 'trash'
583 );
584
585 this.resetButton.setLabel(
586 currFiltersAreEmpty ? mw.msg( 'rcfilters-restore-default-filters' ) : ''
587 );
588 this.resetButton.setTitle(
589 currFiltersAreEmpty ? null : mw.msg( 'rcfilters-clear-all-filters' )
590 );
591
592 this.resetButton.toggle( !hideResetButton );
593 this.emptyFilterMessage.toggle( currFiltersAreEmpty );
594 };
595
596 /**
597 * @inheritdoc
598 */
599 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.createMenuWidget = function ( menuConfig ) {
600 return new mw.rcfilters.ui.MenuSelectWidget(
601 this.controller,
602 this.model,
603 $.extend( {
604 filterFromInput: true
605 }, menuConfig )
606 );
607 };
608
609 /**
610 * @inheritdoc
611 */
612 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.createTagItemWidget = function ( data ) {
613 var filterItem = this.model.getItemByName( data );
614
615 if ( filterItem ) {
616 return new mw.rcfilters.ui.FilterTagItemWidget(
617 this.controller,
618 this.model.getInvertModel(),
619 filterItem,
620 {
621 $overlay: this.$overlay
622 }
623 );
624 }
625 };
626
627 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.emphasize = function () {
628 if (
629 !this.$handle.hasClass( 'mw-rcfilters-ui-filterTagMultiselectWidget-animate' )
630 ) {
631 this.$handle
632 .addClass( 'mw-rcfilters-ui-filterTagMultiselectWidget-emphasize' )
633 .addClass( 'mw-rcfilters-ui-filterTagMultiselectWidget-animate' );
634
635 setTimeout( function () {
636 this.$handle
637 .removeClass( 'mw-rcfilters-ui-filterTagMultiselectWidget-emphasize' );
638
639 setTimeout( function () {
640 this.$handle
641 .removeClass( 'mw-rcfilters-ui-filterTagMultiselectWidget-animate' );
642 }.bind( this ), 1000 );
643 }.bind( this ), 500 );
644
645 }
646 };
647 /**
648 * Scroll the element to top within its container
649 *
650 * @private
651 * @param {jQuery} $element Element to position
652 * @param {number} [marginFromTop=0] When scrolling the entire widget to the top, leave this
653 * much space (in pixels) above the widget.
654 * @param {Object} [threshold] Minimum distance from the top of the element to scroll at all
655 * @param {number} [threshold.min] Minimum distance above the element
656 * @param {number} [threshold.max] Minimum distance below the element
657 */
658 mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.scrollToTop = function ( $element, marginFromTop, threshold ) {
659 var container = OO.ui.Element.static.getClosestScrollableContainer( $element[ 0 ], 'y' ),
660 pos = OO.ui.Element.static.getRelativePosition( $element, $( container ) ),
661 containerScrollTop = $( container ).scrollTop(),
662 effectiveScrollTop = $( container ).is( 'body, html' ) ? 0 : containerScrollTop,
663 newScrollTop = effectiveScrollTop + pos.top - ( marginFromTop || 0 );
664
665 // Scroll to item
666 if (
667 threshold === undefined ||
668 (
669 (
670 threshold.min === undefined ||
671 newScrollTop - containerScrollTop >= threshold.min
672 ) &&
673 (
674 threshold.max === undefined ||
675 newScrollTop - containerScrollTop <= threshold.max
676 )
677 )
678 ) {
679 $( container ).animate( {
680 scrollTop: newScrollTop
681 } );
682 }
683 };
684 }( mediaWiki ) );