ManageWiki/Mobile sidebar

From Miraheze Developers Wiki
ManageWiki links added onto the sidebar of the mobile skin

This follow JS snippet allows you to add the add ManageWiki settings dropdown menu to the mobile sidebar (navigation). You can place this code on your wikis MediaWiki:Group-bureaucrat.js page (which will make it load only for Bureaucrats) or you can also add it to your common.js page, or your personal global.js page. Credit to Yahya for this.

/* Main function */
var timer = setInterval(function() {
     if ($('.menu ul:first').length) {
         console.log("mobile menu exists");
         clearInterval(timer);
         $('.menu ul:first').after(
             '<ul class="level1"> \
                    <li> \
                    <a href="#" \
                    class="mw-ui-icon mw-ui-icon-before mw-ui-icon-mf-expand mw-ui-icon-small"> \
                    <span>ManageWiki</span> \
                    </a> \
                    </li> \
                    <ul class="level2"> \
                         <li> \
                         <a href="/wiki/Special:ManageWiki/settings" \
                         class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-edit-base20"> \
                         <span>Additional settings</span> \
                         </a> \
                         </li> \
                         <li> \
                         <a href="/wiki/Special:ManageWiki/core" \
                         class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
                         <span>Core settings</span> \
                         </a> \
                         </li> \
                         <li> \
                         <a href="/wiki/Special:ManageWiki/permissions" \
                         class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-editLock-base20"> \
                         <span>Manage permissions</span> \
                         </a> \
                         </li> \
                         <li> \
                         <a href="/wiki/Special:ManageWiki/extensions" \
                         class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-editLock-base20"> \
                         <span>Manage extensions</span> \
                         </a> \
                         </li> \
						 <li> \
                         <a href="/wiki/Special:ManageWiki/namespaces" \
                         class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-editLock-base20"> \
                         <span>Manage namespaces</span> \
                         </a> \
                         </li> \
                    </ul> \
               </ul>'
      
          );
          $(".menu").find(".level2").hide(); // hide level2 until level1 is clicked
          $(".level1").click(function(event){ 
               $(this).find(".level2").slideToggle(500);
          }); // if level1 is clicked, dropdown level2
     }
}, 100); // check every 100ms