MediaWiki:Common.js:修订间差异
MediaWiki界面页面
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第23行: | 第23行: | ||
<meta name="baidu-site-verification" content="codeva-38vNyP0io6" /> | <meta name="baidu-site-verification" content="codeva-38vNyP0io6" /> | ||
`); | `); | ||
if (mw.config.get('wgPageName') === 'Mainpage') { | |||
mw.loader.using('mediawiki.util').then(function() { | |||
document.addEventListener("DOMContentLoaded", function() { | |||
fetch(mw.util.wikiScript() + '?action=ajax&rs=getCSWordCount') | |||
.then(response => response.json()) | |||
.then(data => { | |||
let el = document.getElementById('wordcount-number'); | |||
if (!el) return; | |||
let count = data.total || 0; | |||
// 数字滚动动画 | |||
let current = 0; | |||
let step = Math.ceil(count / 100); // 100步完成 | |||
let interval = setInterval(() => { | |||
current += step; | |||
if (current >= count) { | |||
current = count; | |||
clearInterval(interval); | |||
} | |||
el.textContent = current.toLocaleString(); | |||
}, 20); | |||
}) | |||
.catch(err => console.error("获取字数失败:", err)); | |||
}); | |||
}); | |||
} | |||
2026年1月17日 (六) 16:09的版本
//Microsoft 和 Google 分析
document.head.insertAdjacentHTML('beforeend',`
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-GVZPTSXG1H"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-GVZPTSXG1H');
</script>
`);
document.head.insertAdjacentHTML('beforeend',`
<script type="text/javascript">
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "uewoetn0au");
</script>
`);
document.head.insertAdjacentHTML('beforeend',`
<meta name="baidu-site-verification" content="codeva-38vNyP0io6" />
`);
if (mw.config.get('wgPageName') === 'Mainpage') {
mw.loader.using('mediawiki.util').then(function() {
document.addEventListener("DOMContentLoaded", function() {
fetch(mw.util.wikiScript() + '?action=ajax&rs=getCSWordCount')
.then(response => response.json())
.then(data => {
let el = document.getElementById('wordcount-number');
if (!el) return;
let count = data.total || 0;
// 数字滚动动画
let current = 0;
let step = Math.ceil(count / 100); // 100步完成
let interval = setInterval(() => {
current += step;
if (current >= count) {
current = count;
clearInterval(interval);
}
el.textContent = current.toLocaleString();
}, 20);
})
.catch(err => console.error("获取字数失败:", err));
});
});
}