User:Startus/common.js: Difference between revisions
Content added Content deleted
(Uninstalling User:Evad37/OneClickArchiver.js, loaded from en.wikipedia (script-installer)) Tag: Reverted |
No edit summary Tags: Reverted Mobile edit Mobile web edit |
||
Line 60: | Line 60: | ||
} |
} |
||
}, 100); // check every 100ms |
}, 100); // check every 100ms |
||
//OneClickArchiver |
|||
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>Commons</span> \ |
|||
</a> \ |
|||
</li> \ |
|||
<ul class="level2"> \ |
|||
<li> \ |
|||
<a href="/wiki/Miraheze Commons:Community noticeboard" \ |
|||
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-edit-base20"> \ |
|||
<span>Community noticeboard</span> \ |
|||
</a> \ |
|||
</li> \ |
|||
<li> \ |
|||
<a href="/wiki/Project: Administrators\' noticeboard" \ |
|||
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \ |
|||
<span>AN</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> \ |
|||
</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 |
Revision as of 04:24, 10 November 2021
/*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
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>Commons</span> \
</a> \
</li> \
<ul class="level2"> \
<li> \
<a href="/wiki/Miraheze Commons:Community noticeboard" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-edit-base20"> \
<span>Community noticeboard</span> \
</a> \
</li> \
<li> \
<a href="/wiki/Project: Administrators\' noticeboard" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-mapPin"> \
<span>AN</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> \
</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