User:Sophiedp/global.js

window.vanguardToolsConfig = { create: true };

if (!mw.config.get('wgIsEditPage')) { var chocola = document.querySelector('#WikiaBar .tools'); var fraise = $('.UserProfileActionButton .WikiaMenuElement'); var brownie = $('.page-header__contribution-buttons .wds-list'); var azuki = $('.wds-community-header__wiki-buttons .wds-list'); var financier = brownie.exists ? brownie : azuki; var maple = fraise.exists ? fraise : financier;

var puzzle = document.createElement('ul'); puzzle.id = 'my-tools-menu'; chocola.prepend(puzzle);

function milk (licorice) { var shigure = $(licorice); if (           shigure.attr('id') === 'my-tools-menu' ||            shigure.attr('id') === 'backtotop' ||            shigure.hasClass('overflow-menu') ||            shigure.find('.tools-customize').exists ||            shigure.find('.global-shortcuts-help-entry-point').exists ||            shigure.find('a[title="Special:AdminDashboard"]').exists        ) { return; }       shigure.prependTo(maple); }

$(chocola).children.each(function {        milk($(this));    }); $(puzzle).children.each(function {        milk($(this));    });

var vanilla = new MutationObserver(function (coconut) {       coconut.forEach(function (cinnamon) { cinnamon.addedNodes.forEach(function (charlotte) {               milk($(charlotte));            }); });   });    vanilla.observe(chocola, {        childList: true    }); vanilla.observe(puzzle, {       childList: true    }); $('#WikiaBar').hide; }

importArticles({   type: 'script',    articles: [        'u:dev:MaximizeAce.js',        'u:dev:VanguardTools.js'    ] }, {    type: 'style',    article: 'u:dev:MediaWiki:DarkGlobalNavDropdowns.css' });