16,874
个编辑
LLWiki正在建设中,欢迎加入我们!
小 |
(// 使用Wikiplus小工具快速编辑) 标签:移动版网页编辑 移动版编辑 |
||
(未显示同一用户的5个中间版本) | |||
/*global mw, $, wgULS*/
const gadgets = mw.gadgets || {},
$(function () {
src = setting.src || 'user:'
$.get({
dataType: 'json',
▲ menu = $('<div>', {class: 'body'});
url: mw.util.getUrl(src, {action: 'raw', ctype: 'application/json'}),
}).then(function(data) {
if (skin == 'vector') {▼
const api = new mw.Api(),
$('<div>', {class: "portal", role: "navigation"}).append( $('<h3>', {text: wgULS('自定义', '定製')}) )▼
dynamicList = data.dynamic ? data.dynamic.map(function(query) {
.append(menu).appendTo( "#mw-panel" );▼
if (query.type == 'prefixindex') {
return mw.timedQuery(api, {list: 'allpages', apprefix: query.prefix, apnamespace: query.ns})
else {▼
.then(function(res) {
return res.query.allpages.map(function(page) {
return {text: page.title, title: page.title};
});
});
}
}) : [];
menu.children().append( data.static.map(function(entry) {
return $('<li>', {html: $('<a>', {
$content.find( ".hlist" ).before( menu.children() );▼
text: entry.text,
href: entry.title ? mw.util.getUrl( entry.title ) : entry.href
})});
▲ }, cache: setting.cache !== false});
}) );
Promise.allSettled( dynamicList ).then(function(lists) {
menu.append( lists.filter(function(ele) { return ele.status == 'fulfilled'; }).map(function(ele) {
return $('<ul>', {html: ele.value.map(function(entry) {
return $('<li>', {html: $('<a>', {text: entry.text, href: mw.util.getUrl( entry.title )})});
})});
}) );
});
}
menu.children().append( data.static.map(function(entry) {
return $('<li>', {html: $('<a>', {
href: entry.title ? mw.util.getUrl( entry.title ) : entry.href,
class: entry.icon || 'fa fa-arrow-circle-right',
html: $('<span>', {text: entry.text})
})});
}) );
Promise.allSettled( dynamicList ).then(function(lists) {
menu.append( lists.filter(function(ele) { return ele.status == 'fulfilled'; }).map(function(ele) {
return $('<ul>', {html: ele.value.map(function(entry) {
return $('<li>', {html: $('<a>', {
href: mw.util.getUrl( entry.title ),
class: 'fa fa-arrow-circle-right',
html: $('<span>', {text: entry.text})
})});
})});
}) );
});
}
});
});
// [[category:编辑工具]] [[category:需要用户权限的小工具]] [[category:桌面版小工具]] [[category:手机版小工具]] [[category:作为模块的小工具]]
|