-( function ( mw, $ ) {
+/* eslint-disable no-restricted-properties */
+( function () {
/**
* View model for the filters selection and display
*
filterItemGroup = filterItem.getGroupModel();
// For each item, see if that item is still conflicting
+ // eslint-disable-next-line jquery/no-each-util
$.each( model.groups, function ( groupName, groupModel ) {
if ( filterItem.getGroupName() === groupName ) {
// Check inside the group
groupModel.areAllSelectedInConflictWith( filterItem ) &&
// Every selected member of the item's own group is also
// in conflict with the other group
- filterItemGroup.getSelectedItems().every( function ( otherGroupItem ) {
+ filterItemGroup.findSelectedItems().every( function ( otherGroupItem ) {
return groupModel.areAllSelectedInConflictWith( otherGroupItem );
} )
);
expandConflictDefinitions = function ( obj ) {
var result = {};
+ // eslint-disable-next-line jquery/no-each-util
$.each( obj, function ( key, conflicts ) {
var filterName,
adjustedConflicts = {};
}, views );
// Go over all views
+ // eslint-disable-next-line jquery/no-each-util
$.each( allViews, function ( viewName, viewData ) {
// Define the view
model.views[ viewName ] = {
filterConflictResult = expandConflictDefinitions( filterConflictMap );
// Set conflicts for groups
+ // eslint-disable-next-line jquery/no-each-util
$.each( groupConflictResult, function ( group, conflicts ) {
model.groups[ group ].setConflicts( conflicts );
} );
// Set conflicts for items
+ // eslint-disable-next-line jquery/no-each-util
$.each( filterConflictResult, function ( filterName, conflicts ) {
var filterItem = model.getItemByName( filterName );
// set conflicts for items in the group
} );
// Create a map between known parameters and their models
+ // eslint-disable-next-line jquery/no-each-util
$.each( this.groups, function ( group, groupModel ) {
if (
groupModel.getType() === 'send_unselected_if_any' ||
var filtersValue;
// For arbitrary numeric single_option values make sure the values
// are normalized to fit within the limits
+ // eslint-disable-next-line jquery/no-each-util
$.each( this.getFilterGroups(), function ( groupName, groupModel ) {
params[ groupName ] = groupModel.normalizeArbitraryValue( params[ groupName ] );
} );
parameters = parameters ? $.extend( true, {}, parameters ) : this.getCurrentParameterState();
// Params
+ // eslint-disable-next-line jquery/no-each-util
$.each( this.getEmptyParameterState(), function ( param, value ) {
if ( parameters[ param ] !== undefined && parameters[ param ] !== value ) {
result[ param ] = parameters[ param ];
view = view || this.getCurrentView();
+ // eslint-disable-next-line jquery/no-each-util
$.each( this.groups, function ( groupName, groupModel ) {
if ( groupModel.getView() === view ) {
result[ groupName ] = groupModel;
groups = this.getFilterGroupsByView( view );
+ // eslint-disable-next-line jquery/no-each-util
$.each( groups, function ( groupName, groupModel ) {
result = result.concat( groupModel.getItems() );
} );
var result = {};
// Get default filter state
+ // eslint-disable-next-line jquery/no-each-util
$.each( this.groups, function ( name, model ) {
if ( !model.isSticky() ) {
$.extend( true, result, model.getDefaultParams() );
mw.rcfilters.dm.FiltersViewModel.prototype.getStickyParams = function () {
var result = [];
+ // eslint-disable-next-line jquery/no-each-util
$.each( this.groups, function ( name, model ) {
if ( model.isSticky() ) {
if ( model.isPerGroupRequestParameter() ) {
mw.rcfilters.dm.FiltersViewModel.prototype.getStickyParamsValues = function () {
var result = {};
+ // eslint-disable-next-line jquery/no-each-util
$.each( this.groups, function ( name, model ) {
if ( model.isSticky() ) {
$.extend( true, result, model.getParamRepresentation() );
} );
}
+ // eslint-disable-next-line jquery/no-each-util
$.each( groupItems, function ( group, model ) {
$.extend(
result,
// },
// group2: "param4|param5"
// }
+ // eslint-disable-next-line jquery/no-each-util
$.each( params, function ( paramName, paramValue ) {
var groupName,
itemOrGroup = model.parameterMap[ paramName ];
// Go over all groups, so we make sure we get the complete output
// even if the parameters don't include a certain group
+ // eslint-disable-next-line jquery/no-each-util
$.each( this.groups, function ( groupName, groupModel ) {
result = $.extend( true, {}, result, groupModel.getFilterRepresentation( groupMap[ groupName ] ) );
} );
*/
mw.rcfilters.dm.FiltersViewModel.prototype.areNamespacesEffectivelyInverted = function () {
return this.getInvertModel().isSelected() &&
- this.getSelectedItems().some( function ( itemModel ) {
+ this.findSelectedItems().some( function ( itemModel ) {
return itemModel.getGroupModel().getName() === 'namespace';
} );
};
*
* @return {mw.rcfilters.dm.FilterItem[]} Selected items
*/
- mw.rcfilters.dm.FiltersViewModel.prototype.getSelectedItems = function () {
+ mw.rcfilters.dm.FiltersViewModel.prototype.findSelectedItems = function () {
var allSelected = [];
+ // eslint-disable-next-line jquery/no-each-util
$.each( this.getFilterGroups(), function ( groupName, groupModel ) {
- allSelected = allSelected.concat( groupModel.getSelectedItems() );
+ allSelected = allSelected.concat( groupModel.findSelectedItems() );
} );
return allSelected;
mw.rcfilters.dm.FiltersViewModel.prototype.getViewByTrigger = function ( trigger ) {
var result = 'default';
+ // eslint-disable-next-line jquery/no-each-util
$.each( this.views, function ( name, data ) {
if ( data.trigger === trigger ) {
result = name;
visibleGroupNames = Object.keys( visibleGroups );
// Update visibility of items and groups
+ // eslint-disable-next-line jquery/no-each-util
$.each( this.getFilterGroups(), function ( groupName, groupModel ) {
// Check if the group is visible at all
groupModel.toggleVisible( visibleGroupNames.indexOf( groupName ) !== -1 );
this.getItemByName( filterName ).clearHighlightColor();
};
-}( mediaWiki, jQuery ) );
+}() );