fix:Modify the statistical code

This commit is contained in:
Zyronon
2025-12-15 16:55:56 +08:00
committed by GitHub
parent a0e89f4b40
commit 3a0cbf04a1
2 changed files with 181 additions and 108 deletions

View File

@@ -48,75 +48,76 @@
<!-- color-scheme 告诉浏览器支持亮/暗模式-->
<meta name="color-scheme" content="light dark"/>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-50T6DRD837"></script>
<script>
if (
!location.href.includes('localhost')
&& !location.href.includes('192.168')
&& !location.href.includes('172.16')
&& !location.href.includes('10.0')
) {
//51.la
(function () {
window.LA = window.LA || {
ids: [{id: "3OH8ITYRgwzo58L2", ck: "3OH8ITYRgwzo58L2"}],
id: "3OH8ITYRgwzo58L2",
ck: "3OH8ITYRgwzo58L2",
hashMode: true
};
const script = document.createElement('script');
script.src = `https://typewords.cc/libs/51.js`;
document.head.appendChild(script);
})();
</script>
// Cloudflare
(function () {
var cf = document.createElement("script");
cf.src = 'https://static.cloudflareinsights.com/beacon.min.js'
cf.setAttribute("data-cf-beacon", '{"token": "e5119992696d4155814400dd69781d68"}');
document.head.appendChild(cf);
})();
<script>
</script>
// google
(function () {
var ana = document.createElement("script");
ana.src = 'https://www.googletagmanager.com/gtag/js?id=G-50T6DRD837'
ana.onload = function () {
window.dataLayer = window.dataLayer || [];
<script>
if (!location.href.includes('localhost')
&& !location.href.includes('192.168')
&& !location.href.includes('172.16')
&& !location.href.includes('10.0')
) {
//https://51.la/
!function(p){"use strict";!function(t){var s=window,e=document,i=p,c="".concat("https:"===e.location.protocol?"https://":"http://","sdk.51.la/js-sdk-pro.min.js"),n=e.createElement("script"),r=e.getElementsByTagName("script")[0];n.type="text/javascript",n.setAttribute("charset","UTF-8"),n.async=!0,n.src=c,n.id="LA_COLLECT",i.d=n;var o=function(){s.LA.ids.push(i)};s.LA?s.LA.ids&&o():(s.LA=p,s.LA.ids=[],o()),r.parentNode.insertBefore(n,r)}()}({id:"3OH8ITYRgwzo58L2",ck:"3OH8ITYRgwzo58L2",autoTrack:true,hashMode:true});
function gtag() {
dataLayer.push(arguments);
}
// Cloudflare
(function () {
var cf = document.createElement("script");
cf.src = 'https://static.cloudflareinsights.com/beacon.min.js'
cf.setAttribute("data-cf-beacon", '{"token": "e5119992696d4155814400dd69781d68"}');
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(cf, s);
})();
// google
(function () {
var ana = document.createElement("script");
ana.src = 'https://www.googletagmanager.com/gtag/js?id=G-50T6DRD837'
ana.onload = function () {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-50T6DRD837');
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(ana, s);
})();
gtag('js', new Date());
gtag('config', 'G-50T6DRD837');
}
document.head.appendChild(ana);
})();
// baidu
var _hmt = _hmt || [];
(function () {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?3dae52fcd5375a19905462e4ad3eb54e";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
// baidu
var _hmt = _hmt || [];
(function () {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?3dae52fcd5375a19905462e4ad3eb54e";
document.head.appendChild(hm);
})();
// umami
(function () {
var umami = document.createElement("script");
umami.src = 'https://typewords.cc/libs/s.js'
umami.setAttribute("data-website-id", "160308c9-7900-4b1d-a0b1-c3b25a9530f6");
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(umami, s);
})();
// umami
// (function () {
// var umami = document.createElement("script");
// umami.src = 'https://typewords.cc/libs/s.js'
// umami.setAttribute("data-website-id", "160308c9-7900-4b1d-a0b1-c3b25a9530f6");
// document.head.appendChild(umami);
// })();
// umami-saas
(function () {
var umami2 = document.createElement("script");
umami2.src = 'https://stat.typewords.cc/script.js'
umami2.setAttribute("data-website-id", "4d728ae3-5393-4efe-81dc-30dcb4f33c00");
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(umami2, s);
})();
}
// umami-saas
// (function () {
// var umami2 = document.createElement("script");
// umami2.src = 'https://stat.typewords.cc/script.js'
// umami2.setAttribute("data-website-id", "4d728ae3-5393-4efe-81dc-30dcb4f33c00");
// document.head.appendChild(umami2);
// })();
}
</script>
</head>
<body>
@@ -126,56 +127,56 @@
</noscript>
<div id="app"></div>
<script>
(function () {
var ua = navigator.userAgent || ''
var isIE = !!document.documentMode || /MSIE|Trident/i.test(ua)
if (!isIE) return
var style = document.createElement('style')
style.type = 'text/css'
style.appendChild(document.createTextNode(
'.ie-mask{position:fixed;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.35);z-index:9998}' +
'.ie-dialog{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:28rem;max-width:90vw;background:#fff;color:#111;border-radius:.6rem;box-shadow:0 10px 30px rgba(0,0,0,.15);z-index:9999;padding:1.2rem}' +
'.ie-dialog .title{font-size:1.2rem;font-weight:700;margin-bottom:.6rem}' +
'.ie-dialog .desc{font-size:.95rem;line-height:1.6;color:#555}' +
'.ie-dialog .actions{display:flex;justify-content:flex-end;margin-top:1rem}' +
'.ie-dialog .actions > * + *{margin-left:.6rem}' +
'.ie-dialog .btn{display:inline-flex;align-items:center;justify-content:center;height:2.2rem;padding:0 1rem;border-radius:.4rem;background:#0C8CE9;color:#fff;text-decoration:none}' +
'.ie-dialog .btn-secondary{display:inline-flex;align-items:center;justify-content:center;height:2.2rem;padding:0 .9rem;border-radius:.4rem;background:#eee;color:#333;border:1px solid #ddd}' +
'@media (prefers-color-scheme: dark){.ie-dialog{background:#1e1f22;color:#e6e6e6}.ie-dialog .desc{color:#c6c6c6}.ie-dialog .btn-secondary{background:#2a2b2f;color:#e6e6e6;border-color:#3a3b3f}}'
))
document.head.appendChild(style)
var mask = document.createElement('div')
mask.className = 'ie-mask'
var dialog = document.createElement('div')
dialog.className = 'ie-dialog'
dialog.innerHTML = '<div class="title">不支持 IE 浏览器</div>' +
'<div class="desc">Type Words 使用现代技术构建,请使用 Chrome、Edge、Firefox 或 Safari 等现代浏览器访问。</div>' +
'<div class="actions">' +
'<a class="btn" href="https://www.google.cn/chrome/" target="_blank" rel="noreferrer">下载 Chrome</a>' +
'<button class="btn-secondary" type="button">我知道了</button>' +
'</div>'
(function () {
var ua = navigator.userAgent || ''
var isIE = !!document.documentMode || /MSIE|Trident/i.test(ua)
if (!isIE) return
var style = document.createElement('style')
style.type = 'text/css'
style.appendChild(document.createTextNode(
'.ie-mask{position:fixed;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.35);z-index:9998}' +
'.ie-dialog{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:28rem;max-width:90vw;background:#fff;color:#111;border-radius:.6rem;box-shadow:0 10px 30px rgba(0,0,0,.15);z-index:9999;padding:1.2rem}' +
'.ie-dialog .title{font-size:1.2rem;font-weight:700;margin-bottom:.6rem}' +
'.ie-dialog .desc{font-size:.95rem;line-height:1.6;color:#555}' +
'.ie-dialog .actions{display:flex;justify-content:flex-end;margin-top:1rem}' +
'.ie-dialog .actions > * + *{margin-left:.6rem}' +
'.ie-dialog .btn{display:inline-flex;align-items:center;justify-content:center;height:2.2rem;padding:0 1rem;border-radius:.4rem;background:#0C8CE9;color:#fff;text-decoration:none}' +
'.ie-dialog .btn-secondary{display:inline-flex;align-items:center;justify-content:center;height:2.2rem;padding:0 .9rem;border-radius:.4rem;background:#eee;color:#333;border:1px solid #ddd}' +
'@media (prefers-color-scheme: dark){.ie-dialog{background:#1e1f22;color:#e6e6e6}.ie-dialog .desc{color:#c6c6c6}.ie-dialog .btn-secondary{background:#2a2b2f;color:#e6e6e6;border-color:#3a3b3f}}'
))
document.head.appendChild(style)
var mask = document.createElement('div')
mask.className = 'ie-mask'
var dialog = document.createElement('div')
dialog.className = 'ie-dialog'
dialog.innerHTML = '<div class="title">不支持 IE 浏览器</div>' +
'<div class="desc">Type Words 使用现代技术构建,请使用 Chrome、Edge、Firefox 或 Safari 等现代浏览器访问。</div>' +
'<div class="actions">' +
'<a class="btn" href="https://www.google.cn/chrome/" target="_blank" rel="noreferrer">下载 Chrome</a>' +
'<button class="btn-secondary" type="button">我知道了</button>' +
'</div>'
function close() {
try {
document.body.removeChild(mask)
} catch (e) {
}
try {
document.body.removeChild(dialog)
} catch (e) {
}
}
function close() {
try {
document.body.removeChild(mask)
} catch (e) {
}
try {
document.body.removeChild(dialog)
} catch (e) {
}
}
mask.addEventListener('click', close)
var btn = null
try {
btn = dialog.querySelector('.btn-secondary')
} catch (e) {
}
if (btn) btn.addEventListener('click', close)
document.body.appendChild(mask)
document.body.appendChild(dialog)
})()
mask.addEventListener('click', close)
var btn = null
try {
btn = dialog.querySelector('.btn-secondary')
} catch (e) {
}
if (btn) btn.addEventListener('click', close)
document.body.appendChild(mask)
document.body.appendChild(dialog)
})()
</script>
<script type="module" src="/src/main.ts"></script>
</body>

View File

@@ -383,6 +383,78 @@
}
</style>
<script>
if (
!location.href.includes('localhost')
&& !location.href.includes('192.168')
&& !location.href.includes('172.16')
&& !location.href.includes('10.0')
) {
//51.la
(function () {
window.LA = window.LA || {
ids: [{id: "3OH8ITYRgwzo58L2", ck: "3OH8ITYRgwzo58L2"}],
id: "3OH8ITYRgwzo58L2",
ck: "3OH8ITYRgwzo58L2",
hashMode: true
};
const script = document.createElement('script');
script.src = `https://typewords.cc/libs/51.js`;
document.head.appendChild(script);
})();
// Cloudflare
(function () {
var cf = document.createElement("script");
cf.src = 'https://static.cloudflareinsights.com/beacon.min.js'
cf.setAttribute("data-cf-beacon", '{"token": "e5119992696d4155814400dd69781d68"}');
document.head.appendChild(cf);
})();
// google
(function () {
var ana = document.createElement("script");
ana.src = 'https://www.googletagmanager.com/gtag/js?id=G-50T6DRD837'
ana.onload = function () {
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-50T6DRD837');
}
document.head.appendChild(ana);
})();
// baidu
var _hmt = _hmt || [];
(function () {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?3dae52fcd5375a19905462e4ad3eb54e";
document.head.appendChild(hm);
})();
// umami
// (function () {
// var umami = document.createElement("script");
// umami.src = 'https://typewords.cc/libs/s.js'
// umami.setAttribute("data-website-id", "160308c9-7900-4b1d-a0b1-c3b25a9530f6");
// document.head.appendChild(umami);
// })();
// umami-saas
// (function () {
// var umami2 = document.createElement("script");
// umami2.src = 'https://stat.typewords.cc/script.js'
// umami2.setAttribute("data-website-id", "4d728ae3-5393-4efe-81dc-30dcb4f33c00");
// document.head.appendChild(umami2);
// })();
}
</script>
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {