diff --git a/includes/SkinVector.php b/includes/SkinVector.php
index 6eb807e2..0aa3108a 100644
--- a/includes/SkinVector.php
+++ b/includes/SkinVector.php
@@ -843,6 +843,7 @@ abstract class SkinVector extends SkinMustache {
$type = self::MENU_TYPE_DROPDOWN;
break;
case 'data-views':
+ case 'data-associated-pages':
case 'data-namespaces':
$type = self::MENU_TYPE_TABS;
break;
diff --git a/includes/templates/ArticleToolbar.mustache b/includes/templates/ArticleToolbar.mustache
index b7125533..0a8fa2fb 100644
--- a/includes/templates/ArticleToolbar.mustache
+++ b/includes/templates/ArticleToolbar.mustache
@@ -3,7 +3,7 @@
{{#data-portlets}}
- {{#data-namespaces}}{{>Menu}}{{/data-namespaces}}
+ {{#data-associated-pages}}{{>Menu}}{{/data-associated-pages}}
{{#data-variants}}{{>Menu}}{{/data-variants}}
diff --git a/resources/skins.vector.js/skin.js b/resources/skins.vector.js/skin.js
index 5e655a60..ec2b4132 100644
--- a/resources/skins.vector.js/skin.js
+++ b/resources/skins.vector.js/skin.js
@@ -36,6 +36,32 @@ function enableCssAnimations( document ) {
document.documentElement.classList.add( 'vector-animations-ready' );
}
+/**
+ * In https://phabricator.wikimedia.org/T313409 #p-namespaces was renamed to #p-associatedPages
+ * This code maps items added by gadgets to the new menu.
+ * This code can be removed in MediaWiki 1.40.
+ */
+function addNamespacesGadgetSupport() {
+ // Set up hidden dummy portlet.
+ var dummyPortlet = document.createElement( 'div' );
+ dummyPortlet.setAttribute( 'id', 'p-namespaces' );
+ dummyPortlet.setAttribute( 'style', 'display: none;' );
+ dummyPortlet.appendChild( document.createElement( 'ul' ) );
+ document.body.appendChild( dummyPortlet );
+ mw.hook( 'util.addPortletLink' ).add( function ( /** @type {Element} */ node ) {
+ // If it was added to p-namespaces, show warning and move.
+ // eslint-disable-next-line no-jquery/no-global-selector
+ if ( $( '#p-namespaces' ).find( node ).length ) {
+ // eslint-disable-next-line no-jquery/no-global-selector
+ $( '#p-associated-pages ul' ).append( node );
+ // @ts-ignore
+ mw.log.warn( 'Please update call to mw.util.addPortletLink with ID p-namespaces. Use p-associatedPages instead.' );
+ // in case it was empty before:
+ mw.util.showPortlet( 'p-associated-pages' );
+ }
+ } );
+}
+
/**
* @param {Window} window
* @return {void}
@@ -47,6 +73,7 @@ function main( window ) {
initSearchLoader( document );
languageButton();
dropdownMenus();
+ addNamespacesGadgetSupport();
}
/**
diff --git a/skin.json b/skin.json
index 0f90a9ea..841cca02 100644
--- a/skin.json
+++ b/skin.json
@@ -41,6 +41,16 @@
"skin-vector",
"skin-vector-search-vue"
],
+ "menus": [
+ "user-interface-preferences",
+ "user-page",
+ "user-menu",
+ "notifications",
+ "views",
+ "actions",
+ "variants",
+ "associated-pages"
+ ],
"scripts": [
"skins.vector.user",
"skins.vector.js",