mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-14 19:26:42 +00:00
Drop p-namespaces backwards compatibility script
Bug: T347907 Change-Id: Ib2bec20315440f89a0ca375f0e2b65b7a041006d
This commit is contained in:
parent
319fd57e0f
commit
076f957c5d
|
@ -45,33 +45,6 @@ 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.
|
||||
const 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 ) {
|
||||
const namespaces = document.querySelector( '#p-namespaces' );
|
||||
// If it was added to p-namespaces, show warning and move.
|
||||
if ( namespaces && node.closest( '#p-namespaces' ) ) {
|
||||
const list = document.querySelector( '#p-associated-pages ul' );
|
||||
if ( list ) {
|
||||
list.appendChild( node );
|
||||
}
|
||||
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}
|
||||
|
@ -86,7 +59,6 @@ function main( window ) {
|
|||
// menuTabs should follow `dropdownMenus` as that can move menu items from a
|
||||
// tab menu to a dropdown.
|
||||
menuTabs();
|
||||
addNamespacesGadgetSupport();
|
||||
watchstar();
|
||||
limitedWidthToggle();
|
||||
// Initialize the search toggle for the main header only. The sticky header
|
||||
|
|
Loading…
Reference in a new issue