Merge "resourceloader: Simplify StringSet fallback"
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / mw.rcfilters.UriProcessor.js
index 7bb0a22..5344af4 100644 (file)
@@ -1,12 +1,22 @@
-( function ( mw, $ ) {
+( function () {
        /* eslint no-underscore-dangle: "off" */
        /**
         * URI Processor for RCFilters
         *
+        * @class
+        *
+        * @constructor
         * @param {mw.rcfilters.dm.FiltersViewModel} filtersModel Filters view model
+        * @param {Object} [config] Configuration object
+        * @cfg {boolean} [normalizeTarget] Dictates whether or not to go through the
+        *  title normalization to separate title subpage/parts into the target= url
+        *  parameter
         */
-       mw.rcfilters.UriProcessor = function MwRcfiltersController( filtersModel ) {
+       mw.rcfilters.UriProcessor = function MwRcfiltersController( filtersModel, config ) {
+               config = config || {};
                this.filtersModel = filtersModel;
+
+               this.normalizeTarget = !!config.normalizeTarget;
        };
 
        /* Initialization */
                        // matches [/wiki/]SpecialNS:RCL/[Namespace:]Title/Subpage/Subsubpage/etc
                        re = /^((?:\/.+?\/)?.*?:.*?)\/(.*)$/;
 
+               if ( !this.normalizeTarget ) {
+                       return uri;
+               }
+
                // target in title param
                if ( uri.query.title ) {
                        parts = uri.query.title.match( re );
                        { urlversion: '2' }
                );
        };
-}( mediaWiki, jQuery ) );
+}() );