MediaWiki:Mobile.js: Difference between revisions

Want an adless experience? Log in or Create an account.
no edit summary
(add required js for toggle and tabs to mobile)
No edit summary
Line 15: Line 15:
   ga('send', 'pageview');
   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-minerva-watchlist"> \
                      <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-minerva-watchlist"> \
                      <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