| 1 |
const |
| 2 |
TABS_SELECTOR = '.vector-menu-tabs', |
| 3 |
LIST_ITEM_JS_SELECTOR = '.mw-list-item-js', |
| 4 |
NO_ICON_CLASS = 'vector-tab-noicon'; |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
function addNoIconClass( item ) { |
| 13 |
item.classList.add( NO_ICON_CLASS ); |
| 14 |
} |
| 15 |
|
| 16 |
function init() { |
| 17 |
|
| 18 |
Array.prototype.forEach.call( |
| 19 |
document.querySelectorAll( TABS_SELECTOR + ' ' + LIST_ITEM_JS_SELECTOR ), |
| 20 |
addNoIconClass |
| 21 |
); |
| 22 |
|
| 23 |
mw.hook( 'util.addPortletLink' ).add( |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
( item ) => { |
| 28 |
|
| 29 |
if ( item.closest( TABS_SELECTOR ) ) { |
| 30 |
addNoIconClass( item ); |
| 31 |
} |
| 32 |
} ); |
| 33 |
} |
| 34 |
|
| 35 |
module.exports = init; |