Merge "Ability to create tests with nested modules"
[lhc/web/wiklou.git] / resources / src / mediawiki.widgets / mw.widgets.NamespaceInputWidget.js
index 4f1b874..aa0c739 100644 (file)
 
        /**
         * @private
+        * @param {Object} [config] Configuration options
+        * @return {Object[]} Dropdown options
         */
        mw.widgets.NamespaceInputWidget.prototype.getNamespaceDropdownOptions = function ( config ) {
                var options,
                        exclude = config.exclude || [],
-                       NS_MAIN = 0;
+                       mainNamespace = mw.config.get( 'wgNamespaceIds' )[ '' ];
 
                options = $.map( mw.config.get( 'wgFormattedNamespaces' ), function ( name, ns ) {
-                       if ( ns < NS_MAIN || exclude.indexOf( Number( ns ) ) !== -1 ) {
+                       if ( ns < mainNamespace || exclude.indexOf( Number( ns ) ) !== -1 ) {
                                return null; // skip
                        }
                        ns = String( ns );
-                       if ( ns === String( NS_MAIN ) ) {
+                       if ( ns === String( mainNamespace ) ) {
                                name = mw.message( 'blanknamespace' ).text();
                        }
                        return { data: ns, label: name };