User:Iamchenzetian/common.js
外观
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
//在监视列表后加入“新页面巡查”
mw.loader.load('https://zh.wikipedia.org/zhwiki/w/index.php?title=User:Zuohaocheng/patrollCount.js&action=raw&ctype=text/javascript');
//AJAX巡查
mw.loader.load('https://meta.wikimedia.org/zhwiki/w/index.php?title=User:Krinkle/Scripts/AjaxPatrolLinks.js&action=raw&ctype=text/javascript');
//返回页顶
importScript("User:Iamchenzetian/ReturnTop.js");
//更改hotcat的设置
JSconfig.keys['HotCatListSize'] = 10; // Or any other integer value from 5 to 15; default is 5.
JSconfig.keys['HotCatDelay'] = 300; // Timeout between a keypress and the refresh of the suggestion list. The default is 100 milliseconds.
JSconfig.keys['HotCatListSize'] = 10; // Or any other integer value from 5 to 15; default is 5.
$(document).ready(function() {
$("body div#mw-head div#p-personal ul li#pt-userpage").before('<li id="pt-en"><a href="http://en.wikipedia.org" title="英文维基">英文维基百科</a></li>');
$("span.comment, i, cite, em, var").each(function(){
var oldHtml=this.innerHTML+"";
var newHtml="";
var regex= /[\u0020-\u003b\u003d-\u1000]+/g;
var indexBuf;
do{
indexBuf = regex.lastIndex;
var match=regex.exec(oldHtml);
var backFlag = false;
if(match!=null) {
regex.lastIndex=match.index+match[0].length;
newHtml += oldHtml.substr(indexBuf, match.index - indexBuf);
//保护html标签; 若标签前为汉字, 退回
if (oldHtml[match.index-1] === "<") {
regex.lastIndex = match.index - 1;
backFlag = true;
}
else {
newHtml += "<span class=\"halfspace\">"+match[0]+"</span>";
}
//保护html标签, 不加入span
if (oldHtml[regex.lastIndex] === "<") {
var protect = new RegExp("\\<.*?\\>","g");
protect.lastIndex = regex.lastIndex;
var protectMatch = protect.exec(oldHtml);
if (protectMatch != null) {
regex.lastIndex += protectMatch[0].length;
if (backFlag) {
backFlag = false;
newHtml += protectMatch[0].substr(1, protectMatch[0].length -1);
}
else {
newHtml += protectMatch[0];
}
}
}
}
} while(match!=null)
newHtml += oldHtml.substr(indexBuf, oldHtml.length - indexBuf);
//替代html
this.innerHTML=newHtml;
});
});