-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path404.html
More file actions
196 lines (182 loc) · 25.2 KB
/
404.html
File metadata and controls
196 lines (182 loc) · 25.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html><html lang="zh-cn"><head><meta charset="UTF-8"><meta http-equiv="Content-Type" content="text/html"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><meta name="renderer" content="webkit"><meta name="HandheldFriendly" content="true"><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no,minimum-scale=1,maximum-scale=1"><link rel="canonical" href="https://www.heson10.com/"><link rel="dns-prefetch" href="//fonts.googleapis.com"><link rel="dns-prefetch" href="//cdn.jsdelivr.net"><link rel="icon" type="image/png" href="https://pic.heson10.com/wallpapers/favicon.png"><link href="https://pic.heson10.com/wallpapers/favicon.png" rel="icon"><link rel="apple-touch-icon-precomposed" href="https://pic.heson10.com/wallpapers/favicon.png"><title>黑石博客 - Hexo博客</title><link href="https://fonts.googleapis.com/css2?family=Mulish&display=swap" rel="stylesheet" media="print" onload='this.media="all"'><link href="https://test1.jsdelivr.net/gh/heson10/pic@master/css/app.min.css" rel="stylesheet"><link href="https://test1.jsdelivr.net/gh/heson10/pic@master/css/duta.css" rel="stylesheet"><link rel="stylesheet" href="/css/Main.css"><link href="https://test1.jsdelivr.net/gh/heson10/pic@master/css/UI.css" rel="stylesheet"><script async src="https://at.alicdn.com/t/font_1826851_x246yki7bra.js"></script><script src="https://unpkg.com/jquery@3.5/dist/jquery.min.js"></script><script src="https://test1.jsdelivr.net/gh/heson10/pic@master/js/loading.js"></script><script src="https://test1.jsdelivr.net/gh/heson10/pic@master/js/app.min.js"></script><link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;900&display=swap" rel="stylesheet" media="print" onload='this.media="all"'><script>var _hmt=_hmt||[];setTimeout(function(){var e=document.createElement("script");e.src="https://hm.baidu.com/hm.js?5fb5fd0062e816d3a3ca2dacf095bc0f",e.defer=!0;var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)},5e3)</script><meta name="generator" content="Hexo 5.2.0"><link rel="alternate" href="/atom.xml" title="黑石博客 - Hexo博客" type="application/atom+xml"></head><div id="clickCanvas" style="position:fixed;left:0;top:0;z-index:999999999;pointer-events:none"></div><style>body,input,select,textarea{font-family:Mulish,-apple-system,'Noto Serif SC',"PingFang SC","Microsoft Yahei UI","Microsoft Yahei",sans-serif}.ajaxcard:hover{transform:unset}</style><script>CUTEEN_SETTING={PJAX:!0,HERO_IMG:!0,IS_MOBILE:!1,NOPA:!1,SITE_URL:"https://www.heson10.com/",THEME_COLOR:0,STATIC_PATH:"/",AJAX_PAGE:!1,HEADROOM:!1,CDN_PATH:"",MUSICDATA1:"115762175",MUSICDATA2:"netease",QIPAO:!0}</script><body><div id="forpc" class="nav w100 fixed clearfix border-box haveimg nobg p1"><div class="flex justify-between mx-auto nav-content items-center"><ul class="bold table nowrap"><li class="pr1 h2 table-cell align-middle sitetitle"><a href="/">黑石博客</a></li><li class="xs-hide px1 h4 table-cell align-middle relative dropdown"><a>🔎找文章</a><div class="mt1 absolute dropblur rounded"><ul class="py1"><li><a class="block px2 p1" href="/archives/">📚归档</a></li><li><a class="block px2 p1" href="/tags/">🔖标签</a></li><li><a class="block px2 p1" href="/categories/">📦分类</a></li></ul></div></li><li class="xs-hide px1 h4 table-cell align-middle relative"><a href="/bb/" no-pjax>🔊哔哔</a></li><li class="xs-hide px1 h4 table-cell align-middle relative dropdown"><a>📑页面</a><div class="mt1 absolute dropblur rounded"><ul class="py1"><li><a class="block px2 p1" href="/guestbook/">📬留言板</a></li><li><a class="block px2 p1" href="/links/">🤝友链</a></li><li><a class="block px2 p1" href="/lovebb/" no-pjax>💕情侣哔哔</a></li><li><a class="block px2 p1" href="/about/">👑关于</a></li><li><a class="block px2 p1" target="_blank" href="https://github.com/heson525/myhexoblog/tree/main/source/_posts" rel="nofollow noopener">📝撰写</a></li></ul></div></li><li class="xs-hide px1 h4 table-cell align-middle relative dropdown"><a>🚩分站</a><div class="mt1 absolute dropblur rounded"><ul class="py1"><li><a class="block px2 p1" href="/volantis/" no-pjax>🛕Volantis主题</a></li><li><a class="block px2 p1" href="/next/" no-pjax>🕍Next主题</a></li></ul></div></li><li class="xs-hide px1 h4 table-cell align-middle relative"><a target="_blank" rel="noopener" href="https://yf.heson10.com/">💰 要饭2.0</a></li><li class="xs-hide px1 h4 table-cell align-middle relative"><a target="_blank" rel="noopener" href="https://box.heson10.com/">💖 百宝箱</a></li><li class="xs-hide px1 h4 table-cell align-middle relative"><a rel="noopener external nofollow noreferrer noopener" target="_blank" href="https://travellings.now.sh/">🚀 开往</a></li></ul><ul class="table"><li class="table-cell align-middle"><div id="CTPlayer" class="relative flex items-center"></div></li><a class="table-cell align-middle" href="javascript:void(0)" onclick="CuteenFunc.SwitchDarkMode()"><li class="center circle icon ml1 icon align-middle"><svg class="icon" aria-hidden="true"><use id="modeicon" xlink:href="#icon-_moon"></use></svg></li></a><a class="table-cell align-middle" href="#" data-izimodal-open="#searchbox" data-izimodal-transitionin="fadeInDown"><li class="center circle icon ml1 icon align-middle"><svg class="icon" aria-hidden="true" width="128" height="128"><use xlink:href="#icon-chazhao"></use></svg></li></a></ul></div></div><div id="formobile" class="d-n"><div class="nav w100 fixed clearfix border-box haveimg nobg p1"><div class="flex justify-between items-center z4 mobile_nav"><div id="left-menu" onclick="CuteenFunc.MobileMenu()" class="h3"><i class="fas fa-bars"></i></div><div class="pr1 h2 table-cell align-middle sitetitle"><a href="/">黑石博客</a></div><div class="h3"><a href="#" data-izimodal-open="#searchbox" data-izimodal-transitionin="fadeInDown"><i class="fas fa-search"></i></a></div></div></div><div id="mobar"><nav id="site-navigation" class="fixed top-0 bottom-0 z4 sidebar no-user-select"><div id="nav" class="h100 absolute top-0 bottom-0"><hr><div class="mt4"><div class="Nav_mobile_content flex justify-center items-center"><a onclick="CuteenFunc.MobileMenu()" class="Nav_mobile_logo block circle" href="/about/" style="background-image:url(https://cdn.jsdelivr.net/gh/heson525/pic@master/pic/avatar03.png)"></a></div></div><div class="h4 bold center">黑石博客</div><div class="h5 center mt1">人生在勤,不索何获</div><hr><div class="h6 p2"><li class="fas fa-stream pr1"></li>独立页面</div><li class="px3 py1 h5"><a class="ml2" href="/guestbook/" title="留言板">📬留言板</a></li><li class="px3 py1 h5"><a class="ml2" href="/links/" title="友链">🤝友链</a></li><li class="px3 py1 h5"><a class="ml2" href="/bb/" title="说说" no-pjax>🔊说说</a></li><li class="px3 py1 h5"><a class="ml2" href="/about/" title="关于">👑关于</a></li><li class="px3 py1 h5"><a class="ml2" target="_blank" rel="noopener" href="https://yf.heson10.com/" title="要饭">💰要饭</a></li><li class="px3 py1 h5"><a class="ml2" target="_blank" rel="noopener" href="https://box.heson10.com/" title="百宝箱">💖百宝箱</a></li><li class="px3 py1 h5 mobfl"><span class="ml2 mobzk flex justify-between items-center"><p>🔎找文章</p><i class="fas fa-angle-right"></i></span></li><ul class="mobzkcon pl3 h5" style="display:none"><li class="p1"><a onclick="CuteenFunc.MobileMenu()" class="ml3" href="/archives/" title="📚归档">📚归档</a></li><li class="p1"><a onclick="CuteenFunc.MobileMenu()" class="ml3" href="/tags/" title="🔖标签">🔖标签</a></li><li class="p1"><a onclick="CuteenFunc.MobileMenu()" class="ml3" href="/categories/" title="📦分类">📦分类</a></li></ul><hr><div class="h6 p2"><li class="fas fa-stream pr1"></li>分类页面</div><li class="px3 py1 h5"><a class="ml2" href="/categories/hexo/">🍰 HEXO</a></li><li class="px3 py1 h5"><a class="ml2" href="/categories/WordPress/">🍱 WordPress</a></li><li class="px3 py1 h5"><a class="ml2" href="/categories/生活随笔/" title="生活随笔">🍹 生活随笔</a></li><hr><div class="h6 p2"><li class="fas fa-stream pr1"></li>其他页面</div><li class="px3 py1 h5"><a class="ml2" target="_blank" rel="noopener" href="https://travellings.now.sh/" title="开往">🚀开往</a></li></div><div class="side-toolbar bottom-0 fixed flex items-center justify-center"><div id="CTPlayer-mob" class="relative flex items-center"></div></div></nav></div></div><div id="pjax"><div id="hero" class="w100 overflow-hidden flex relative mb2 pt4 hero-bai" style="height:600px"><div class="w100 h100 left-0 top-0 absolute hero-img"><img class="w100 h100 hero_image lazyload lazyload" data-src="https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/001.jpg" class="lazyload" data-srcset="https://cdn.jsdelivr.net/gh/volantis-x/cdn-wallpaper-minimalist/2020/001.jpg" srcset="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAAaADAAQAAAABAAAAAQAAAADa6r/EAAAAC0lEQVQIHWNgAAIAAAUAAY27m/MAAAAASUVORK5CYII="></div><div class="z4 relative hero-title p4 mb3 flex w100 justify-center self-center"><div class="bas-title center"><p class="big-title bold"></p></div></div></div><div class="card-box clearfix mx-auto"><div class="card-content mx-auto"><div id="qjcbl" class="qjcbl md-hide lg-col lg-col-3"><div id="sidebar"><div class="p1"><div class="mybox relative"><div class="widthhhh"><div class="style user-item"><div class="bg_xx"><div class="bg"></div></div><div class="user-bg"></div><a class="user-name" href="/about">黑石 (Heson)</a> <img alt="" src="https://cdn.jsdelivr.net/gh/heson525/pic@master/pic/avatar03.png" class="lazyload" data-srcset="https://cdn.jsdelivr.net/gh/heson525/pic@master/pic/avatar03.png" srcset="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAAaADAAQAAAABAAAAAQAAAADa6r/EAAAAC0lEQVQIHWNgAAIAAAUAAY27m/MAAAAASUVORK5CYII=" class="user-avatar lazyload" height="60" width="60"><p class="user_des">📣 <rainbow-text>一个专业折腾Hexo的博客</rainbow-text></p><div class="user_info"><li class="ptnum"><a href="/archives/">58<span>文章</span></a></li><li class="frinum"><a href="/categories/">17<span>分类</span></a></li><li class="vitnum"><a href="/tags/">95<span>标签</span></a></li></div></div></div></div></div><div class="p1"><div class="sidebar-1 mybox relative"><div class="widthhhh"><a title="Hexo博客新手建站交流qq群" target="_blank" rel="noopener" href="https://qm.qq.com/cgi-bin/qm/qr?k=2ymZ9hQ7tz9zykn3GMwk1nikIlBtDsxq&jump_from=webapi"><img style="border-radius:5px" src="https://cdn.jsdelivr.net/gh/heson10/pic@master/js/qun33.jpg" class="lazyload" data-srcset="https://cdn.jsdelivr.net/gh/heson10/pic@master/js/qun33.jpg" srcset="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAAaADAAQAAAABAAAAAQAAAADa6r/EAAAAC0lEQVQIHWNgAAIAAAUAAY27m/MAAAAASUVORK5CYII=" title="Hexo博客新手建站交流qq群" alt="Hexo博客新手建站交流qq群"></a></div></div></div><div class="p1"><div class="sidebar-1 mybox relative"><div class="p2"><i class="fab fa-facebook-messenger mr1"></i>最新回复</div><div id="hot-comments"></div></div></div></div></div><div class="cuteup xs-col-12 lg-col lg-col-9"><div class="mybox m1 mb2"><div class="Post_content_box"><article id="Post_wysiwyg" class="duta md"><!doctype html><html lang="en"><head><meta charset="utf-8"><title>404页面 - 黑石博客</title><link rel="stylesheet" media="screen" href="style.css"><script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script></head><body><div class="header" style="padding:12px 0 0 20px"><span style="font-size:25px">黑石博客</span></div><p class="error">404</p><div class="content"><h2>页面丢失了,正在光速跳转中...<span id="time"></span></h2><p class="text">Oooooops… 最近黑石博客换了域名,从heson.xyz换到 <a style="color:#fff" href="https://www.heson10.com">www.heson10.com</a>。</p></div><script language="javascript" type="text/javascript">setTimeout("javascript:location.href='https://www.heson10.com'",5e3)</script><script type="text/javascript">function time(t){$("#time").html("<font color='red'>"+t+"</font>"),t--,setTimeout(function(){time(t)},1e3)}$(function(){time(5)})</script></body></html></article></div></div><div class="mybox m1"><div class="center pt3 pb1"><p class="bold">—— 评论区 ——</p></div><section class="post white-box reveal" id="comments"><div id="tcomment" class="mx3 px3 pt2 pb3"></div></section></div></div></div></div><div id="RightDownBtn" class="fixed p1 yj shadow z4 flex flex-column flex-end"><a id="btn" href="javascript:void(0)" target="_self"><svg style="width:1.5em;height:1.5em" class="icon" aria-hidden="true"><use xlink:href="#icon-xuanfufanhuidingbu"></use></svg></a><div class="formobilenav d-d"><a href="javascript:void(0)" onclick="CuteenFunc.SwitchDarkMode()"><svg style="width:1.5em;height:1.5em" class="icon" aria-hidden="true"><use id="modeicon2" xlink:href="#icon-_moon"></use></svg></a></div><a id="right-menu" onclick='$("body").toggleClass("rightopen")'><svg style="width:1.5em;height:1.5em" class="icon" aria-hidden="true"><use xlink:href="#icon-ziliaoguizidongshengchengmulu"></use></svg></a></div></div><div id="searchbox"><div class="flex mx2 mb1 mt2"><div class="col-12" action=""><input autocomplete="off" id="local-search-input" class="input mr1 form-control" name="q" results="0" type="text" placeholder="请输入搜索关键词……" required><div id="local-search-result"></div></div></div><div class="px3 pb3 pt1"><div class="bold h3 mb1"><i class="fas fa-cloud"></i> 标签云</div><ul class="tag-list" itemprop="keywords"><li class="searchbox_tags"><a class="tag-list-link" href="/tags/hexo/" rel="tag">HEXO</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/%E5%93%94%E5%93%94/" rel="tag">哔哔</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/%E5%8D%9A%E5%AE%A2/" rel="tag">博客</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/%E4%B8%BB%E9%A2%98/" rel="tag">主题</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/%E6%90%AD%E5%BB%BA/" rel="tag">搭建</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/%E8%AF%B4%E8%AF%B4/" rel="tag">说说</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/next/" rel="tag">NEXT</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/%E9%83%A8%E7%BD%B2/" rel="tag">部署</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/%E7%BE%8E%E5%8C%96/" rel="tag">美化</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/%E5%AD%97%E4%BD%93/" rel="tag">字体</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/%E8%AF%84%E8%AE%BA/" rel="tag">评论</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/%E5%BE%AE%E4%BF%A1/" rel="tag">微信</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/CDN/" rel="tag">CDN</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/%E5%9B%BE%E7%89%87/" rel="tag">图片</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/%E7%BA%AA%E5%BF%B5/" rel="tag">纪念</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/SEO/" rel="tag">SEO</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/%E4%BC%98%E5%8C%96/" rel="tag">优化</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/cuteen/" rel="tag">CUTEEN</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/typecho/" rel="tag">TYPECHO</a></li><li class="searchbox_tags"><a class="tag-list-link" href="/tags/algolia/" rel="tag">ALGOLIA</a></li></ul></div></div><footer id="footer" class="mx-auto w100 p3 mt3"><div class="Footer_content center"><p class="h5">© 2020 - 2021<a href="https://www.heson10.com/">黑石博客</a></p><p class="h5"><a href="https://hexo.io/zh-cn/" rel="external nofollow" target="_blank">Hexo</a> 强力驱动 | 主题 <a href="https://blog.zwying.com/archives/39.html" rel="external nofollow" target="_blank">Cuteen</a> | 由 <a href="https://www.heson10.com" title="由 HESON 移植到 Hexo" target="_blank">Heson</a> 移植</p><p class="h5"><span id="lc-sv"><i class="fas fa-eye"></i> <span id="number"><i class="fas fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span> 次</span> <span id="lc-uv"> <i class="fas fa-user"></i> <span id="number"><i class="fas fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span> 人 | </span><span id="timeDate">载入天数...</span><span id="times">载入时分秒...</span></p><p class="h5"><svg style="width:1.5em;height:1.5em;vertical-align:middle" class="icon" aria-hidden="true"><use xlink:href="#icon-ICP"></use></svg> <a style="vertical-align:middle" href="https://beian.miit.gov.cn" target="_blank" rel="external nofollow">赣ICP备20008960号 </a><a href="https://www.upyun.com/?utm_source=lianmeng&utm_medium=referral" rel="external nofollow" target="_blank"><img style="vertical-align:middle" src="https://pic.heson10.com/wallpapers/yun_logo6.png" class="lazyload" data-srcset="https://pic.heson10.com/wallpapers/yun_logo6.png" srcset="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAAaADAAQAAAABAAAAAQAAAADa6r/EAAAAC0lEQVQIHWNgAAIAAAUAAY27m/MAAAAASUVORK5CYII="></a></p></div></footer><div id="post-menu" class="fixed top-0 bottom-0 h100 z1 table shadow"><div id="MENU"></div></div><script src="https://test1.jsdelivr.net/gh/zwying0814/Cuteen@v3.1.200810/Static/Js/code-and-copy.min.js"></script><link rel="stylesheet" href="https://test1.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.13.1/css/all.min.css" rel="stylesheet"><script async src="https://test1.jsdelivr.net/gh/zwying0814/Cuteen@v3.1.200810/Static/Js/Smooth.js"></script><script src="https://test1.jsdelivr.net/gh/zwying0814/Cuteen@v3.1.200810/Static/Js/circleMagic.min.js"></script><script async src="https://test1.jsdelivr.net/gh/zwying0814/Cuteen@v3.1.200810/Static/Js/Player.js"></script><script src="https://test1.jsdelivr.net/gh/zwying0814/Cuteen@v3.1.200810/Static/Js/sidebar-follow-jquery.js"></script><script src="https://test1.jsdelivr.net/npm/twikoo@1.2.0/dist/twikoo.all.min.js"></script><script src="/js/Main.js"></script><script src="https://test1.jsdelivr.net/gh/heson10/pic@master/js/issues.js"></script><script src="https://test1.jsdelivr.net/npm/jquery-pjax@2.0.1/jquery.pjax.min.js"></script><script>$(document).pjax('a:not(a[target="_blank"], a[no-pjax])',{container:"#pjax",fragment:"#pjax",timeout:8e3}).on("pjax:send",function(){before_pjax()}).on("pjax:complete",function(){after_pjax(),addAlt(),LCCounter.refreshCounter(),colortag(),newcomment(),"undefined"==typeof IssuesAPI&&loadIssuesJS(),_hmt.push(["_trackPageview",document.location.pathname])}).on("pjax:end",function(){end_pjax(),pjax_twikoo(),IssuesAPI.request(),dingwei(),pjax_fancybox()})</script><script defer>const LCCounter = {
app_id: 'C1qWqsDatomXVctTafBuJADI-gzGzoHsz',
app_key: 'J4CujIoElz1Wo7yLUbY4SOO5',
custom_api_server: 'https://valineapi.heson10.com',
// 查询存储的记录
getRecord(Counter, url, title) {
return new Promise(function (resolve, reject) {
Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify({url})))
.then(resp => resp.json())
.then(({results, code, error}) => {
if (code === 401) {
throw error;
}
if (results && results.length > 0) {
var record = results[0];
resolve(record);
} else {
Counter('post', '/classes/Counter', {url, title: title, times: 0})
.then(resp => resp.json())
.then((record, error) => {
if (error) {
throw error;
}
resolve(record);
}).catch(error => {
console.error('Failed to create', error);
reject(error);
});
}
}).catch((error) => {
console.error('LeanCloud Counter Error:', error);
reject(error);
});
})
},
// 发起自增请求
increment(Counter, incrArr) {
return new Promise(function (resolve, reject) {
Counter('post', '/batch', {
"requests": incrArr
}).then((res) => {
res = res.json();
if (res.error) {
throw res.error;
}
resolve(res);
}).catch((error) => {
console.error('Failed to save visitor count', error);
reject(error);
});
});
},
// 构建自增请求体
buildIncrement(objectId) {
return {
"method": "PUT",
"path": `/1.1/classes/Counter/${ objectId }`,
"body": {
"times": {
'__op': 'Increment',
'amount': 1
}
}
}
},
// 校验是否为有效的 UV
validUV() {
var key = 'LeanCloudUVTimestamp';
var flag = localStorage.getItem(key);
if (flag) {
// 距离标记小于 24 小时则不计为 UV
if (new Date().getTime() - parseInt(flag) <= 86400000) {
return false;
}
}
localStorage.setItem(key, new Date().getTime().toString());
return true;
},
addCount(Counter) {
var enableIncr = 'true' === 'true' && window.location.hostname !== 'localhost';
enableIncr = true;
var getterArr = [];
var incrArr = [];
// 请求 PV 并自增
var pvCtn = document.querySelector('#lc-sv');
if (pvCtn || enableIncr) {
var pvGetter = this.getRecord(Counter, 'https://www.heson10.com' + '/#lc-sv', 'Visits').then((record) => {
incrArr.push(this.buildIncrement(record.objectId))
var eles = document.querySelectorAll('#lc-sv #number');
if (eles.length > 0) {
eles.forEach((el,index,array)=>{
el.innerText = record.times + 1;
if (pvCtn) {
pvCtn.style.display = 'inline';
}
})
}
});
getterArr.push(pvGetter);
}
// 请求 UV 并自增
var uvCtn = document.querySelector('#lc-uv');
if (uvCtn || enableIncr) {
var uvGetter = this.getRecord(Counter, 'https://www.heson10.com' + '/#lc-uv', 'Visitors').then((record) => {
var vuv = this.validUV();
vuv && incrArr.push(this.buildIncrement(record.objectId))
var eles = document.querySelectorAll('#lc-uv #number');
if (eles.length > 0) {
eles.forEach((el,index,array)=>{
el.innerText = record.times + (vuv ? 1 : 0);
if (uvCtn) {
uvCtn.style.display = 'inline';
}
})
}
});
getterArr.push(uvGetter);
}
// 请求文章的浏览数,如果是当前页面就自增
var allPV = document.querySelectorAll('#lc-pv');
if (allPV.length > 0 || enableIncr) {
for (i = 0; i < allPV.length; i++) {
let pv = allPV[i];
let title = pv.getAttribute('data-title');
var url = 'https://www.heson10.com' + pv.getAttribute('data-path');
if (url) {
var viewGetter = this.getRecord(Counter, url, title).then((record) => {
// 是当前页面就自增
if (pv.getAttribute('data-path') == window.location.pathname) {
incrArr.push(this.buildIncrement(record.objectId));
}
if (pv) {
var ele = pv.querySelector('#lc-pv #number');
if (ele) {
if (pv.getAttribute('data-path') == window.location.pathname) {
ele.innerText = (record.times || 0) + 1;
} else {
ele.innerText = record.times || 0;
}
pv.style.display = 'inline';
}
}
});
getterArr.push(viewGetter);
}
}
}
// 如果启动计数自增,批量发起自增请求
if (enableIncr) {
Promise.all(getterArr).then(() => {
incrArr.length > 0 && this.increment(Counter, incrArr);
})
}
},
fetchData(api_server) {
var Counter = (method, url, data) => {
return fetch(`${ api_server }/1.1${ url }`, {
method,
headers: {
'X-LC-Id': this.app_id,
'X-LC-Key': this.app_key,
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
};
this.addCount(Counter);
},
refreshCounter() {
var api_server = this.app_id.slice(-9) !== '-MdYXbMMI' ? this.custom_api_server : `https://${ this.app_id.slice(0, 8).toLowerCase() }.api.lncldglobal.com`;
if (api_server) {
this.fetchData(api_server);
} else {
fetch('https://app-router.leancloud.cn/2/route?appId=' + this.app_id)
.then(resp => resp.json())
.then(({api_server}) => {
this.fetchData('https://' + api_server);
});
}
}
};
LCCounter.refreshCounter();</script></body></html>