跳转到内容

User:Wetitpig0/pageview.js

维基百科,自由的百科全书
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
function wgUXS (wg, hans, hant, cn, tw, hk, sg, zh, mo, my) {
	var ret = {
        'zh': zh || hans || hant || cn || tw || hk || sg || mo || my,
        'zh-hans': hans || cn || sg || my,
	    'zh-hant': hant || tw || hk || mo,
        'zh-cn': cn || hans || sg || my,
        'zh-sg': sg || hans || cn || my,
        'zh-tw': tw || hant || hk || mo,
        'zh-hk': hk || hant || mo || tw,
        'zh-mo': mo || hant || hk || tw
    };
    return ret[wg] || zh || hans || hant || cn || tw || hk || sg || mo || my; //保證每一語言有值
}

function wgULS (hans, hant, cn, tw, hk, sg, zh, mo, my) {
   	return wgUXS(mw.config.get('wgUserVariant'), hans, hant, cn, tw, hk, sg, zh, mo, my);
}

(function ($, mw) {
	var portletlink = mw.util.addPortletLink(
		"p-tb",
		"https://tools.wmflabs.org/pageviews/?project=zh.wikipedia.org&platform=all-access&agent=user&range=latest-20&pages=" + mw.config.get("wgPageName"),
		wgULS("页面浏览量", "頁面瀏覽量"),
		"t-pageview",
		undefined,
		"pv",
		"t-refillopts"
	);
})(jQuery, mw);