No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
"use strict"; | "use strict"; | ||
mw.loader.using(["mediawiki.ForeignApi"],$(function(){ | mw.loader.using(["mediawiki.ForeignApi","ext.gadget.jquery.ui"],$(function(){ | ||
//侧边栏添加工具箱 | //侧边栏添加工具箱 | ||
mw.util.addPortletLink("p-tb", "javascript:void(1);", "IA toolbox", "t-iatool", "interface-admin toolbox", null, "#t-specialpages"); | mw.util.addPortletLink("p-tb", "javascript:void(1);", "IA toolbox", "t-iatool", "interface-admin toolbox", null, "#t-specialpages"); |
"use strict";
mw.loader.using(["mediawiki.ForeignApi","ext.gadget.jquery.ui"],$(function(){
//侧边栏添加工具箱
mw.util.addPortletLink("p-tb", "javascript:void(1);", "IA toolbox", "t-iatool", "interface-admin toolbox", null, "#t-specialpages");
var $iatool = null;
var otherpage = '<a href="/Special:Gadget">Gadget Mainpage</a>\
| <a href="/MediaWiki:Gadgets-definition">Gadgets Definition</a>\
| <a href="/MediaWiki:WikiLove.js">WikiLove</a>';
var GHIA ='<a href="https://github.com/MoegirlPediaInterfaceAdmins/MoegirlPediaInterfaceCodes" target="_blank">Visit MoegirlPediaInterfaceCodes in GayHub</a>';
$("#t-iatool a").on("click", function() {
if ($iatool === null) {
//定义工具箱
$iatool = $( '<div class="iatool" />' );
var zhmoeapi = new mw.ForeignApi("https://zh.moegirl.org.cn/api.php", { anonymous: true });
zhmoeapi.get({
action: "parse",
title: "Template:公共代码页",
text: "{{公共代码页}}",
variant: "zh-cn"
}).done(function (result) {
$iatool.html(result.parse.text['*'] + otherpage.concat(" | ", GHIA));
});
$iatool.dialog({
title:"interface-admin toolbox",
width: Math.round( $( window ).width() * 0.8 ),
option:{'position':'center'}
}).css( 'max-height', Math.round( $( window ).height() * 0.8 ) + 'px' );
}
$iatool.dialog('open');
});
})
);