Skip to content

Commit 3a0cbf0

Browse files
authored
fix:Modify the statistical code
1 parent a0e89f4 commit 3a0cbf0

2 files changed

Lines changed: 191 additions & 118 deletions

File tree

index.html

Lines changed: 119 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -48,75 +48,76 @@
4848
<!-- color-scheme 告诉浏览器支持亮/暗模式-->
4949
<meta name="color-scheme" content="light dark"/>
5050

51-
<!-- Google tag (gtag.js) -->
52-
<script async src="https://www.googletagmanager.com/gtag/js?id=G-50T6DRD837"></script>
5351
<script>
54-
55-
</script>
56-
57-
<script>
58-
</script>
59-
60-
<script>
61-
if (!location.href.includes('localhost')
62-
&& !location.href.includes('192.168')
63-
&& !location.href.includes('172.16')
64-
&& !location.href.includes('10.0')
65-
) {
66-
//https://51.la/
67-
!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});
68-
69-
// Cloudflare
70-
(function () {
71-
var cf = document.createElement("script");
72-
cf.src = 'https://static.cloudflareinsights.com/beacon.min.js'
73-
cf.setAttribute("data-cf-beacon", '{"token": "e5119992696d4155814400dd69781d68"}');
74-
var s = document.getElementsByTagName("script")[0];
75-
s.parentNode.insertBefore(cf, s);
76-
})();
77-
78-
// google
79-
(function () {
80-
var ana = document.createElement("script");
81-
ana.src = 'https://www.googletagmanager.com/gtag/js?id=G-50T6DRD837'
82-
ana.onload = function () {
83-
window.dataLayer = window.dataLayer || [];
84-
function gtag(){dataLayer.push(arguments);}
85-
gtag('js', new Date());
86-
gtag('config', 'G-50T6DRD837');
87-
}
88-
var s = document.getElementsByTagName("script")[0];
89-
s.parentNode.insertBefore(ana, s);
90-
})();
91-
92-
93-
// baidu
94-
var _hmt = _hmt || [];
95-
(function () {
96-
var hm = document.createElement("script");
97-
hm.src = "https://hm.baidu.com/hm.js?3dae52fcd5375a19905462e4ad3eb54e";
98-
var s = document.getElementsByTagName("script")[0];
99-
s.parentNode.insertBefore(hm, s);
100-
})();
101-
102-
// umami
103-
(function () {
104-
var umami = document.createElement("script");
105-
umami.src = 'https://typewords.cc/libs/s.js'
106-
umami.setAttribute("data-website-id", "160308c9-7900-4b1d-a0b1-c3b25a9530f6");
107-
var s = document.getElementsByTagName("script")[0];
108-
s.parentNode.insertBefore(umami, s);
109-
})();
110-
111-
// umami-saas
112-
(function () {
113-
var umami2 = document.createElement("script");
114-
umami2.src = 'https://stat.typewords.cc/script.js'
115-
umami2.setAttribute("data-website-id", "4d728ae3-5393-4efe-81dc-30dcb4f33c00");
116-
var s = document.getElementsByTagName("script")[0];
117-
s.parentNode.insertBefore(umami2, s);
118-
})();
119-
}
52+
if (
53+
!location.href.includes('localhost')
54+
&& !location.href.includes('192.168')
55+
&& !location.href.includes('172.16')
56+
&& !location.href.includes('10.0')
57+
) {
58+
//51.la
59+
(function () {
60+
window.LA = window.LA || {
61+
ids: [{id: "3OH8ITYRgwzo58L2", ck: "3OH8ITYRgwzo58L2"}],
62+
id: "3OH8ITYRgwzo58L2",
63+
ck: "3OH8ITYRgwzo58L2",
64+
hashMode: true
65+
};
66+
const script = document.createElement('script');
67+
script.src = `https://typewords.cc/libs/51.js`;
68+
document.head.appendChild(script);
69+
})();
70+
71+
// Cloudflare
72+
(function () {
73+
var cf = document.createElement("script");
74+
cf.src = 'https://static.cloudflareinsights.com/beacon.min.js'
75+
cf.setAttribute("data-cf-beacon", '{"token": "e5119992696d4155814400dd69781d68"}');
76+
document.head.appendChild(cf);
77+
})();
78+
79+
// google
80+
(function () {
81+
var ana = document.createElement("script");
82+
ana.src = 'https://www.googletagmanager.com/gtag/js?id=G-50T6DRD837'
83+
ana.onload = function () {
84+
window.dataLayer = window.dataLayer || [];
85+
86+
function gtag() {
87+
dataLayer.push(arguments);
88+
}
89+
90+
gtag('js', new Date());
91+
gtag('config', 'G-50T6DRD837');
92+
}
93+
document.head.appendChild(ana);
94+
})();
95+
96+
97+
// baidu
98+
var _hmt = _hmt || [];
99+
(function () {
100+
var hm = document.createElement("script");
101+
hm.src = "https://hm.baidu.com/hm.js?3dae52fcd5375a19905462e4ad3eb54e";
102+
document.head.appendChild(hm);
103+
})();
104+
105+
// umami
106+
// (function () {
107+
// var umami = document.createElement("script");
108+
// umami.src = 'https://typewords.cc/libs/s.js'
109+
// umami.setAttribute("data-website-id", "160308c9-7900-4b1d-a0b1-c3b25a9530f6");
110+
// document.head.appendChild(umami);
111+
// })();
112+
113+
// umami-saas
114+
// (function () {
115+
// var umami2 = document.createElement("script");
116+
// umami2.src = 'https://stat.typewords.cc/script.js'
117+
// umami2.setAttribute("data-website-id", "4d728ae3-5393-4efe-81dc-30dcb4f33c00");
118+
// document.head.appendChild(umami2);
119+
// })();
120+
}
120121
</script>
121122
</head>
122123
<body>
@@ -126,56 +127,56 @@
126127
</noscript>
127128
<div id="app"></div>
128129
<script>
129-
(function () {
130-
var ua = navigator.userAgent || ''
131-
var isIE = !!document.documentMode || /MSIE|Trident/i.test(ua)
132-
if (!isIE) return
133-
var style = document.createElement('style')
134-
style.type = 'text/css'
135-
style.appendChild(document.createTextNode(
136-
'.ie-mask{position:fixed;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.35);z-index:9998}' +
137-
'.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}' +
138-
'.ie-dialog .title{font-size:1.2rem;font-weight:700;margin-bottom:.6rem}' +
139-
'.ie-dialog .desc{font-size:.95rem;line-height:1.6;color:#555}' +
140-
'.ie-dialog .actions{display:flex;justify-content:flex-end;margin-top:1rem}' +
141-
'.ie-dialog .actions > * + *{margin-left:.6rem}' +
142-
'.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}' +
143-
'.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}' +
144-
'@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}}'
145-
))
146-
document.head.appendChild(style)
147-
var mask = document.createElement('div')
148-
mask.className = 'ie-mask'
149-
var dialog = document.createElement('div')
150-
dialog.className = 'ie-dialog'
151-
dialog.innerHTML = '<div class="title">不支持 IE 浏览器</div>' +
152-
'<div class="desc">Type Words 使用现代技术构建,请使用 Chrome、Edge、Firefox 或 Safari 等现代浏览器访问。</div>' +
153-
'<div class="actions">' +
154-
'<a class="btn" href="https://www.google.cn/chrome/" target="_blank" rel="noreferrer">下载 Chrome</a>' +
155-
'<button class="btn-secondary" type="button">我知道了</button>' +
156-
'</div>'
157-
158-
function close() {
159-
try {
160-
document.body.removeChild(mask)
161-
} catch (e) {
162-
}
163-
try {
164-
document.body.removeChild(dialog)
165-
} catch (e) {
166-
}
167-
}
168-
169-
mask.addEventListener('click', close)
170-
var btn = null
171-
try {
172-
btn = dialog.querySelector('.btn-secondary')
173-
} catch (e) {
174-
}
175-
if (btn) btn.addEventListener('click', close)
176-
document.body.appendChild(mask)
177-
document.body.appendChild(dialog)
178-
})()
130+
(function () {
131+
var ua = navigator.userAgent || ''
132+
var isIE = !!document.documentMode || /MSIE|Trident/i.test(ua)
133+
if (!isIE) return
134+
var style = document.createElement('style')
135+
style.type = 'text/css'
136+
style.appendChild(document.createTextNode(
137+
'.ie-mask{position:fixed;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.35);z-index:9998}' +
138+
'.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}' +
139+
'.ie-dialog .title{font-size:1.2rem;font-weight:700;margin-bottom:.6rem}' +
140+
'.ie-dialog .desc{font-size:.95rem;line-height:1.6;color:#555}' +
141+
'.ie-dialog .actions{display:flex;justify-content:flex-end;margin-top:1rem}' +
142+
'.ie-dialog .actions > * + *{margin-left:.6rem}' +
143+
'.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}' +
144+
'.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}' +
145+
'@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}}'
146+
))
147+
document.head.appendChild(style)
148+
var mask = document.createElement('div')
149+
mask.className = 'ie-mask'
150+
var dialog = document.createElement('div')
151+
dialog.className = 'ie-dialog'
152+
dialog.innerHTML = '<div class="title">不支持 IE 浏览器</div>' +
153+
'<div class="desc">Type Words 使用现代技术构建,请使用 Chrome、Edge、Firefox 或 Safari 等现代浏览器访问。</div>' +
154+
'<div class="actions">' +
155+
'<a class="btn" href="https://www.google.cn/chrome/" target="_blank" rel="noreferrer">下载 Chrome</a>' +
156+
'<button class="btn-secondary" type="button">我知道了</button>' +
157+
'</div>'
158+
159+
function close() {
160+
try {
161+
document.body.removeChild(mask)
162+
} catch (e) {
163+
}
164+
try {
165+
document.body.removeChild(dialog)
166+
} catch (e) {
167+
}
168+
}
169+
170+
mask.addEventListener('click', close)
171+
var btn = null
172+
try {
173+
btn = dialog.querySelector('.btn-secondary')
174+
} catch (e) {
175+
}
176+
if (btn) btn.addEventListener('click', close)
177+
document.body.appendChild(mask)
178+
document.body.appendChild(dialog)
179+
})()
179180
</script>
180181
<script type="module" src="/src/main.ts"></script>
181182
</body>

