User:Emojiwiki/countref.js
外观
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
/* some code from [[User:Sun00217/現在我可以搞破壊了嗎.js]] */
/* get MW vars */
var lang = mw.config.get('wgUserLanguage')
function wgCtUXS (wg, hans, hant, en) {
var ret = {
'zh': hant ,
'zh-hans': hans,
'zh-hant': hant,
'zh-cn': hans,
'zh-sg': hans,
'zh-my': hans,
'zh-tw': hant,
'zh-hk': hant,
'zh-mo': hant,
'en': en
};
return ret[wg] || en || hans || hant ;
}
function wgCtULS (hans, hant, en) {
return wgCtUXS(lang, hans, hant, en);
}
(function($,mw) {
var bt = mw.util.addPortletLink(
'p-cactions',
'#',
wgULS('检查来源脚注数', '檢查來源腳註數', 'Count sources with footnotes'),
'countref-btn',
null,
null,
'#pt-preferences'
);
$(bt).click(function(e) {
e.preventDefault();
mw.notify(wgULS('正在查询来源脚注数,请稍等', '正在查詢來源腳註數,請稍等', 'Checking the amout of footnotes, please wait'));
var count = $( '.references' ).children( 'li' ).length;
var RSTR = '<p>' + wgULS('来源脚注数:', '來源腳註數:', 'Number of footnotes: ') + count;
if (count == 0) {
RSTR = RSTR.concat('<br />').concat(wgULS('无来源脚注!', '無來源腳註!', 'No footnotes!'));
}
RSTR = RSTR.concat('</p>')
mw.notify($(RSTR));
});
})(jQuery,mw);