2 * JavaScript for Special:RecentChanges
12 var model
= new mw
.rcfilters
.dm
.FiltersViewModel(),
13 controller
= new mw
.rcfilters
.Controller( model
),
14 widget
= new mw
.rcfilters
.ui
.FilterWrapperWidget( controller
, model
);
16 model
.initializeFilters( {
18 title
: mw
.msg( 'rcfilters-filtergroup-authorship' ),
19 // Type 'send_unselected_if_any' means that the controller will go over
20 // all unselected filters in the group and use their parameters
21 // as truthy in the query string.
22 // This is to handle the "negative" filters. We are showing users
23 // a positive message ("Show xxx") but the filters themselves are
24 // based on "hide YYY". The purpose of this is to correctly map
25 // the functionality to the UI, whether we are dealing with 2
26 // parameters in the group or more.
27 type
: 'send_unselected_if_any',
31 label
: mw
.msg( 'rcfilters-filter-editsbyself-label' ),
32 description
: mw
.msg( 'rcfilters-filter-editsbyself-description' )
36 label
: mw
.msg( 'rcfilters-filter-editsbyother-label' ),
37 description
: mw
.msg( 'rcfilters-filter-editsbyother-description' )
43 $( '.mw-specialpage-summary' ).after( widget
.$element
);
46 controller
.initialize();
48 $( '.rcoptions form' ).submit( function () {
49 var $form
= $( this );
51 // Get current filter values
52 $.each( model
.getParametersFromFilters(), function ( paramName
, paramValue
) {
53 var $existingInput
= $form
.find( 'input[name=' + paramName
+ ']' );
54 // Check if the hidden input already exists
55 // This happens if the parameter was already given
57 if ( $existingInput
.length
) {
59 $existingInput
.val( paramValue
);
61 // Append hidden fields with filter values
64 .attr( 'type', 'hidden' )
65 .attr( 'name', paramName
)
71 // Continue the submission process
79 module
.exports
= rcfilters
;
81 }( mediaWiki
, jQuery
) );