LLWiki正在建设中,欢迎加入我们

“MediaWiki:Gadget-custommenu.js”的版本间差异

跳转到导航 跳转到搜索
添加1,073字节 、​ 2023年3月17日 (五) 13:23
// 使用Wikiplus小工具快速编辑
(安全性修改)
(// 使用Wikiplus小工具快速编辑)
标签移动版网页编辑 移动版编辑
 
(未显示同一用户的3个中间版本)
cache: setting.cache !== false
}).then(function(data) {
const api = new mw.Api(),
dynamicList = data.dynamic ? data.dynamic.map(function(query) {
if (query.type == 'prefixindex') {
return mw.timedQuery(api, {list: 'allpages', apprefix: query.prefix, apnamespace: query.ns})
.then(function(res) {
return res.query.allpages.map(function(page) {
return {text: page.title, title: page.title};
});
});
}
}) : [];
if (skin == 'vector') {
menu.children().append( data.static.map(function(entry) {
return $('<li>', {html: $('<a>', {
text: entry.text,
})});
}) );
Promise.allSettled( dynamicList ).then(function(lists) {
$('<div>', {class: "portal", role: "navigation"}).append( $('<h3>', {text: wgULS('自定义', '定製')}) )
menu.append( lists.filter(function(ele) { return ele.status == 'fulfilled'; }).map(function(ele) {
.append(menu).appendTo( "#mw-panel" );
return $('<ul>', {html: ele.value.map(function(entry) {
return $('<li>', {html: $('<a>', {text: entry.text, href: mw.util.getUrl( entry.title )})});
})});
}) );
$('<div>', {class: "portal", role: "navigation"}).append( $('<h3>', {text: wgULS('自定义', '定製')}) )
.append(menu).appendTo( "#mw-panel" );
});
}
else {
menu.children().append( data.static.map(function(entry) {
return $('<li>', {html: $('<a>', {
href: entry.title ? mw.util.getUrl( entry.title ) : entry.href,
html: [$('<i>', {class: entry.icon || 'fa fa-arrow-circle-right'}), $('<span>', {text: entry.text})]
html: $('<span>', {text: entry.text})
})});
}) );
mwPromise.hookallSettled( 'mobile.menu'dynamicList ).addthen(function($contentlists) {
menu.append( lists.filter(function(ele) { return ele.status == 'fulfilled'; }).map(function(ele) {
console.log('Hook: mobile.menu,开始添加自定义菜单');
return $('<ul>', {html: ele.value.map(function(entry) {
$content.find( ".hlist" ).before( menu.children() );
return $('<li>', {html: $('<a>', {
href: mw.util.getUrl( entry.title ),
class: 'fa fa-arrow-circle-right',
html: $('<span>', {text: entry.text})
})});
})});
}) );
$content('#mw-mf-page-left').find( ".hlist" ).before( menu.children() );
});
}
16,874

个编辑

导航菜单