Loading

展示博客园顶部的随笔、文章、评论、阅读量统计数据

在适当位置添加div标签
<div id="stats_count_show"></div>

在js脚本中添加如下代码

function getAllCount() { var post = document.getElementById('stats_post_count').innerText.replace(/.*?(\d+).*?/g, '$1'); var article = document.getElementById('stats_article_count').innerText.replace(/.*?(\d+).*?/g, '$1'); var comment = document.getElementById('stats-comment_count').innerText.replace(/.*?(\d+).*?/g, '$1'); var viewcount = document.getElementById('stats-total-view-count').innerText.replace(/.*?(\d+).*?/g, '$1'); post = post != null || post != "" ? post : 0; article = article != null || article != "" ? article : 0; comment = comment != null || comment != "" ? comment : 0; viewcount = viewcount != null || viewcount != "" ? viewcount : 0; document.getElementById('stats_count_show').innerText = "随笔:[" + post + "]篇;阅读量[" + viewcount + "];文章[" + article + "];评论:[" + comment + "]条."; } });

页面上就有啦,可以适当的调整样式跟位置

posted @ 2021-07-14 16:41  爱笑的眼睛真美  阅读(46)  评论(0编辑  收藏  举报