*
* @constructor
* @param {Object} [config] Configuration options
- * @cfg {string|null} includeAllValue Value for "all namespaces" option, if any
+ * @cfg {string|null} [includeAllValue] Value for "all namespaces" option, if any
+ * @cfg {number[]} [exclude] List of namespace numbers to exclude from the selector
*/
mw.widgets.NamespaceInputWidget = function MwWidgetsNamespaceInputWidget( config ) {
// Configuration initialization
*/
mw.widgets.NamespaceInputWidget.prototype.getNamespaceDropdownOptions = function ( config ) {
var options,
- NS_MAIN = 0;
+ exclude = config.exclude || [],
+ mainNamespace = mw.config.get( 'wgNamespaceIds' )[ '' ];
options = $.map( mw.config.get( 'wgFormattedNamespaces' ), function ( name, ns ) {
- if ( ns < NS_MAIN ) {
+ 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 };