MediaWiki:Minerva.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* All JavaScript here will be loaded for users of the MinervaNeue skin */ /* Additional menu links */ /* https://www.mediawiki.org/wiki/Topic:Vqy1kx6q4e0bzvyb */ var timer = setInterval(function() { if ($('.menu ul:first').length) { // Check if mobile menu exists console.log("mobile menu exists"); clearInterval(timer); if (!$('#p-interaction').length) { // Add "Recent changes" link if it doesn't already exist console.log(true) $('#p-navigation').append( '<li class="toggle-list-item"> \ <a class="toggle-list-item__anchor" href="/Special:RecentChanges" class="menu__item--recentchanges" data-mw="interface" data-event-name="menu.recentchanges"> \ <span class="minerva-icon minerva-icon--history-base20"></span> \ <span class="toggle-list-item__label">Recent changes</span> \ </a> \ </li>' ); } else { // Modify menu links // "Recent changes" link $('#p-interaction li:first').appendTo('#p-navigation'); // Move link to top of menu $('#p-navigation li:last a span:first').removeClass('minerva-icon--recentChanges').addClass('minerva-icon--history-base20'); // Replace icon // "Special pages" and "Community portal" links $('#p-interaction').remove(); // Remove links } $('.menu ul:first').after( // Add custom links to mobile menu '<ul class="level1 toggle-list__list"> \ <li class="toggle-list-item"> \ <button class="toggle-list-item__anchor"> \ <span class="minerva-icon dropdown-icon"></span> \ <span class="toggle-list-item__label">Wiki</span> \ </button> \ </li> \ <ul class="level2 toggle-list__list"> \ <li class="toggle-list-item"> \ <a href="/Toontown Rewritten:About" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">About us</span> \ </a> \ </li> \ <li class="toggle-list-item"> \ <a href="/Toontown Rewritten:FAQ" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">FAQ</span> \ </a> \ </li> \ <li class="toggle-list-item"> \ <a href="/Toontown Rewritten:Policy" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">Policy</span> \ </a> \ </li> \ <li class="toggle-list-item"> \ <a href="/Toontown Rewritten:Style_manual" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">Style manual</span> \ </a> \ </li> \ <li class="toggle-list-item"> \ <a href="/Toontown Rewritten:Migration" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">Migration</span> \ </a> \ </li> \ </ul> \ </ul> \ <ul class="level1 toggle-list__list"> \ <li class="toggle-list-item"> \ <button class="toggle-list-item__anchor"> \ <span class="minerva-icon dropdown-icon"></span> \ <span class="toggle-list-item__label">Toontown</span> \ </button> \ </li> \ <ul class="level2 toggle-list__list"> \ <li class="toggle-list-item"> \ <a href="/Toons" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">Toons</span> \ </a> \ </li> \ <li class="toggle-list-item"> \ <a href="/Cogs" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">Cogs</span> \ </a> \ </li> \ <li class="toggle-list-item"> \ <a href="/Gags" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">Gags</span> \ </a> \ </li> \ <li class="toggle-list-item"> \ <a href="/ToonTask" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">ToonTasks</span> \ </a> \ </li> \ <li class="toggle-list-item"> \ <a href="/Category:Locations" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">Locations</span> \ </a> \ </li> \ <li class="toggle-list-item"> \ <a href="/Category:Activities" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">Activities</span> \ </a> \ </li> \ </ul> \ </ul> \ <ul class="level1 toggle-list__list"> \ <li class="toggle-list-item"> \ <button class="toggle-list-item__anchor"> \ <span class="minerva-icon dropdown-icon"></span> \ <span class="toggle-list-item__label">More Toontown</span> \ </button> \ </li> \ <ul class="level2 toggle-list__list"> \ <li class="toggle-list-item"> \ <a href="/Category:Toontown_Rewritten_blog_posts" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">Blog posts</span> \ </a> \ </li> \ <li class="toggle-list-item"> \ <a href="/Category:Toontown_Rewritten_release_notes" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">Release notes</span> \ </a> \ </li> \ <li class="toggle-list-item"> \ <a href="/Toontown_Rewritten_Team" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">Toontown Rewritten Team</span> \ </a> \ </li> \ <li class="toggle-list-item"> \ <a href="/Toontown_Partner_Program" class="toggle-list-item__anchor"> \ <span class="minerva-icon minerva-icon--mapPin"></span> \ <span class="toggle-list-item__label">Toontown Partner Program</span> \ </a> \ </li> \ </ul> \ </ul>' ); $(".menu").find(".level2").hide(); // hide level2 until level1 is clicked $('.level1 > li > a').click(function(event){ $('#main-menu-input').prop('checked', true); }); // Prevent mobile menu from closing when clicking on dropdown level1 $('.level1').click(function(event){ if (!$(this).hasClass('dropdownOpen')) { $(this).addClass('dropdownOpen'); } else { $(this).removeClass('dropdownOpen'); } $(this).find(".level2").slideToggle(500); }); // if level1 is clicked, dropdown level2 } }, 100); // check every 100ms