Skip to content

Commit f354c40

Browse files
committed
移除首页的pv 统计
1 parent a787681 commit f354c40

2 files changed

Lines changed: 6 additions & 39 deletions

File tree

src/pages/about/index.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ Current support tools as follow:
223223
- Icons & OgImage: from [Iconify](https://iconify.design/) & [lobehub](https://lobehub.com/icons), some icons from ai
224224
- Fonts: from [ZSFT](https://fonts.zeoseven.com), current font is `Noto Serif CJK / 思源宋体`, 标题字体是 `ZSFT-e`
225225

226+
227+
Total Page View <span id="vercount_value_page_pv">Loading</span>
228+
Total Visits <span id="vercount_value_site_pv">Loading</span>
229+
Site Total Visitors <span id="vercount_value_site_uv">Loading</span>
230+
226231
## Special Links
227232

228233
<FriendList

src/pages/index.astro

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,6 @@ const highlightColor = getHighlightColor()
230230
id='total-words-display'>{totalWords.toLocaleString()}</span
231231
>
232232
</div>
233-
<div
234-
class='flex justify-between items-center py-1 border-b border-dashed border-border md:border-b md:border-dashed md:border-border'
235-
>
236-
<span class='text-muted-foreground text-xs md:text-sm'>PV</span>
237-
<span
238-
class='text-foreground font-semibold tabular-nums text-xs md:text-sm'
239-
id='total-views-display'>-</span
240-
>
241-
</div>
242233
<div class='flex justify-between items-center py-1 pb-3 md:pb-4 md:border-b-0'>
243234
<span class='text-muted-foreground text-xs md:text-sm'>UpTime</span>
244235
<span class='text-foreground font-semibold tabular-nums text-xs md:text-sm'
@@ -311,36 +302,7 @@ const highlightColor = getHighlightColor()
311302
</aside>
312303
</div>
313304
</div>
314-
315-
<span id='vercount_value_site_pv' class='hidden'></span>
316-
317-
{/* 数字动画效果已移除,直接显示数字以优化性能 */}
318-
<script is:inline>
319-
// 简化的 PV 统计更新 - 不使用动画,直接显示数字
320-
document.addEventListener('DOMContentLoaded', function () {
321-
const viewsEl = document.getElementById('total-views-display')
322-
const vercountEl = document.getElementById('vercount_value_site_pv')
323-
324-
if (viewsEl && vercountEl) {
325-
function updateViews() {
326-
const val = vercountEl.textContent
327-
if (val && val !== '-') {
328-
viewsEl.textContent = parseInt(val.replace(/,/g, '')).toLocaleString()
329-
}
330-
}
331-
332-
// 检查初始值
333-
updateViews()
334-
335-
// 监听一次更新后断开
336-
const obs = new MutationObserver(function () {
337-
updateViews()
338-
obs.disconnect()
339-
})
340-
obs.observe(vercountEl, { childList: true, characterData: true, subtree: true })
341-
}
342-
})
343-
</script>
305+
344306
</main>
345307

346308
<style>

0 commit comments

Comments
 (0)