MediaWiki:Mobile.js: Difference between revisions

From Zelda Dungeon Wiki
Jump to navigation Jump to search
Want an adless experience? Log in or Create an account.
No edit summary
No edit summary
Line 26: Line 26:
                       <li> \
                       <li> \
                       <a href="#" \
                       <a href="#" \
                             class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-watchlist"> \
                             class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-star-base20"> \
                       <span>Tears of the Kingdom</span> \
                       <span>Tears of the Kingdom</span> \
                       </a> \
                       </a> \
Line 54: Line 54:
                       <li> \
                       <li> \
                       <a href="/breath-of-the-wild-walkthrough/" \
                       <a href="/breath-of-the-wild-walkthrough/" \
                             class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-watchlist"> \
                             class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-star-base20"> \
                       <span>Breath of the Wild Walkthrough</span> \
                       <span>Breath of the Wild Walkthrough</span> \
                       </a> \
                       </a> \

Revision as of 06:20, November 20, 2023

/* Any JavaScript here will be loaded for users using the mobile site */

mw.loader.load( '/wiki/index.php?title=MediaWiki:Toggle.js&action=raw&ctype=text/javascript' );
mw.loader.load( '/wiki/index.php?title=MediaWiki:Tabs.css&action=raw&ctype=text/css', 'text/css' );
mw.loader.load( '/wiki/index.php?title=MediaWiki:Tabs.js&action=raw&ctype=text/javascript' );
mw.loader.load( '/wiki/index.php?title=MediaWiki:Tabs2.js&action=raw&ctype=text/javascript' );

/* Implements Google Analytics in mobile view */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-1872892-1', 'auto');
  ga('send', 'pageview');
/*  */

/* Custom Mobile Menu links with MobileFrontend and MinervaNeue  */
   
  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-wikimedia-star-base20"> \
                      <span>Tears of the Kingdom</span> \
                      </a> \
                      </li> \
                      <ul class ="level2"> \
                           <li> \
                           <a href="/tears-of-the-kingdom-walkthrough/" \
                                 class="mw-ui-icon mw-ui-icon-before"> \
                           <span>Walkthroughs</span> \
                           </a> \
                           </li> \
                           <li> \
                           <a href="/tears-of-the-kingdom-interactive-map/" \
                                 class="mw-ui-icon mw-ui-icon-before"> \
                           <span>Interactive Map</span> \
                           </a> \
                           </li> \
                           <li> \
                           <a href="/wiki/Category:Tears_of_the_Kingdom_Shrines" \
                                 class="mw-ui-icon mw-ui-icon-before"> \
                           <span>Shrines</span> \
                           </a> \
                           </li> \
                      </ul> \
                 </ul> \
                 <ul> \
                      <li> \
                      <a href="/breath-of-the-wild-walkthrough/" \
                            class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-star-base20"> \
                      <span>Breath of the Wild Walkthrough</span> \
                      </a> \
                      </li> \
                 </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