Difference between revisions of "MediaWiki:Mobile.js"
Jump to navigation
Jump to search
(Replaced content with "→Any JavaScript here will be loaded for users using the mobile site: ") Tag: Replaced |
|||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | / | + | 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>Categories</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <ul class="level2"> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/Amateur_Radio" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Amateur Radio</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/Automotive" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Automotive</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/Entertainment" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Entertainment</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/Home" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Home</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/Industrial" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Industrial</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/Wearable" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Wearable</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | </ul> \ | ||
+ | </ul> \ | ||
+ | <ul class="level1"> \ | ||
+ | <li> \ | ||
+ | <a href="#" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-mf-expand mw-ui-icon-small"> \ | ||
+ | <span>Reversing Tools</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <ul class="level2"> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/Basic_Tools" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Basic</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/Electronic_Tools" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Electronic</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/Mechanical_Tools" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Mechanical</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/Software_Tools" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Software</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | </ul> \ | ||
+ | </ul> \ | ||
+ | <ul class="level1"> \ | ||
+ | <li> \ | ||
+ | <a href="#" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-mf-expand mw-ui-icon-small"> \ | ||
+ | <span>Resources</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <ul class="level2"> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/Literature" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Literature</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/Video" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Video</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/Conferences" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Conferences</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/People" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>People</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <li> \ | ||
+ | <a href="https://wiki.recessim.com/view/Other_Sites" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Other Sites</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | </ul> \ | ||
+ | </ul> \ | ||
+ | <ul class="level1"> \ | ||
+ | <li> \ | ||
+ | <a href="#" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-mf-expand mw-ui-icon-small"> \ | ||
+ | <span>Social</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <ul class="level2"> \ | ||
+ | <li> \ | ||
+ | <a href="https://www.youtube.com/c/RECESSIM" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>YouTube</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <li> \ | ||
+ | <a href="https://twitter.com/RECESSIM_" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Twitter</span> \ | ||
+ | </a> \ | ||
+ | </li> \ | ||
+ | <li> \ | ||
+ | <a href="https://discord.gg/3ebeyMP" \ | ||
+ | class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ | ||
+ | <span>Chat</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 |
Latest revision as of 15:31, 5 November 2022
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>Categories</span> \
</a> \
</li> \
<ul class="level2"> \
<li> \
<a href="https://wiki.recessim.com/view/Amateur_Radio" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Amateur Radio</span> \
</a> \
</li> \
<li> \
<a href="https://wiki.recessim.com/view/Automotive" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Automotive</span> \
</a> \
</li> \
<li> \
<a href="https://wiki.recessim.com/view/Entertainment" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Entertainment</span> \
</a> \
</li> \
<li> \
<a href="https://wiki.recessim.com/view/Home" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Home</span> \
</a> \
</li> \
<li> \
<a href="https://wiki.recessim.com/view/Industrial" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Industrial</span> \
</a> \
</li> \
<li> \
<a href="https://wiki.recessim.com/view/Wearable" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Wearable</span> \
</a> \
</li> \
</ul> \
</ul> \
<ul class="level1"> \
<li> \
<a href="#" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-mf-expand mw-ui-icon-small"> \
<span>Reversing Tools</span> \
</a> \
</li> \
<ul class="level2"> \
<li> \
<a href="https://wiki.recessim.com/view/Basic_Tools" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Basic</span> \
</a> \
</li> \
<li> \
<a href="https://wiki.recessim.com/view/Electronic_Tools" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Electronic</span> \
</a> \
</li> \
<li> \
<a href="https://wiki.recessim.com/view/Mechanical_Tools" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Mechanical</span> \
</a> \
</li> \
<li> \
<a href="https://wiki.recessim.com/view/Software_Tools" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Software</span> \
</a> \
</li> \
</ul> \
</ul> \
<ul class="level1"> \
<li> \
<a href="#" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-mf-expand mw-ui-icon-small"> \
<span>Resources</span> \
</a> \
</li> \
<ul class="level2"> \
<li> \
<a href="https://wiki.recessim.com/view/Literature" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Literature</span> \
</a> \
</li> \
<li> \
<a href="https://wiki.recessim.com/view/Video" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Video</span> \
</a> \
</li> \
<li> \
<a href="https://wiki.recessim.com/view/Conferences" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Conferences</span> \
</a> \
</li> \
<li> \
<a href="https://wiki.recessim.com/view/People" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>People</span> \
</a> \
</li> \
<li> \
<a href="https://wiki.recessim.com/view/Other_Sites" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Other Sites</span> \
</a> \
</li> \
</ul> \
</ul> \
<ul class="level1"> \
<li> \
<a href="#" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-mf-expand mw-ui-icon-small"> \
<span>Social</span> \
</a> \
</li> \
<ul class="level2"> \
<li> \
<a href="https://www.youtube.com/c/RECESSIM" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>YouTube</span> \
</a> \
</li> \
<li> \
<a href="https://twitter.com/RECESSIM_" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Twitter</span> \
</a> \
</li> \
<li> \
<a href="https://discord.gg/3ebeyMP" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>Chat</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