User:Startus/common.js: Difference between revisions

From TestWiki
Content added Content deleted
(Uninstalling User:Evad37/OneClickArchiver.js, loaded from en.wikipedia (script-installer))
Tag: Reverted
m (Dmehus moved page User:Magogre/common.js to User:Startus/common.js without leaving a redirect: Automatically moved page while renaming the user "Magogre" to "Startus")
 
(3 intermediate revisions by one other user not shown)
Line 60: Line 60:
}
}
}, 100); // check every 100ms
}, 100); // check every 100ms
mw.messages.set({
//OneClickArchiver
// Set localised messages
});
mw.loader.load('https://en.wikipedia.org/w/load.php?modules=ext.gadget.dark-mode-toggle&only=scripts');

Latest revision as of 02:05, 6 March 2022

/*Adapted from [[dev:ManageWiki/MobileSidebar]] developed by [[User:Yahya]]*/
/* 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>Useful Links</span> \
                    </a> \
                    </li> \
                    <ul class="level2"> \
                         <li> \
                         <a href="/wiki/TestWiki:Community portal" \
                         class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-edit-base20"> \
                         <span>Community portal</span> \
                         </a> \
                         </li> \
                         <li> \
                         <a href="/wiki/TestWiki:Request permissions" \
                         class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
                         <span>Request permissions</span> \
                         </a> \
                         </li> \
                         <li> \
                         <a href="/wiki/Special:SpecialPages" \
                         class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-editLock-base20"> \
                         <span>SpecialPages</span> \
                         </a> \
                         </li> \
                         <li> \
                         <a href="/wiki/Special:Translate" \
                         class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-editLock-base20"> \
                         <span>Translate</span> \
                         </a> \
                         </li> \
                         <li> \
                         <a href="/wiki/Special:PageTranslation" \
                         class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-editLock-base20"> \
                         <span>PageTranslation</span> \
                         </a> \
                         </li> \
                         <li> \
                         <a href="/wiki/Special:RecentChanges" \
                         class="mw-ui-icon mw-ui-icon-before"> \
                         <span>RecentChanges</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
mw.messages.set({
    // Set localised messages
});
mw.loader.load('https://en.wikipedia.org/w/load.php?modules=ext.gadget.dark-mode-toggle&only=scripts');