2 * JavaScript for Special:RecentChanges
12 var filtersModel
= new mw
.rcfilters
.dm
.FiltersViewModel(),
13 changesListModel
= new mw
.rcfilters
.dm
.ChangesListViewModel(),
14 controller
= new mw
.rcfilters
.Controller( filtersModel
, changesListModel
),
15 $overlay
= $( '<div>' )
16 .addClass( 'mw-rcfilters-ui-overlay' ),
17 filtersWidget
= new mw
.rcfilters
.ui
.FilterWrapperWidget(
18 controller
, filtersModel
, { $overlay
: $overlay
} );
20 // TODO: The changesListWrapperWidget should be able to initialize
21 // after the model is ready.
22 // eslint-disable-next-line no-new
23 new mw
.rcfilters
.ui
.ChangesListWrapperWidget(
24 filtersModel
, changesListModel
, $( '.mw-changeslist, .mw-changeslist-empty' ) );
26 controller
.initialize( {
28 title
: mw
.msg( 'rcfilters-filtergroup-registration' ),
29 type
: 'send_unselected_if_any',
34 label
: mw
.msg( 'rcfilters-filter-registered-label' ),
35 description
: mw
.msg( 'rcfilters-filter-registered-description' ),
36 'class': 'mw-changeslist-liu'
40 label
: mw
.msg( 'rcfilters-filter-unregistered-label' ),
41 description
: mw
.msg( 'rcfilters-filter-unregistered-description' ),
42 'class': 'mw-changeslist-anon'
47 title
: mw
.msg( 'rcfilters-filtergroup-userExpLevel' ),
48 // Type 'string_options' means that the group is evaluated by
49 // string values separated by comma; for example, param=opt1,opt2
50 // If all options are selected they are replaced by the term "all".
51 // The filters are the values for the parameter defined by the group.
52 // ** In this case, the parameter name is the group name. **
53 type
: 'string_options',
59 label
: mw
.msg( 'rcfilters-filter-userExpLevel-newcomer-label' ),
60 description
: mw
.msg( 'rcfilters-filter-userExpLevel-newcomer-description' ),
61 conflicts
: [ 'hideanons' ],
62 'class': 'mw-changeslist-user-newcomer'
66 label
: mw
.msg( 'rcfilters-filter-userExpLevel-learner-label' ),
67 description
: mw
.msg( 'rcfilters-filter-userExpLevel-learner-description' ),
68 conflicts
: [ 'hideanons' ],
69 'class': 'mw-changeslist-user-learner'
73 label
: mw
.msg( 'rcfilters-filter-userExpLevel-experienced-label' ),
74 description
: mw
.msg( 'rcfilters-filter-userExpLevel-experienced-description' ),
75 conflicts
: [ 'hideanons' ],
76 'class': 'mw-changeslist-user-experienced'
81 title
: mw
.msg( 'rcfilters-filtergroup-authorship' ),
82 // Type 'send_unselected_if_any' means that the controller will go over
83 // all unselected filters in the group and use their parameters
84 // as truthy in the query string.
85 // This is to handle the "negative" filters. We are showing users
86 // a positive message ("Show xxx") but the filters themselves are
87 // based on "hide YYY". The purpose of this is to correctly map
88 // the functionality to the UI, whether we are dealing with 2
89 // parameters in the group or more.
90 type
: 'send_unselected_if_any',
95 label
: mw
.msg( 'rcfilters-filter-editsbyself-label' ),
96 description
: mw
.msg( 'rcfilters-filter-editsbyself-description' ),
97 'class': 'mw-changeslist-self'
100 name
: 'hidebyothers',
101 label
: mw
.msg( 'rcfilters-filter-editsbyother-label' ),
102 description
: mw
.msg( 'rcfilters-filter-editsbyother-description' ),
103 'class': 'mw-changeslist-others'
108 title
: mw
.msg( 'rcfilters-filtergroup-automated' ),
109 type
: 'send_unselected_if_any',
114 label
: mw
.msg( 'rcfilters-filter-bots-label' ),
115 description
: mw
.msg( 'rcfilters-filter-bots-description' ),
117 'class': 'mw-changeslist-bot'
121 label
: mw
.msg( 'rcfilters-filter-humans-label' ),
122 description
: mw
.msg( 'rcfilters-filter-humans-description' ),
124 'class': 'mw-changeslist-human'
129 title
: mw
.msg( 'rcfilters-filtergroup-significance' ),
130 type
: 'send_unselected_if_any',
135 label
: mw
.msg( 'rcfilters-filter-minor-label' ),
136 description
: mw
.msg( 'rcfilters-filter-minor-description' ),
137 'class': 'mw-changeslist-minor'
141 label
: mw
.msg( 'rcfilters-filter-major-label' ),
142 description
: mw
.msg( 'rcfilters-filter-major-description' ),
143 'class': 'mw-changeslist-major'
148 title
: mw
.msg( 'rcfilters-filtergroup-changetype' ),
149 type
: 'send_unselected_if_any',
153 name
: 'hidepageedits',
154 label
: mw
.msg( 'rcfilters-filter-pageedits-label' ),
155 description
: mw
.msg( 'rcfilters-filter-pageedits-description' ),
157 'class': 'mw-changeslist-src-mw-edit'
161 name
: 'hidenewpages',
162 label
: mw
.msg( 'rcfilters-filter-newpages-label' ),
163 description
: mw
.msg( 'rcfilters-filter-newpages-description' ),
165 'class': 'mw-changeslist-src-mw-new'
168 name
: 'hidecategorization',
169 label
: mw
.msg( 'rcfilters-filter-categorization-label' ),
170 description
: mw
.msg( 'rcfilters-filter-categorization-description' ),
172 'class': 'mw-changeslist-src-mw-categorize'
176 label
: mw
.msg( 'rcfilters-filter-logactions-label' ),
177 description
: mw
.msg( 'rcfilters-filter-logactions-description' ),
179 'class': 'mw-changeslist-src-mw-log'
185 // eslint-disable-next-line no-new
186 new mw
.rcfilters
.ui
.FormWrapperWidget(
187 filtersModel
, changesListModel
, controller
, $( 'fieldset.rcoptions' ) );
189 $( '.rcfilters-container' ).append( filtersWidget
.$element
);
190 $( 'body' ).append( $overlay
);
193 $( '.rcfilters-head' ).addClass( 'mw-rcfilters-ui-ready' );
195 window
.addEventListener( 'popstate', function () {
196 controller
.updateStateBasedOnUrl();
197 controller
.updateChangesList();
200 $( 'a.mw-helplink' ).attr(
202 'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:New_filters_for_edit_review'
205 controller
.replaceUrl();
211 module
.exports
= rcfilters
;
213 }( mediaWiki
, jQuery
) );