MediaWiki:Mobile.js
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5。
/* 这里的任何JavaScript将为使用移动版网站的用户加载 */
/* Add to MediaWiki:Mobile.js for custom Mobile Menu links
for MW-1.34.2 with MobileFrontend and MinervaNeue
Just replace span text and href to add links */
mw.loader.using('/extensions/FontAwesome/res/fontawesome/js/fontawesome.js');
mw.loader.using('/extensions/FontAwesome/res/fontawesome/js/solid.js');
var navbar = function (data, textStatus, jqxhr) {
var navlist = data.parse.text["*"];
$(navlist).insertBefore(".menu > .hlist")
};
var mfSidebar = function () {
var purl = "/api.php?action=parse&text={{Template:置顶页面|sidebar}}&format=json";
$.ajax({
url: purl,
success: navbar,
error: function () {
console.error("can\'t load customized navmenu")
},
dataType: "json"
});
};
$(function () {
mfSidebar();
});
mw.loader.using('mobile.site.styles');
if ($('.menu ul:first').length) {
console.log("mobile menu exists");
$('.menu ul:first').after(
'<ul id="p-otherlink" class="toggle-list__list"> \
<li class="toggle-list-item"> \
<a class="toggle-list-item__anchor menu__item--link1" href="https://discuss.jjjstudent.com" data-mw="interface"> \
<i class="fa fa-users" style="width: 20px; height: 20px; color: var(--color-subtle,#54595d); margin-right: 8px; line-height: inherit; text-align: center;"></i> \
<span class="toggle-list-item__label">论坛</span> \
</a> \
</li> \
<li class="toggle-list-item"> \
<a class="toggle-list-item__anchor menu__item--link2" href="https://old.jjjstudent.com" data-mw="interface"> \
<i class="fa fa-archive" style="width: 20px; height: 20px; color: var(--color-subtle,#54595d); margin-right: 8px; line-height: inherit; text-align: center;"></i> \
<span class="toggle-list-item__label">文档存档</span> \
</a> \
</li> \
</ul>'
);
};
if ($('.mw-collapsible')[0]) mw.loader.using('jquery.makeCollapsible').then(function () {
//console.debug('jquery.makeCollapsible is loaded.');
$('.mw-collapsible').makeCollapsible();
});