No edit summary |
No edit summary Tag: Reverted |
||
| Line 16: | Line 16: | ||
mw.log.warn('addPortletLink is deprecated on desktop and never implemented on mobile', 'More information on https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)#addPortletLink'); | mw.log.warn('addPortletLink is deprecated on desktop and never implemented on mobile', 'More information on https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)#addPortletLink'); | ||
} | } | ||
/* All JavaScript here will be loaded for users of the mobile site */ | |||
mw.loader.using('mobile.site.styles') | |||
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>Contribute</span> \ | |||
</a> \ | |||
</li> \ | |||
<ul class ="level2"> \ | |||
<li> \ | |||
<a href="/wiki/Bharatpedia:Help" \ | |||
class="mw-ui-icon mw-ui-icon-before"> \ | |||
<span>Help</span> \ | |||
</a> \ | |||
</li> \ | |||
<li> \ | |||
<a href="/wiki/Help:Introduction" \ | |||
class="mw-ui-icon mw-ui-icon-before"> \ | |||
<span>Contribute</span> \ | |||
</a> \ | |||
</li> \ | |||
<li> \ | |||
<a href="/wiki/Bharatpedia:Community_portal" \ | |||
class="mw-ui-icon mw-ui-icon-before"> \ | |||
<span>Community portal</span> \ | |||
</a> \ | |||
</li> \ | |||
<li> \ | |||
<a href="/wiki/Bharatpedia:Article_wizard/Referencing" \ | |||
class="mw-ui-icon mw-ui-icon-before"> \ | |||
<span>Create article</span> \ | |||
</a> \ | |||
</li> \ | |||
<li> \ | |||
<a href="/wiki/Special:UploadWizard" \ | |||
class="mw-ui-icon mw-ui-icon-before"> \ | |||
<span>Upload file</span> \ | |||
</a> \ | |||
</li> \ | |||
<li> \ | |||
</ul> \ | |||
</ul> \ | |||
<ul> \ | |||
<li> \ | |||
<a href="/wiki/Bharatpedia:Donate" \ | |||
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-watchlist"> \ | |||
<span>Donate</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 | |||
Revision as of 18:38, 1 November 2022
/* All JavaScript here will be loaded for users of the mobile site */
mw.loader.using('mobile.site.styles')
function importScript(name) {
/* - Disabled pending additional discussion
var $notification = $('<span>').html('An attempt to load a <a>user script</a> has failed. Please see JavaScript console for more information.');
$notification.find('a').attr('href', '/w/index.php?title=' + name );
mw.notify($notification);
*/
mw.log.warn('importScript is deprecated on desktop and never implemented on mobile', 'More information on https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)#importScript');
}
function importStylesheet(name) {
mw.log.warn('importStylesheet is deprecated on desktop and never implemented on mobile', 'More information on https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)#importStylesheet');
}
function addPortletLink() {
mw.log.warn('addPortletLink is deprecated on desktop and never implemented on mobile', 'More information on https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)#addPortletLink');
}
/* All JavaScript here will be loaded for users of the mobile site */
mw.loader.using('mobile.site.styles')
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>Contribute</span> \
</a> \
</li> \
<ul class ="level2"> \
<li> \
<a href="/wiki/Bharatpedia:Help" \
class="mw-ui-icon mw-ui-icon-before"> \
<span>Help</span> \
</a> \
</li> \
<li> \
<a href="/wiki/Help:Introduction" \
class="mw-ui-icon mw-ui-icon-before"> \
<span>Contribute</span> \
</a> \
</li> \
<li> \
<a href="/wiki/Bharatpedia:Community_portal" \
class="mw-ui-icon mw-ui-icon-before"> \
<span>Community portal</span> \
</a> \
</li> \
<li> \
<a href="/wiki/Bharatpedia:Article_wizard/Referencing" \
class="mw-ui-icon mw-ui-icon-before"> \
<span>Create article</span> \
</a> \
</li> \
<li> \
<a href="/wiki/Special:UploadWizard" \
class="mw-ui-icon mw-ui-icon-before"> \
<span>Upload file</span> \
</a> \
</li> \
<li> \
</ul> \
</ul> \
<ul> \
<li> \
<a href="/wiki/Bharatpedia:Donate" \
class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-watchlist"> \
<span>Donate</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