public/static-home.html

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,78 @@
383383
}
384384
</style>
385385

386+
<script>
387+
if (
388+
!location.href.includes('localhost')
389+
&& !location.href.includes('192.168')
390+
&& !location.href.includes('172.16')
391+
&& !location.href.includes('10.0')
392+
) {
393+
//51.la
394+
(function () {
395+
window.LA = window.LA || {
396+
ids: [{id: "3OH8ITYRgwzo58L2", ck: "3OH8ITYRgwzo58L2"}],
397+
id: "3OH8ITYRgwzo58L2",
398+
ck: "3OH8ITYRgwzo58L2",
399+
hashMode: true
400+
};
401+
const script = document.createElement('script');
402+
script.src = `https://typewords.cc/libs/51.js`;
403+
document.head.appendChild(script);
404+
})();
405+
406+
// Cloudflare
407+
(function () {
408+
var cf = document.createElement("script");
409+
cf.src = 'https://static.cloudflareinsights.com/beacon.min.js'
410+
cf.setAttribute("data-cf-beacon", '{"token": "e5119992696d4155814400dd69781d68"}');
411+
document.head.appendChild(cf);
412+
})();
413+
414+
// google
415+
(function () {
416+
var ana = document.createElement("script");
417+
ana.src = 'https://www.googletagmanager.com/gtag/js?id=G-50T6DRD837'
418+
ana.onload = function () {
419+
window.dataLayer = window.dataLayer || [];
420+
421+
function gtag() {
422+
dataLayer.push(arguments);
423+
}
424+
425+
gtag('js', new Date());
426+
gtag('config', 'G-50T6DRD837');
427+
}
428+
document.head.appendChild(ana);
429+
})();
430+
431+
432+
// baidu
433+
var _hmt = _hmt || [];
434+
(function () {
435+
var hm = document.createElement("script");
436+
hm.src = "https://hm.baidu.com/hm.js?3dae52fcd5375a19905462e4ad3eb54e";
437+
document.head.appendChild(hm);
438+
})();
439+
440+
// umami
441+
// (function () {
442+
// var umami = document.createElement("script");
443+
// umami.src = 'https://typewords.cc/libs/s.js'
444+
// umami.setAttribute("data-website-id", "160308c9-7900-4b1d-a0b1-c3b25a9530f6");
445+
// document.head.appendChild(umami);
446+
// })();
447+
448+
// umami-saas
449+
// (function () {
450+
// var umami2 = document.createElement("script");
451+
// umami2.src = 'https://stat.typewords.cc/script.js'
452+
// umami2.setAttribute("data-website-id", "4d728ae3-5393-4efe-81dc-30dcb4f33c00");
453+
// document.head.appendChild(umami2);
454+
// })();
455+
}
456+
</script>
457+
386458
<script>
387459
if ('serviceWorker' in navigator) {
388460
window.addEventListener('load', () => {

0 commit comments

Comments
 (0)