MediaWiki:Mobile.js:修订间差异
跳转到导航
跳转到搜索
无编辑摘要 标签:移动版编辑 移动版网页编辑 |
无编辑摘要 标签:移动版编辑 移动版网页编辑 |
||
| 第7行: | 第7行: | ||
var navbar = function (data, textStatus, jqxhr) { | var navbar = function (data, textStatus, jqxhr) { | ||
var navlist = data.parse.text["*"]; | var navlist = data.parse.text["*"]; | ||
console.log(navlist); | |||
}; | }; | ||
var mfSidebar = function () { | var mfSidebar = function () { | ||
2025年9月16日 (二) 13:41的版本
/* 这里的任何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('https://cdn.bootcdn.net/ajax/libs/font-awesome/7.0.0/css/all.min.css',"text/css");
var navbar = function (data, textStatus, jqxhr) {
var navlist = data.parse.text["*"];
console.log(navlist);
};
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();
});