注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
?_=1
来访问最新页面。https://zh.moegirl.org.cn/User:%E5%85%AC%E7%9A%84%E9%A9%B1%E9%80%90%E8%88%B0/common.js?_=1
//wikitext版高亮
mw.loader.load('https://cdn.jsdelivr.net/gh/bhsd-harry/LLWiki@2.12/otherwiki/gadget-code-prettify.min.js');
//東東君的Wikiplus替换方案js
mw.loader.load('/index.php?title=User:%E6%9D%B1%E6%9D%B1%E5%90%9B/js/Wikiplus-replace.js&action=raw&ctype=text/javascript')
//第三方小工具选择器
//mw.loader.load('/index.php?title=User:bhsd/js/SettingsDialog.js&action=raw&ctype=text/javascript');
//AkIndexSupplement sandbox 环境
///mw.loader.load("/index.php?title=User:公的驱逐舰/ak_index_supplement.js&action=raw&ctype=text/javascript");
//我版floatTOC
mw.loader.load( '/index.php?title=User:%E5%85%AC%E7%9A%84%E9%A9%B1%E9%80%90%E8%88%B0/floatTOC.js&action=raw&ctype=text/javascript' );
//开发版Wikiplus
//mw.loader.load('https://wikiplus.oss-cn-shanghai.aliyuncs.com/Main.development.js');
//Leranjun
mw.loader.load('/index.php?title=User:Leranjun/WDC/script.js&action=raw&ctype=text/javascript');
//暴力设置Wikiplus字体
$("<style>").text("#Wikiplus-Quickedit { font-family: monospace; }").appendTo("head");
//暴力抓取当前页面{{FULLPAGENAME}}
/*var fullPageNamee = window.location.href.replace(/http(s|):\/\/zh.moegirl.org(.cn|)\//,"");
if(/index\.php/g.test(fullPageNamee)) {
var array = [...fullPageNamee.matchAll(/title=(.+?)(?:&|$)/g))];
fullPageNamee = array[array.length - 1][1];
}
fullPageNamee = fullPageNamee.replace(/#.+$/,"");*/
var fullPageNamee = window.location.href;
fullPageNamee = fullPageNamee.replace(/http(s|)\:\/\/zh\.moegirl\.org(\.cn|)\//,"");
fullPageNamee = fullPageNamee.replace("index.php?title=","");
fullPageNamee = fullPageNamee.replace(/&.*/,"");
fullPageNamee = fullPageNamee.replace(/#.*/,"");
//编辑链接自动跳转到编辑区
var editLinks = document.querySelectorAll(".mw-editsection>a, #ca-edit>span>a");
for (var i = 0; i<editLinks.length; i++) {
editLinks[i].setAttribute("href",editLinks[i].getAttribute("href").concat("#editform"))
}
//查看子页面
var childLink = document.createElement("a");
childLink.href = "https://zh.moegirl.org/index.php?title=Special%3A前缀索引&prefix=" + fullPageNamee;
childLink.setAttribute("title","利用“前缀索引”查看本页面的所有子页面");
childLink.appendChild(document.createTextNode("查看子页面"));
var childLi = document.createElement("li");
childLi.setAttribute("id","t-childpage");
childLi.appendChild(childLink);
var recentChangesLi = document.getElementById("t-recentchangeslinked");
recentChangesLi.insertAdjacentElement("afterend",childLi);
//end 查看子页面
//个人沙盒
var personalLabelDiv = document.getElementById("p-personal");
var personalLabelUl = personalLabelDiv.getElementsByTagName("UL")[0];
var sandBoxLink = document.createElement("a");
sandBoxLink.href = "https://zh.moegirl.org/index.php?title=Special%3A我的用户页/sandbox" ;
//copy时注意:沙盒子页面名不一定相同
sandBoxLink.setAttribute("title","您自己的沙盒");
sandBoxLink.appendChild(document.createTextNode("我的沙盒"));
var sandBoxLi = document.createElement("li");
sandBoxLi.setAttribute("id","pt-sandbox");
sandBoxLi.appendChild(sandBoxLink);
personalLabelUl.insertBefore(sandBoxLi,document.getElementById("pt-logout"));
//end 个人沙盒
//伪中国语翻译 Demo
//需要内容包覆在id为"pchn-instance"的div中;
//syntax必须如下:<span title="翻译内容" 任意其他attribute="any-value"><任意标签 /></span>
//即,翻译必须是title,必须处于span标签中,最好包覆原文
//这样可能会误处理其他title;如果为每一条翻译标记class,就不会误处理了
var instanceContainer = document.getElementById("pchn-instance");
//生成按钮
var toggleButton = document.createElement("button");
toggleButton.setAttribute("id","pchn-toggle");
toggleButton.setAttribute("onclick","pchnTrDemo()");
var buttonText = document.createTextNode("全文翻訳表示");
toggleButton.appendChild(buttonText);
//用button-anchor定位按钮位置,插入于anchor前方
document.getElementById("button-anchor").insertAdjacentElement("beforebegin",toggleButton);
//制作翻译
var instance = instanceContainer.querySelectorAll("span[title]");
for (var i = 0; i<instance.length; i++) {
var instanceStyle = "display:inline-block;";
if(instance[i].hasAttribute("style")) {
instanceStyle = "".concat(instance[i].getAttribute("style"),instanceStyle);
}
//instance[i].setAttribute("style",instanceStyle);
var trSpan = document.createElement("span");
trSpan.setAttribute("lang","zh");
trSpan.setAttribute("style","font-size:75%;color:#888;");
trSpan.appendChild(document.createTextNode(instance[i].getAttribute("title")));
var trWrap = document.createElement("span");
trWrap.setAttribute("class","pchn-tr");
trWrap.setAttribute("style","display:none");
//trWrap.appendChild(document.createElement("br"));
trWrap.appendChild(trSpan);
instance[i].appendChild(trWrap);
}
function pchnTrDemo(){
var instance = document.getElementsByClassName("pchn-tr");
for (var i = 0; i<instance.length; i++) {
instance[i].setAttribute("style","display:inline-block");
}
//修改按钮
toggleButton.setAttribute("onclick","pchnRmDemo()");
buttonText.nodeValue="全文翻訳隠";
}
//删除翻译
function pchnRmDemo(){
var instance = document.getElementsByClassName("pchn-tr");
for (var i = 0; i<instance.length; i++) {
instance[i].setAttribute("style","display:none");
}
//修改按钮
toggleButton.setAttribute("onclick","pchnTrDemo()");
buttonText.nodeValue="全文翻訳表示";
}
//end 伪中国语翻译 Demo