User:Zuohaocheng/脚本索引

维基百科,自由的百科全书

本页中列出了User:Zuohaocheng写作的所有Javascript脚本。所有脚本均遵守MITGPLv2双协议。

脚本的导入方法

在自己用户页下的common.js(例如User:Zuohaocheng/common.js)页面中,写入如下代码

importScriptURI('//zh.wikipedia.org/w/index.php?title=User:Zuohaocheng/脚本名&action=raw&ctype=text/javascript');

例如导入patrollCount.js,即写入:

importScriptURI('//zh.wikipedia.org/w/index.php?title=User:Zuohaocheng/patrollCount.js&action=raw&ctype=text/javascript');

用于本地

patrollCount.js

在右上角增加未巡查条目计数

romanCJKV.js

将斜体字中的半角字符加上span.halfspace,便于设定不同字体。

其目的在于改善中文斜体的显示效果。因为中文字体的斜体十分难看。故改为仿宋体;而仿宋中的英文字体也很难看,因此需要分离。参考css:

span.comment, i, cite, em, var {
font-family: STFangsong, FangSong, FangSong_GB2312, serif;
font-style: normal;
}
 
span.halfspace {
font-family: "Times CE","Times", "Times New Roman", sans-serif;
font-style: italic;
letter-spacing: 0pt;
}

navbox-link.js

检测导航模板链接到的条目中,没有包含该模板的条目

用于跨语言

本类脚本使用前需设定目标语言种类,即

var targetLang = 'zh';

langlinks.js

检测具有中文版的条目,若有,则将链接的class改为locArticleExist。参考css:

a.locArticleExist {
color: green;
}

cate-langlinks.js

检测具有中文版的分类,并允许复制起Mediawiki源代码,以及该条目的跨语言链接(去除中文的,并加入本维基的)