16,874
个编辑
LLWiki正在建设中,欢迎加入我们!
小 |
(安全性修改) |
||
/*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) {
$('<div>', {class: "portal", role: "navigation"}).append( $('<h3>', {text: wgULS('自定义', '定製')}) )▼
menu.children().append( data.map(function(entry) {
.append(menu).appendTo( "#mw-panel" );▼
return $('<li>', {html: $('<a>', {
text: entry.text,
else {▼
href: entry.title ? mw.util.getUrl( entry.title ) : entry.href
})});
}) );
}
return $('<li>', {html: $('<a>', {
console.log('Hook: mobile.menu,开始添加自定义菜单');▼
href: entry.title ? mw.util.getUrl( entry.title ) : entry.href,
$content.find( ".hlist" ).before( menu.children() );▼
html: [$('<i>', {class: entry.icon || 'fa fa-arrow-circle-right'}), $('<span>', {text: entry.text})]
})});
}) );
▲ }, cache: setting.cache !== false});
mw.hook( 'mobile.menu' ).add(function($content) {
});
}
});
});
// [[category:编辑工具]] [[category:需要用户权限的小工具]] [[category:桌面版小工具]] [[category:手机版小工具]] [[category:作为模块的小工具]]
|