cainiaoblog 23.2.171
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CNAME +1 -0
- package/MP_verify_o6dHCK5mIkxNpzvZ.txt +1 -0
- package/README.md +8 -0
- package/about/index.html +54 -0
- package/ads.txt +1 -0
- package/app/manual.html +104 -0
- package/appConfigs/config +1 -0
- package/archives/2018/index.html +48 -0
- package/archives/2019/index.html +48 -0
- package/archives/2019/page/2/index.html +48 -0
- package/archives/2020/index.html +48 -0
- package/archives/2021/index.html +48 -0
- package/archives/2022/index.html +48 -0
- package/archives/2023/index.html +48 -0
- package/archives/index.html +48 -0
- package/archives/page/2/index.html +48 -0
- package/archives/page/3/index.html +48 -0
- package/article/10047.html +148 -0
- package/article/10164.html +64 -0
- package/article/10624.html +436 -0
- package/article/10745.html +586 -0
- package/article/11674.html +71 -0
- package/article/11939.html +72 -0
- package/article/12238.html +86 -0
- package/article/1230.html +533 -0
- package/article/13265.html +69 -0
- package/article/13823.html +78 -0
- package/article/14125.html +72 -0
- package/article/14192.html +561 -0
- package/article/14375.html +85 -0
- package/article/14744.html +83 -0
- package/article/14936.html +451 -0
- package/article/1518.html +250 -0
- package/article/15428.html +71 -0
- package/article/15518.html +288 -0
- package/article/15569.html +418 -0
- package/article/1566.html +122 -0
- package/article/16017.html +156 -0
- package/article/16947.html +440 -0
- package/article/17096.html +82 -0
- package/article/17246.html +89 -0
- package/article/17575.html +350 -0
- package/article/179.html +757 -0
- package/article/18039.html +233 -0
- package/article/18071.html +375 -0
- package/article/18142.html +71 -0
- package/article/19909.html +160 -0
- package/article/20014.html +89 -0
- package/article/20021.html +389 -0
- package/article/20037.html +280 -0
- package/article/20056.html +95 -0
- package/article/20093.html +404 -0
- package/article/2021.html +607 -0
- package/article/20459.html +115 -0
- package/article/20613.html +263 -0
- package/article/20635.html +71 -0
- package/article/21317.html +71 -0
- package/article/21320.html +90 -0
- package/article/21782.html +548 -0
- package/article/22230.html +435 -0
- package/article/22237.html +347 -0
- package/article/22398.html +109 -0
- package/article/22422.html +270 -0
- package/article/22565.html +300 -0
- package/article/23046.html +250 -0
- package/article/23083.html +215 -0
- package/article/23195.html +297 -0
- package/article/23301.html +835 -0
- package/article/23589.html +285 -0
- package/article/23655.html +338 -0
- package/article/23864.html +76 -0
- package/article/23914.html +96 -0
- package/article/24169.html +135 -0
- package/article/24581.html +349 -0
- package/article/2475.html +500 -0
- package/article/24826.html +77 -0
- package/article/24924.html +247 -0
- package/article/25164.html +1495 -0
- package/article/25318.html +394 -0
- package/article/25710.html +1129 -0
- package/article/25734.html +83 -0
- package/article/26083.html +174 -0
- package/article/26147.html +283 -0
- package/article/26291.html +110 -0
- package/article/26354.html +71 -0
- package/article/26624.html +145 -0
- package/article/26639.html +298 -0
- package/article/26850.html +138 -0
- package/article/26940.html +258 -0
- package/article/27796.html +190 -0
- package/article/27800.html +161 -0
- package/article/28963.html +159 -0
- package/article/28976.html +247 -0
- package/article/29042.html +72 -0
- package/article/29596.html +81 -0
- package/article/29619.html +183 -0
- package/article/29623.html +329 -0
- package/article/29829.html +205 -0
- package/article/29abbd1c.html +112 -0
- package/article/30215.html +178 -0
- package/article/30552.html +78 -0
- package/article/30818.html +201 -0
- package/article/31330.html +364 -0
- package/article/3154.html +577 -0
- package/article/31695.html +348 -0
- package/article/31826.html +71 -0
- package/article/31843.html +132 -0
- package/article/32280.html +212 -0
- package/article/32431.html +74 -0
- package/article/32443.html +72 -0
- package/article/32732.html +122 -0
- package/article/3286.html +251 -0
- package/article/32960.html +198 -0
- package/article/33713.html +72 -0
- package/article/33899.html +615 -0
- package/article/34351.html +74 -0
- package/article/34372.html +89 -0
- package/article/34410.html +74 -0
- package/article/34431.html +118 -0
- package/article/3447.html +75 -0
- package/article/34474.html +142 -0
- package/article/34871.html +147 -0
- package/article/35397.html +175 -0
- package/article/3544.html +199 -0
- package/article/35503.html +115 -0
- package/article/35624.html +84 -0
- package/article/35697.html +384 -0
- package/article/35863.html +73 -0
- package/article/36037.html +253 -0
- package/article/36118.html +71 -0
- package/article/3621.html +119 -0
- package/article/36251.html +296 -0
- package/article/36642.html +352 -0
- package/article/37102.html +763 -0
- package/article/37336.html +351 -0
- package/article/37351.html +89 -0
- package/article/3760.html +294 -0
- package/article/37749.html +75 -0
- package/article/37789.html +83 -0
- package/article/38005.html +765 -0
- package/article/38009.html +284 -0
- package/article/38269.html +194 -0
- package/article/38344.html +88 -0
- package/article/38359.html +334 -0
- package/article/38423.html +379 -0
- package/article/38530.html +213 -0
- package/article/38743.html +268 -0
- package/article/38753.html +204 -0
- package/article/38881.html +71 -0
- package/article/39087.html +414 -0
- package/article/39309.html +84 -0
- package/article/39486.html +74 -0
- package/article/39637.html +306 -0
- package/article/39839.html +72 -0
- package/article/39937.html +152 -0
- package/article/39970.html +71 -0
- package/article/402.html +559 -0
- package/article/40698.html +71 -0
- package/article/40811.html +71 -0
- package/article/40964.html +462 -0
- package/article/41011.html +322 -0
- package/article/41152.html +78 -0
- package/article/41696.html +71 -0
- package/article/41717.html +281 -0
- package/article/41777.html +149 -0
- package/article/419.html +985 -0
- package/article/4233.html +136 -0
- package/article/4292.html +86 -0
- package/article/43302.html +96 -0
- package/article/43397.html +106 -0
- package/article/43724.html +281 -0
- package/article/43999.html +224 -0
- package/article/44426.html +77 -0
- package/article/44964.html +137 -0
- package/article/45004.html +123 -0
- package/article/4510.html +83 -0
- package/article/45156.html +320 -0
- package/article/45157.html +52 -0
- package/article/45267.html +87 -0
- package/article/45641.html +207 -0
- package/article/45960.html +75 -0
- package/article/46100.html +1262 -0
- package/article/46366.html +74 -0
- package/article/46771.html +96 -0
- package/article/46911.html +517 -0
- package/article/46948.html +137 -0
- package/article/46ee4850.html +349 -0
- package/article/47019.html +84 -0
- package/article/47532.html +94 -0
- package/article/4783.html +429 -0
- package/article/47972.html +72 -0
- package/article/48216.html +127 -0
- package/article/48252.html +185 -0
- package/article/48520.html +74 -0
- package/article/48722.html +75 -0
- package/article/48807.html +99 -0
- package/article/49126.html +323 -0
- package/article/50001.html +88 -0
- package/article/50058.html +151 -0
- package/article/50343.html +410 -0
- package/article/50510.html +82 -0
- package/article/51082.html +98 -0
- package/article/51677.html +111 -0
- package/article/5204.html +1085 -0
- package/article/52500.html +538 -0
- package/article/52689.html +259 -0
- package/article/52877.html +569 -0
- package/article/53125.html +191 -0
- package/article/53428.html +251 -0
- package/article/53524.html +74 -0
- package/article/53698.html +322 -0
- package/article/53803e6.html +93 -0
- package/article/53924.html +291 -0
- package/article/53962.html +253 -0
- package/article/54006.html +71 -0
- package/article/54018.html +88 -0
- package/article/54161.html +83 -0
- package/article/54178.html +69 -0
- package/article/54258.html +327 -0
- package/article/54295.html +214 -0
- package/article/54313.html +1976 -0
- package/article/54351.html +90 -0
- package/article/54604.html +80 -0
- package/article/54632.html +71 -0
- package/article/54912.html +756 -0
- package/article/54918.html +129 -0
- package/article/55119.html +136 -0
- package/article/55756.html +118 -0
- package/article/55769.html +136 -0
- package/article/55870.html +161 -0
- package/article/56139.html +92 -0
- package/article/56557.html +69 -0
- package/article/56604.html +69 -0
- package/article/56816.html +266 -0
- package/article/56926.html +153 -0
- package/article/57747.html +409 -0
- package/article/57965.html +475 -0
- package/article/58816.html +78 -0
- package/article/59059.html +435 -0
- package/article/59095.html +350 -0
- package/article/59349.html +244 -0
- package/article/59402.html +216 -0
- package/article/59448.html +55 -0
- package/article/59870.html +94 -0
- package/article/59877.html +208 -0
- package/article/5dbb6f41.html +86 -0
- package/article/6008.html +75 -0
- package/article/60327.html +126 -0
- package/article/6035.html +76 -0
- package/article/60428.html +71 -0
- package/article/60544.html +128 -0
- package/article/61319.html +95 -0
- package/article/61367.html +93 -0
- package/article/624d1918.html +292 -0
- package/article/62543.html +71 -0
- package/article/62887.html +169 -0
- package/article/63074.html +120 -0
- package/article/63266.html +311 -0
- package/article/63351.html +74 -0
- package/article/63542.html +104 -0
- package/article/63824.html +275 -0
- package/article/64051.html +653 -0
- package/article/64189b69.html +72 -0
- package/article/64354.html +75 -0
- package/article/64869.html +79 -0
- package/article/64923.html +596 -0
- package/article/65128.html +95 -0
- package/article/65295.html +79 -0
- package/article/6888.html +75 -0
- package/article/7065.html +84 -0
- package/article/7455.html +85 -0
- package/article/7a3ef8f.html +315 -0
- package/article/8140.html +188 -0
- package/article/8190.html +85 -0
- package/article/8225.html +78 -0
- package/article/84c9ccd6.html +159 -0
- package/article/8f9a9ae3.html +82 -0
- package/article/9174.html +73 -0
- package/article/9738.html +294 -0
- package/article/a4145266.html +71 -0
- package/article/bedea419.html +72 -0
- package/article/bf7e7421.html +78 -0
- package/article/c1867fbf.html +103 -0
- package/article/c5576490.html +70 -0
- package/article/dcb0db28.html +76 -0
- package/article/fc3b727a.html +79 -0
- package/atom.xml +445 -0
- package/baidusitemap.xml +1079 -0
- package/blocks/dns.txt +264 -0
- package/blocks/filter.txt +1070 -0
- package/blocks/script.js +42 -0
- package/categories/CDN/index.html +48 -0
- package/categories/IDE/index.html +48 -0
- package/categories/git/index.html +48 -0
- package/categories/hexo/index.html +48 -0
- package/categories//345/205/254/345/205/261/350/212/202/346/227/245/index.html +48 -0
- package/categories//345/210/206/344/272/253/index.html +48 -0
- package/categories//345/211/215/347/253/257/index.html +48 -0
- package/categories//345/211/215/347/253/257/page/2/index.html +48 -0
- package/categories//345/211/215/347/253/257//346/265/217/350/247/210/345/231/250/index.html +48 -0
- package/categories//345/211/215/347/253/257//346/265/217/350/247/210/345/231/250//347/275/221/347/273/234/345/215/217/350/256/256/index.html +48 -0
- package/categories//345/215/232/345/256/242/index.html +48 -0
- package/categories//345/267/245/345/205/267/index.html +48 -0
- package/categories//345/271/277/345/221/212/350/277/207/346/273/244/index.html +48 -0
- package/categories//345/271/277/345/221/212/350/277/207/346/273/244//350/247/206/351/242/221/347/224/265/350/247/206/345/260/217/350/257/264/346/274/253/347/224/273/350/265/204/350/256/257/351/237/263/344/271/220/index.html +48 -0
- package/categories//346/255/243/345/210/231/index.html +48 -0
- package/categories//346/265/217/350/247/210/345/231/250/index.html +48 -0
- package/categories//347/256/227/346/263/225/index.html +48 -0
- package/categories//350/265/204/350/256/257/index.html +48 -0
- package/categories//350/275/273/346/235/276/344/270/200/345/210/273/index.html +48 -0
- package/cdn/css/font-awesome.min.css +4 -0
- package/cdn/css/grids-responsive-min.css +7 -0
- package/cdn/css/normalize.css +349 -0
- package/cdn/css/pure-min.css +11 -0
- package/cdn/fonts/fontawesome-webfont.eot +0 -0
- package/cdn/fonts/fontawesome-webfont.svg +2671 -0
- package/cdn/fonts/fontawesome-webfont.ttf +0 -0
- package/cdn/fonts/fontawesome-webfont.woff +0 -0
- package/cdn/fonts/fontawesome-webfont.woff2 +0 -0
- package/cdn/js/Valine.min.js +17 -0
- package/cdn/js/canvas-nest.js +1 -0
- package/cdn/js/clipboard.min.js +7 -0
- package/cdn/js/crypto-js.js +25 -0
- package/cdn/js/jquery.min.js +2 -0
- package/css/default.css +1144 -0
- package/css/donate.css +338 -0
- package/css/hbe.style.css +749 -0
- package/css/style.css +2095 -0
- package/donate/index.html +39 -0
- package/google917dcf72f6e5c7f5.html +1 -0
- package/guestbook/index.html +68 -0
- package/hosts/ads.txt +149 -0
- package/hosts/flash.txt +9 -0
- package/hosts/github.txt +6 -0
- package/hosts/google.txt +16936 -0
- package/hosts/winrar.txt +2 -0
- package/img/alipay.svg +46 -0
- package/img/bitcoin.svg +135 -0
- package/img/blog.ico +0 -0
- package/img/blog.png +0 -0
- package/img/gaba.png +0 -0
- package/img/github.svg +1 -0
- package/img/like.svg +1 -0
- package/img/mp-mini.jpg +0 -0
- package/img/mp.png +0 -0
- package/img/paypal.svg +63 -0
- package/img/upy_logo.svg +59 -0
- package/img/wechat.svg +49 -0
- package/index.html +48 -0
- package/jd_root.txt +1 -0
- package/js/codeblock-resizer.js +51 -0
- package/js/dark.js +12 -0
- package/js/donate.js +87 -0
- package/js/fixedPage.js +106 -0
- package/js/gitment.browser.js +3751 -0
- package/js/search.js +86 -0
- package/js/share.js +60 -0
- package/js/smartresize.js +32 -0
- package/js/totop.js +12 -0
- package/kankan/index.html +77 -0
- package/lib/hbe.js +293 -0
- package/package.json +25 -0
- package/page/10/index.html +49 -0
- package/page/11/index.html +59 -0
- package/page/12/index.html +67 -0
- package/page/13/index.html +63 -0
- package/page/14/index.html +66 -0
- package/page/15/index.html +60 -0
- package/page/16/index.html +60 -0
- package/page/17/index.html +62 -0
- package/page/18/index.html +61 -0
- package/page/19/index.html +58 -0
- package/page/2/index.html +48 -0
- package/page/20/index.html +57 -0
- package/page/21/index.html +61 -0
- package/page/22/index.html +55 -0
- package/page/23/index.html +64 -0
- package/page/24/index.html +60 -0
- package/page/25/index.html +58 -0
- package/page/26/index.html +48 -0
- package/page/27/index.html +58 -0
- package/page/3/index.html +48 -0
- package/page/4/index.html +48 -0
- package/page/5/index.html +51 -0
- package/page/6/index.html +51 -0
- package/page/7/index.html +51 -0
- package/page/8/index.html +53 -0
- package/page/9/index.html +48 -0
- package/randomcall/README.html +1 -0
- package/randomcall/lucker.html +290 -0
- package/randomcall/lucky.png +0 -0
- package/robots.txt +22 -0
- package/search.xml +6740 -0
- package/sitemap.xml +2669 -0
- package/tags//345/216/237/345/210/233/index.html +48 -0
- package/tags//345/250/261/344/271/220/index.html +48 -0
- package/tags//346/211/213/345/206/231/index.html +48 -0
- package/tags//347/226/253/346/203/205/index.html +48 -0
- package/tags//350/275/254/350/275/275/index.html +48 -0
- package/tags//350/275/254/350/275/275/page/2/index.html +48 -0
- package/v.html +90 -0
package/js/search.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
var searchFunc = function(path, search_id, content_id) {
|
|
2
|
+
'use strict';
|
|
3
|
+
$.ajax({
|
|
4
|
+
url: path,
|
|
5
|
+
dataType: "xml",
|
|
6
|
+
success: function( xmlResponse ) {
|
|
7
|
+
// get the contents from search data
|
|
8
|
+
var datas = $( "entry", xmlResponse ).map(function() {
|
|
9
|
+
return {
|
|
10
|
+
title: $("title", this).text(),
|
|
11
|
+
content: $("content", this).text(),
|
|
12
|
+
url: $("url", this).text()
|
|
13
|
+
};
|
|
14
|
+
}).get();
|
|
15
|
+
var $input = document.getElementById(search_id);
|
|
16
|
+
var $resultContent = document.getElementById(content_id);
|
|
17
|
+
$input.addEventListener('input', function(){
|
|
18
|
+
var str='<ul class=\"search-result-list\">';
|
|
19
|
+
var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
|
|
20
|
+
$resultContent.innerHTML = "";
|
|
21
|
+
if (this.value.trim().length <= 0) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
// perform local searching
|
|
25
|
+
datas.forEach(function(data) {
|
|
26
|
+
var isMatch = true;
|
|
27
|
+
var content_index = [];
|
|
28
|
+
var data_title = data.title.trim().toLowerCase();
|
|
29
|
+
var data_content = data.content.trim().replace(/<[^>]+>/g,"").toLowerCase();
|
|
30
|
+
var data_url = data.url;
|
|
31
|
+
var index_title = -1;
|
|
32
|
+
var index_content = -1;
|
|
33
|
+
var first_occur = -1;
|
|
34
|
+
// only match artiles with not empty titles and contents
|
|
35
|
+
if(data_title != '' && data_content != '') {
|
|
36
|
+
keywords.forEach(function(keyword, i) {
|
|
37
|
+
index_title = data_title.indexOf(keyword);
|
|
38
|
+
index_content = data_content.indexOf(keyword);
|
|
39
|
+
if( index_title < 0 && index_content < 0 ){
|
|
40
|
+
isMatch = false;
|
|
41
|
+
} else {
|
|
42
|
+
if (index_content < 0) {
|
|
43
|
+
index_content = 0;
|
|
44
|
+
}
|
|
45
|
+
if (i == 0) {
|
|
46
|
+
first_occur = index_content;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// show search results
|
|
52
|
+
if (isMatch) {
|
|
53
|
+
str += "<li><a href='"+ data_url +"' class='search-result-title'>"+ data_title +"</a>";
|
|
54
|
+
var content = data.content.trim().replace(/<[^>]+>/g,"");
|
|
55
|
+
if (first_occur >= 0) {
|
|
56
|
+
// cut out 100 characters
|
|
57
|
+
var start = first_occur - 30;
|
|
58
|
+
var outLength = 78;
|
|
59
|
+
if(start < 0){
|
|
60
|
+
start = 0;
|
|
61
|
+
}
|
|
62
|
+
if (start + outLength > content.length){
|
|
63
|
+
if(content.length < outLength){
|
|
64
|
+
outLength = content.length - start;
|
|
65
|
+
}else{
|
|
66
|
+
start = content.length - outLength;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
var match_content = content.substr(start, outLength);
|
|
70
|
+
// highlight all keywords
|
|
71
|
+
keywords.forEach(function(keyword){
|
|
72
|
+
var regS = new RegExp(keyword, "gi");
|
|
73
|
+
match_content = match_content.replace(regS, "<em class=\"search-keyword\">"+keyword+"</em>");
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
str += "<p class=\"search-result\">" + match_content +"...</p>"
|
|
77
|
+
}
|
|
78
|
+
str += "</li>";
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
str += "</ul>";
|
|
82
|
+
$resultContent.innerHTML = str;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
package/js/share.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
(function ($) {
|
|
2
|
+
|
|
3
|
+
// article-share
|
|
4
|
+
$('body').on('click', function () {
|
|
5
|
+
$('.article-share-box.on').removeClass('on');
|
|
6
|
+
}).on('click', '.article-share-link', function (e) {
|
|
7
|
+
e.stopPropagation();
|
|
8
|
+
|
|
9
|
+
var $this = $(this),
|
|
10
|
+
url = $this.attr('data-url'),
|
|
11
|
+
qrcode_img = $this.attr('data-qrcode'),
|
|
12
|
+
encodedUrl = encodeURIComponent(url),
|
|
13
|
+
id = 'article-share-box-' + $this.attr('data-id'),
|
|
14
|
+
title = document.title,
|
|
15
|
+
offset = $this.offset();
|
|
16
|
+
|
|
17
|
+
if ($('#' + id).length) {
|
|
18
|
+
var box = $('#' + id);
|
|
19
|
+
|
|
20
|
+
if (box.hasClass('on')) {
|
|
21
|
+
box.removeClass('on');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
var html = [
|
|
26
|
+
'<div id="' + id + '" class="article-share-box">',
|
|
27
|
+
'<input class="article-share-input" value="' + url + '">',
|
|
28
|
+
'<div class="article-share-links">',
|
|
29
|
+
'<a href="//twitter.com/intent/tweet?url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>',
|
|
30
|
+
'<a href="//www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>',
|
|
31
|
+
'<a href="//service.weibo.com/share/share.php?title=' + title + '&url=' + encodedUrl + '&searchPic=true&style=number' + '" class="article-share-weibo" target="_blank" title="Weibo"></a>',
|
|
32
|
+
'<a href="javascript:" class="article-share-qrcode" target="_self"></a>',
|
|
33
|
+
'<div class="qrcode"><img src=' + qrcode_img + ' alt=""></div>',
|
|
34
|
+
'</div>',
|
|
35
|
+
'</div>'
|
|
36
|
+
].join('');
|
|
37
|
+
|
|
38
|
+
var box = $(html);
|
|
39
|
+
|
|
40
|
+
$('body').append(box);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
$('.article-share-box.on').hide();
|
|
44
|
+
|
|
45
|
+
box.css({
|
|
46
|
+
top: offset.top + 25,
|
|
47
|
+
left: offset.left
|
|
48
|
+
}).addClass('on');
|
|
49
|
+
}).on('click', '.article-share-box', function (e) {
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
}).on('click', '.article-share-box-input', function () {
|
|
52
|
+
$(this).select();
|
|
53
|
+
}).on('click', '.article-share-box-link', function (e) {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
|
|
57
|
+
window.open(this.href, 'article-share-box-window-' + Date.now(), 'width=500,height=450');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
})(jQuery);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
+(function($, sr) {
|
|
2
|
+
// debouncing function from John Hann
|
|
3
|
+
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
|
|
4
|
+
var debounce = function(func, threshold, execAsap) {
|
|
5
|
+
var timeout;
|
|
6
|
+
|
|
7
|
+
return function debounced() {
|
|
8
|
+
var obj = this, args = arguments;
|
|
9
|
+
|
|
10
|
+
function delayed() {
|
|
11
|
+
if (!execAsap) {
|
|
12
|
+
func.apply(obj, args);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
timeout = null;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
if (timeout) {
|
|
19
|
+
clearTimeout(timeout);
|
|
20
|
+
}
|
|
21
|
+
else if (execAsap) {
|
|
22
|
+
func.apply(obj, args);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
timeout = setTimeout(delayed, threshold || 100);
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
jQuery.fn[sr] = function(fn) {
|
|
30
|
+
return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr);
|
|
31
|
+
};
|
|
32
|
+
})(jQuery, 'smartresize');
|
package/js/totop.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
$(window).scroll(function() {
|
|
2
|
+
$(window).scrollTop() > 500 ? $("#rocket").addClass("show") : $("#rocket").removeClass("show");
|
|
3
|
+
});
|
|
4
|
+
$("#rocket").click(function() {
|
|
5
|
+
$("#rocket").addClass("launch");
|
|
6
|
+
$("html, body").animate({
|
|
7
|
+
scrollTop: 0
|
|
8
|
+
}, 500, function() {
|
|
9
|
+
$("#rocket").removeClass("show launch");
|
|
10
|
+
});
|
|
11
|
+
return false;
|
|
12
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<!DOCTYPE html><html lang="zh-CN" data-dark><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"><meta content="yes" name="apple-mobile-web-app-capable"><meta content="black-translucent" name="apple-mobile-web-app-status-bar-style"><meta content="telephone=no" name="format-detection"><meta name="description" content="前端壹菜鸟,记录工作难题,关注前端知识,收集精彩博文,做技术的搬运工"><meta name="msvalidate.01" content="0FE4D8B3381D3D87088996B886E1E2BD"><title> | 前端壹菜鸟</title><link rel="stylesheet" type="text/css" href="//cdn.staticaly.com/gh/npljy/npljy.github.io/main/css/style.min.css"><link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/normalize.css@latest/normalize.min.css"><link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/purecss@latest/build/pure-min.min.css"><link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/purecss@latest/build/grids-responsive-min.css"><link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css"><link rel="icon" mask="" sizes="any" href="//cdn.staticaly.com/gh/npljy/npljy.github.io/main/img/blog.ico"><link rel="Shortcut Icon" type="image/x-icon" href="//cdn.staticaly.com/gh/npljy/npljy.github.io/main/img/blog.ico"><link rel="apple-touch-icon" href="//cdn.staticaly.com/gh/npljy/npljy.github.io/main/img/blog.png"><link rel="apple-touch-icon-precomposed" href="//cdn.staticaly.com/gh/npljy/npljy.github.io/main/img/blog.png"><link rel="alternate" type="application/atom+xml" href="/atom.xml"><script type="text/javascript" src="//cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8385136408348258"></script><script src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" async></script><script>(function(){
|
|
2
|
+
var bp = document.createElement('script');
|
|
3
|
+
var curProtocol = window.location.protocol.split(':')[0];
|
|
4
|
+
if (curProtocol === 'https'){
|
|
5
|
+
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
|
|
6
|
+
}
|
|
7
|
+
else{
|
|
8
|
+
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
|
|
9
|
+
}
|
|
10
|
+
var s = document.getElementsByTagName("script")[0];
|
|
11
|
+
s.parentNode.insertBefore(bp, s);
|
|
12
|
+
})();
|
|
13
|
+
</script><script>(function(){
|
|
14
|
+
var src = 'https://jspassport.ssl.qhimg.com/11.0.1.js?d182b3f28525f2db83acfaaf6e696dba';
|
|
15
|
+
document.write('<script src="' + src + '" id="sozz"><\/script>');
|
|
16
|
+
})();
|
|
17
|
+
</script><script>var _hmt=_hmt||[];(function(){var hm=document.createElement("script");hm.src='https://hm.baidu.com/hm.js?011f0b44e8452bfa57fbfa23c5fe7683';var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm, s);})();
|
|
18
|
+
</script><script async src="https://www.googletagmanager.com/gtag/js?id=UA-150860401-1"></script><script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);};gtag('js',new Date());gtag('config','UA-150860401-1');
|
|
19
|
+
</script><script type="text/javascript" src="//cdn.staticaly.com/gh/npljy/npljy.github.io/main/js/fixedPage.min.js"></script><meta name="generator" content="Hexo 6.3.0"></head><body><div class="body_container"><div id="header"><div class="site-name"><a id="logo" href="/.">前端壹菜鸟</a><p class="description">关注前端知识,收集精彩博文,做技术的搬运工</p></div><div id="nav-menu"><a href="/." target="_self"><i class="fa fa-home"> 首页</i></a><a href="/archives/" target="_self"><i class="fa fa-archive"> 归档</i></a><a href="/guestbook/" target="_self"><i class="fa fa-comments"> 留言</i></a><a href="/about/" target="_self"><i class="fa fa-user"> 关于</i></a><a href="https://laonongmin.online/" target="_target"><i class="fa fa-group"> 看看</i></a><a href="https://love.xuehuayu.cn/" target="_target"><i class="fa fa-heart"> LOVE</i></a></div></div><div class="pure-g" id="layout"><div class="pure-u-1 pure-u-md-3-4"><div class="content_container"><div class="post"><h2 class="post-title c-page"></h2><div class="post-content"><!DOCTYPE html>
|
|
20
|
+
<html>
|
|
21
|
+
|
|
22
|
+
<head>
|
|
23
|
+
<meta charset="UTF-8">
|
|
24
|
+
<meta http-equiv="pragma" content="no-cache">
|
|
25
|
+
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
|
|
26
|
+
<link rel="icon" sizes="any" mask="" href="https://i.niupic.com/images/2022/12/09/abU8.jpg">
|
|
27
|
+
<title>看看</title>
|
|
28
|
+
<style type="text/css">*{box-sizing:border-box;-webkit-box-sizing:border-box}body,html{margin:0;padding:0;background-color:#fff;font-size:14px}a{text-decoration:none}.main{padding:0}.info,.main{height:100%}img[src=""]{opacity:0}.bottom-wrap .head-content *,.list-wrap ul li,.logo-wrap *{vertical-align:middle}.downloads-content .package,.pc-info .mask{visibility:hidden}.main{text-align:center;margin:0 auto;max-width:100%;width:700px}.info{position:relative}.downloads-wrap,.logo-wrap{width:100%}.downloads-wrap{bottom:0;position:absolute}.logo-wrap{padding-top:30px}.logo-wrap>img{border-radius:5px;width:79px;height:79px}.logo-wrap h2{font-size:18px;color:#2a2a2a;font-weight:700}.desc-content h2,.screenshots-content h2{font-weight:400;font-size:15px;color:#2a2a2a}.logo-wrap p{margin-top:21px;font-size:18px;font-weight:400;color:#2a2a2a;padding:0 20px}.logo-wrap #show_qrcode{display:block;font-size:10px;color:#007aff;text-decoration:none;margin-top:28px}.logo-wrap #show_qrcode>img{width:11px;height:11px}.logo-wrap #show_qrcode>span{display:inline-block;margin-left:10px}.command-content p{display:inline-block;font-size:12px;color:#2a2a2a}.command-content .stream-token{font-size:12px;color:#2a2a2a;background-color:#f8f8f8;border-radius:3px;padding:5px}.command-content a{display:inline-block;font-size:11px;color:#007aff;width:50px}.qrcode-content{display:none;margin-top:50px;margin-bottom:20px;font-size:20px}.qrcode-content img{width:120px;height:120px}.qrcode-content span{display:block}.qrcode-content .code{display:inline-block;color:#007aff}.qrcode-content p{margin:0;padding:0;display:inline-block}.btn-primary,.btn-secondary{background-color:#007aff;color:#fff;margin-top:10px}.btn{font-size:12px;width:288px;height:40px;line-height:40px;border-radius:5px;outline:0}.btn-primary{border:1px solid #007aff}.btn-secondary{border:1px solid #fff;margin-bottom:10px}.btn.stream{background-color:#fff;color:#007aff}.more img{height:10px;margin-bottom:5px}.more.down img{transform:rotateX(0)}.more.up img{transform:rotateX(180deg)}.screenshots-content{border-top:1px solid #bfbfbf;margin:0 15px;padding:0 24px;position:relative}.screenshots-content h2{margin-top:40px;margin-bottom:21px;text-align:left}.list-wrap{overflow-x:auto;white-space:nowrap;margin-bottom:36px;margin-left:39px}.list-wrap ul{display:block;list-style:none;white-space:nowrap;-webkit-padding-start:0;-moz-padding-start:0}.bottom-wrap .tips-content .tip-desc,.desc-content pre{white-space:pre-wrap;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;word-break:break-all}.list-wrap ul li{display:inline-block;margin:0 9px}.list-wrap ul li:first-child{margin:0 9px 0 0}.list-wrap ul li img{width:176px;height:311px;border:1px solid #949494}.desc-content{border-top:1px solid #bfbfbf;margin:0 15px 36px;padding:0 24px;text-align:center}.desc-content h2{margin-top:40px;margin-bottom:21px;text-align:left}.desc-content pre{width:100%;font-size:14px;color:#2a2a2a;text-align:left}.footer{text-align:center;padding:20px;border-top:1px solid #dae2e3}.show{display:block}.hide{display:none!important}.overlay{width:100%;height:100%;left:0;top:0;background:rgba(0,0,0,.6);z-index:200;position:fixed}.bottom-wrap{position:absolute;bottom:0;z-index:201;width:100%;padding-bottom:18px;background-color:#fff}.bottom-wrap .head-content{padding:12px 0;text-align:left;margin-left:21px}.bottom-wrap .head-content img{display:inline-block;width:28px;height:28px}.bottom-wrap .head-content h2{display:inline-block;font-size:15px;font-weight:700;color:#313131;margin-left:10px}.bottom-wrap .tips-content{text-align:left;margin-left:21px;margin-right:21px;border-top:1px solid #bfbfbf}.bottom-wrap .tips-content .tip-desc{font-size:13px}.bottom-wrap .tips-content .tip-title{font-size:14px;color:#313131;margin:8px 0 0;font-weight:400}.bottom-wrap .tips-content .tip-token{font-size:13px;color:#313131;margin:8px 0 0;display:inline-block;padding:3px;background-color:#96d2fa}.bottom-wrap .tips-content .tip-guide{font-size:14px;margin:8px 0 0}.bottom-wrap .tips-content .guide-launch{margin:15px 0}.bottom-wrap .tips-content ul{-webkit-padding-start:21px}.bottom-wrap .tips-content ul li{margin:0;padding:0;-webkit-padding-start:0}.bottom-wrap button{width:327px}.qrcode-wrap{position:absolute;width:320px;height:350px;background-color:#fff;top:50%;left:50%;margin-top:-164px;margin-left:-160px;border-radius:5px}.qrcode-wrap div.close{display:block;width:30px;height:30px;position:absolute;right:15px;top:10px}.qrcode-wrap div.close img{width:14px;height:14px;margin-top:8px}.qrcode-wrap .kuaima-wrap{width:211px;height:211px;display:inline-block;margin-top:28px;border:1px solid #8eceab;background-color:#fbfffe;border-radius:5px}.qrcode-wrap .kuaima-wrap .qrcode{width:161px;height:161px;margin-top:25px}.qrcode-wrap .kuaima-wrap .app-name{display:block;font-size:12px}.qrcode-wrap .channel{width:211px}.qrcode-wrap .desc{color:#c5c5c5;font-size:12px}.pc-info{display:none;position:relative;text-align:left;margin-top:80px}.pc-name h2{font-size:24px;color:#2a2a2a;font-weight:700}.pc-name p{font-size:22px;color:#2a2a2a;font-weight:400;margin-top:30px;width:520px;word-wrap:break-word;word-break:break-all;overflow:hidden}.contact-list-item .contact-title,.h5-title,.mp-title-input{font-weight:700}.btn-download{width:260px;background-color:#fff;border:1px solid #007aff;color:#007aff}.btn-download .icon{margin-right:5px;line-height:14px}@font-face{font-family:publish_iconfont;src:url(data:font/ttf;base64,AAEAAAALAIAAAwAwR1NVQrD+s+0AAAE4AAAAQk9TLzJXA0gLAAABfAAAAFZjbWFwzutqLwAAAeQAAAGcZ2x5ZgSWU8gAAAOMAAACoGhlYWQO/QtoAAAA4AAAADZoaGVhB94DhQAAALwAAAAkaG10eA/pAAAAAAHUAAAAEGxvY2EBxgD+AAADgAAAAAptYXhwARQAawAAARgAAAAgbmFtZTdoE1AAAAYsAAACzXBvc3S1lTxNAAAI/AAAADsAAQAAA4D/gABcBAAAAAAABAAAAQAAAAAAAAAAAAAAAAAAAAQAAQAAAAEAAHoF6RlfDzz1AAsEAAAAAADV7uPeAAAAANXu494AAP9rBAADRAAAAAgAAgAAAAAAAAABAAAABABfAAYAAAAAAAIAAAAKAAoAAAD/AAAAAAAAAAEAAAAKAB4ALAABREZMVAAIAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAAAAQP6AZAABQAIAokCzAAAAI8CiQLMAAAB6wAyAQgAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABAAHjmHwOA/4AAXAOAAJUAAAABAAAAAAAABAAAAAPpAAAEAAAABAAAAAAAAAUAAAADAAAALAAAAAQAAAFoAAEAAAAAAGIAAwABAAAALAADAAoAAAFoAAQANgAAAAgACAACAAAAeOYW5h///wAAAHjmFuYf//8AAAAAAAAAAQAIAAgACAAAAAEAAgADAAABBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAA0AAAAAAAAAAMAAAB4AAAAeAAAAAEAAOYWAADmFgAAAAIAAOYfAADmHwAAAAMAAAAAAHYA/gFQAAAABQAA/+EDvAMYABMAKAAxAEQAUAAAAQYrASIOAh0BISc0LgIrARUhBRUXFA4DJyMnIQcjIi4DPQEXIgYUFjI2NCYXBgcGDwEOAR4BMyEyNicuAicBNTQ+AjsBMhYdAQEZGxpTEiUcEgOQAQoYJx6F/koCogEVHyMcDz4t/kksPxQyIBMIdwwSEhkSEowIBgUFCAICBA8OAW0XFgkFCQoG/qQFDxoVvB8pAh8BDBknGkxZDSAbEmGING4dJRcJAQGAgAETGyAOpz8RGhERGhF8GhYTEhkHEA0IGBoNIyQUAXfkCxgTDB0m4wAAAAAGAAD/awN/AvAADAAhACsANQBDAF4AACUiJj0BNDYyFh0BFAYBMScmNh8BNjIXNzYWDwEeARchPgEFMT4BNCYiBhQWBzE+ATQmIgYUFgMxIiY9ATQ2MhYdARQGBTEOAQcjFRQGIiYnNSMVDgEiJic1Iy4BNREhA18OEhIbExP+ETgGEgc6MnczOgcRBTgxQQr+AQtBASIOEhIbEhLQDhISHBIS4g0TExsSEgJQASAZKB8uHwFhAR4vHgEoGCEB/qwSDcINEhINwg0SAehHCAwHSRYWSQcMCEcbVzY2V0wBERkRERkRAQERGRERGRH+fhINwg0SEg3CDRJPGB8BhBYeHhaEhBYeHhaEAR8YAU8AAAIAAP+/A4gDRAAjAC8AAAE+ATcuASMmBgcuAScOAQcGEhceATM+ATceARc+ATc+ATcGJgM+AScOAQcOARcWNgMGBlkKLmkaOWMdHVMvP2kgPDdCHksvKz81ND4tMUUeIx8BCXCCGR0EJk0bGR8EKkwBZVVVAjghAigEAyMCAjs0bP7/WCtHBB8CAx8CA0EqMkoEAVMBsx1KKAIlHRpKJwIkAAAAAAASAN4AAQAAAAAAAAAVAAAAAQAAAAAAAQAQABUAAQAAAAAAAgAHACUAAQAAAAAAAwAQACwAAQAAAAAABAAQADwAAQAAAAAABQALAEwAAQAAAAAABgAQAFcAAQAAAAAACgArAGcAAQAAAAAACwATAJIAAwABBAkAAAAqAKUAAwABBAkAAQAgAM8AAwABBAkAAgAOAO8AAwABBAkAAwAgAP0AAwABBAkABAAgAR0AAwABBAkABQAWAT0AAwABBAkABgAgAVMAAwABBAkACgBWAXMAAwABBAkACwAmAckKQ3JlYXRlZCBieSBpY29uZm9udApwdWJsaXNoX2ljb25mb250UmVndWxhcnB1Ymxpc2hfaWNvbmZvbnRwdWJsaXNoX2ljb25mb250VmVyc2lvbiAxLjBwdWJsaXNoX2ljb25mb250R2VuZXJhdGVkIGJ5IHN2ZzJ0dGYgZnJvbSBGb250ZWxsbyBwcm9qZWN0Lmh0dHA6Ly9mb250ZWxsby5jb20ACgBDAHIAZQBhAHQAZQBkACAAYgB5ACAAaQBjAG8AbgBmAG8AbgB0AAoAcAB1AGIAbABpAHMAaABfAGkAYwBvAG4AZgBvAG4AdABSAGUAZwB1AGwAYQByAHAAdQBiAGwAaQBzAGgAXwBpAGMAbwBuAGYAbwBuAHQAcAB1AGIAbABpAHMAaABfAGkAYwBvAG4AZgBvAG4AdABWAGUAcgBzAGkAbwBuACAAMQAuADAAcAB1AGIAbABpAHMAaABfAGkAYwBvAG4AZgBvAG4AdABHAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAHMAdgBnADIAdAB0AGYAIABmAHIAbwBtACAARgBvAG4AdABlAGwAbABvACAAcAByAG8AagBlAGMAdAAuAGgAdAB0AHAAOgAvAC8AZgBvAG4AdABlAGwAbABvAC4AYwBvAG0AAAAAAgAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAQIBAwEEAQUAAXgHYW5kcm9pZANpb3MAAAA=) format("truetype")}.publish_iconfont{font-family:publish_iconfont!important;font-size:14px;font-style:normal;-webkit-font-smoothing:antialiased;-webkit-text-stroke-width:.2px;-moz-osx-font-smoothing:grayscale}#pc_download .btn-download,#pc_download_plus .btn-download{display:inline-block;text-decoration:none;text-align:center}.pc-download.plus-app{display:flex;position:relative;flex-direction:row;padding-top:50px;padding-bottom:50px}.pc-download.plus-app.center{justify-content:center}.pc-download.plus-app .qrcode-row{display:inline-block;width:200px;text-align:center}.pc-download.plus-app .qrcode-row .qrcode-img{width:200px;height:200px}.pc-download.plus-app .qrcode-row .app-tip{margin:0}.pc-download.plus-app .btn-row{display:inline-flex;flex-direction:column;margin-left:80px;justify-content:center}.pc-download.plus-app .btn-row .btn-download{margin:15px 0;width:240px}.pc-download.plus-app:after{position:absolute;right:0;bottom:0;left:0;height:1px;content:"";transform:scaleY(.5);background-color:#c8c7cc}@media only screen and (min-width:768px){.info.mobile{display:none}.pc-info{display:block}.desc-content{padding:0;margin:0 0 80px;border:none}.desc-content pre{color:#818181;font-size:14px}.desc-content h2{font-size:22px;margin-bottom:40px}.screenshots-content{border:none;margin:0;padding:0}.screenshots-content h2{font-size:22px;margin-bottom:40px}.list-wrap{margin-left:0}.tab-item{font-size:20px!important}}@media only screen and (max-width:320px){body{font-size:12px}}.command-content p{width:288px;text-align:left;position:relative}.command-content p .stream-token{width:230px;border:none}.command-content .copy-command{text-align:center;position:absolute;right:0;top:-5px;font-size:14px;line-height:14px;width:auto;background-color:#c5c5c5;color:#fff;padding:6px;border-radius:3px;text-decoration:none}.pc-logo{position:absolute;left:-126px}.pc-logo img{border-radius:5px;width:90px;height:90px}.pc-barcode{position:absolute;right:0;width:160px;height:160px;border:1px solid #8eceab;background-color:#fbfffe;border-radius:5px;text-align:center}.pc-barcode .kuaima-wrap .qrcode{width:120px;height:120px;margin-top:15px}.pc-barcode .kuaima-wrap .app-name{display:block;font-size:12px}.pc-barcode .tip{color:#296a43;margin-top:10px;font-size:14px}.bottom-wrap .head-content .loading-tip{display:inline-block;position:absolute;font-size:12px;right:21px;color:#c5c5c5}.loading-tip .spinner{margin-right:5px}.spinner{display:inline-block;width:16px;height:16px;transform-origin:50%;animation:a 1s step-end infinite}.spinner:after{display:block;width:100%;height:100%;content:"";background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cdefs%3E%3Cpath id='a' stroke='%236c6c6c' stroke-width='11' stroke-linecap='round' d='M60 7v20'/%3E%3C/defs%3E%3Cuse xlink:href='%23a' opacity='.27'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(30 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(60 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(90 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(120 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(150 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.37' transform='rotate(180 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.46' transform='rotate(210 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.56' transform='rotate(240 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.66' transform='rotate(270 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.75' transform='rotate(300 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.85' transform='rotate(330 60 60)'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:50%;background-size:100%}#download_list a.stream,.pc-info .mask a,.tab-item{display:inline-block;text-decoration:none}@keyframes a{0%{transform:rotate(0)}8.33333333%{transform:rotate(30deg)}16.66666667%{transform:rotate(60deg)}25%{transform:rotate(90deg)}33.33333333%{transform:rotate(120deg)}41.66666667%{transform:rotate(150deg)}50%{transform:rotate(180deg)}58.33333333%{transform:rotate(210deg)}66.66666667%{transform:rotate(240deg)}75%{transform:rotate(270deg)}83.33333333%{transform:rotate(300deg)}91.66666667%{transform:rotate(330deg)}to{transform:rotate(1turn)}}.tip-button-row{text-align:right;padding-right:21px}.pc-info .mask,.tab-content.pc .tab-content-item.app,.tab-content.pc .tab-content-item.mp{text-align:center}.tip-button-row .tip-btn{border:none;height:30px;border-radius:3px;color:#fff;margin:0;padding:0;font-size:12px}.app-tip,.mp-tip,.share-tip{font-size:14px}.tip-button-row .tip-btn.tip-btn-primary{width:70px;background-color:#007aff}.tip-button-row .tip-btn.tip-btn-cancel{background-color:transparent;color:#007aff;width:40px}.pc-info .mask{position:absolute;right:0;width:162px;height:162px;background-color:rgba(0,0,0,.6);border-radius:3px;cursor:pointer}.pc-info .mask a{width:100%;color:#fff;line-height:160px}#download_list .btn.stream.disabled{background-color:#ccc;border-color:#ccc;color:#fff}.tab{border-bottom:1px solid #f7f7f7}.tab-item{padding:10px 18px;margin:0 30px;color:#007aff;font-size:16px}.h5-link,.mp-clip,.mp-title-copy,.website-url{text-decoration:underline}.tab-item.active{border-bottom:2px solid #007aff;font-weight:700}.tab-content{border-bottom:1px solid #f7f7f7;padding:50px 0}.pc-download{margin:0}.tab-content-item{display:none}.pkg-download,.tab-content-item.active,.website-url{display:block}.tab-content.pc .tab-content-item{height:350px}.app-qrcode{border:1px solid #279a36;border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;-o-border-radius:5px}.mp-qrcode{width:135px;height:135px;margin-top:20px}.list-media{position:relative;padding:11px 15px}.list-media-object{float:left;width:42px;height:42px;margin-right:15px}.list-media-body{height:42px;position:relative}.pc-share,.toast{position:absolute}.list-media-desc{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:14px;color:#8f8f94;margin:0}.contact-list{padding:30px 0 0 50px}.contact-list-item{padding:5px}.contact-list-item .contact-text{color:#007aff}.tab-wrap{bottom:10px;width:100%}#mb_tab .tab-item{margin:0}.pkg-download{margin:0 auto;width:300px;background-color:#007aff;border:1px solid #007aff;color:#fff;padding:8px 10px;border-radius:5px}#mb_tab_content{border:none;padding:15px 0}@media only screen and (min-height:650px)</div></div><div id="vcomment"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@waline/client@v2/dist/waline.min.css"><script src="//cdn.jsdelivr.net/npm/@waline/client@v2/dist/waline.js"></script><script>const origin = window.location.origin
|
|
29
|
+
const serverURL = origin.includes('cainiaoblog') ? 'https://cmts.cainiaoblog.cn' : 'https://cmts.xuehuayu.cn'
|
|
30
|
+
const locale = {
|
|
31
|
+
placeholder: '请正确填写昵称和邮箱,方便接收回复通知~',
|
|
32
|
+
sofa: '沙发空缺中,还不快抢~',
|
|
33
|
+
};
|
|
34
|
+
Waline.init({
|
|
35
|
+
el: '#vcomment',
|
|
36
|
+
serverURL: serverURL,
|
|
37
|
+
pageSize: '20',
|
|
38
|
+
visitor: true, // 阅读量统计
|
|
39
|
+
requiredMeta: ['nick', 'mail'],
|
|
40
|
+
emoji: [
|
|
41
|
+
'https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo',
|
|
42
|
+
'https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq',
|
|
43
|
+
'https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/tw-emoji',
|
|
44
|
+
],
|
|
45
|
+
locale,
|
|
46
|
+
pageview: true
|
|
47
|
+
})
|
|
48
|
+
</script></div></div><div class="pure-u-1 pure-u-md-1-4 fixed-search hidden_mid_and_down"><div id="sidebar"><script type="text/javascript" src="//cdn.staticaly.com/gh/npljy/npljy.github.io/main/js/search.min.js"></script><div class="widget"><div class="widget-search"><input class="search" type="radio" name="search" value="baidu" id="baidu" checked="checked"/><label class="label" for="baidu" title="百度全站搜索">百度</label><input class="search" type="radio" name="search" value="google" id="google"/><label class="label" for="google" title="谷歌全站搜索">谷歌</label><input class="search" type="radio" name="search" value="self" id="self"/><label class="label" for="self" title="使用站内搜索">站内</label></div><div class="widget" id="search"><form class="search-form" action="//www.baidu.com/baidu" method="get" accept-charset="utf-8" target="_blank"><input type="search" name="word" maxlength="30" placeholder="百度全站搜索"/><input type="hidden" name="si" value="xuehuayu.cn"/><input type="hidden" name="cl" value="3"/><input type="hidden" name="ct" value="2097152"/><input type="hidden" name="s" value="on"/><input class="search-submit" type="submit" value=""/></form></div></div><script>$('input[type=radio][name=search]').change(function() {
|
|
49
|
+
var val = $(this).val()
|
|
50
|
+
var self = '<div class="search-form"><input id="local-search-input" placeholder="站内搜索,首次慢" type="search" name="q" results="0"><input class="search-submit" type="submit" value=""/><div id="local-search-result"></div></div>'
|
|
51
|
+
var google = '<form class="search-form" action="//www.google.com/search" method="get" accept-charset="utf-8" target="_blank"><input type="search" name="q" maxlength="30" placeholder="谷歌全站搜索"><input type="hidden" name="sitesearch" value="xuehuayu.cn"><input class="search-submit" type="submit" value=""/></form>'
|
|
52
|
+
var baidu = '<form class="search-form" action="//www.baidu.com/baidu" method="get" accept-charset="utf-8" target="_blank"><input type="search" name="word" maxlength="30" placeholder="百度全站搜索"><input type="hidden" name="si" value="xuehuayu.cn"><input type="hidden" name="cl" value="3"><input type="hidden" name="ct" value="2097152"><input type="hidden" name="s" value="on"><input class="search-submit" type="submit" value=""/></form>'
|
|
53
|
+
|
|
54
|
+
if (val === 'self') {
|
|
55
|
+
$('#search').html(self)
|
|
56
|
+
var search_path = 'search.xml';
|
|
57
|
+
if (search_path.length == 0) {
|
|
58
|
+
search_path = 'search.xml';
|
|
59
|
+
}
|
|
60
|
+
var path = 'https://cdn.staticaly.com/gh/npljy/npljy.github.io/main/' + search_path;
|
|
61
|
+
searchFunc(path, 'local-search-input', 'local-search-result');
|
|
62
|
+
} else if (val === 'baidu') {
|
|
63
|
+
$('#search').html(baidu)
|
|
64
|
+
} else if (val === 'google') {
|
|
65
|
+
$('#search').html(google)
|
|
66
|
+
}
|
|
67
|
+
})</script><div class="widget widget-wxmp"><img alt="微信公众号" width="100%" src="//cdn.staticaly.com/gh/npljy/npljy.github.io/main/img/mp-mini.jpg"/></div><div class="widget widget-categories"><div class="widget-title"><i class="fa fa-folder-o"> 分类</i></div><ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/CDN/">CDN</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/IDE/">IDE</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/git/">git</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/hexo/">hexo</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E5%85%AC%E5%85%B1%E8%8A%82%E6%97%A5/">公共节日</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E5%88%86%E4%BA%AB/">分享</a><span class="category-list-count">29</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E5%89%8D%E7%AB%AF/">前端</a><span class="category-list-count">191</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/%E5%89%8D%E7%AB%AF/%E6%B5%8F%E8%A7%88%E5%99%A8/">浏览器</a><span class="category-list-count">1</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/%E5%89%8D%E7%AB%AF/%E6%B5%8F%E8%A7%88%E5%99%A8/%E7%BD%91%E7%BB%9C%E5%8D%8F%E8%AE%AE/">网络协议</a><span class="category-list-count">1</span></li></ul></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E5%8D%9A%E5%AE%A2/">博客</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E5%B7%A5%E5%85%B7/">工具</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E5%B9%BF%E5%91%8A%E8%BF%87%E6%BB%A4/">广告过滤</a><span class="category-list-count">8</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/%E5%B9%BF%E5%91%8A%E8%BF%87%E6%BB%A4/%E8%A7%86%E9%A2%91%E7%94%B5%E8%A7%86%E5%B0%8F%E8%AF%B4%E6%BC%AB%E7%94%BB%E8%B5%84%E8%AE%AF%E9%9F%B3%E4%B9%90/">视频电视小说漫画资讯音乐</a><span class="category-list-count">2</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E6%AD%A3%E5%88%99/">正则</a><span class="category-list-count">5</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E6%B5%8F%E8%A7%88%E5%99%A8/">浏览器</a><span class="category-list-count">5</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E7%AE%97%E6%B3%95/">算法</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E8%B5%84%E8%AE%AF/">资讯</a><span class="category-list-count">16</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E8%BD%BB%E6%9D%BE%E4%B8%80%E5%88%BB/">轻松一刻</a><span class="category-list-count">1</span></li></ul></div><div class="widget widget-tags"><div class="widget-title"><i class="fa fa-star-o"> 标签</i></div><div class="tagcloud"><a href="/tags/%E5%8E%9F%E5%88%9B/" style="font-size: 15px;">原创</a> <a href="/tags/%E8%BD%AC%E8%BD%BD/" style="font-size: 15px;">转载</a> <a href="/tags/%E6%89%8B%E5%86%99/" style="font-size: 15px;">手写</a> <a href="/tags/%E7%96%AB%E6%83%85/" style="font-size: 15px;">疫情</a> <a href="/tags/%E5%A8%B1%E4%B9%90/" style="font-size: 15px;">娱乐</a></div></div><div class="widget widget-recent-posts"><div class="widget-title"><i class="fa fa-file-o"> 最近文章</i></div><ul class="post-list"><li class="post-list-item"><a class="post-list-link" href="/article/c5576490.html">面试准备</a></li><li class="post-list-item"><a class="post-list-link" href="/article/84c9ccd6.html">精读《SolidJS》</a></li><li class="post-list-item"><a class="post-list-link" href="/article/53803e6.html">git提交注释规范</a></li><li class="post-list-item"><a class="post-list-link" href="/article/a4145266.html">前端数组拍平flat一行代码</a></li><li class="post-list-item"><a class="post-list-link" href="/article/bedea419.html">一道前端this面试题</a></li><li class="post-list-item"><a class="post-list-link" href="/article/bf7e7421.html">git多账号配置</a></li></ul></div><div class="widget widget-links"><div class="widget-title"><i class="fa fa-external-link"> 友情链接</i></div><ul></ul><a href="https://github.com/npljy?utm_source=xuehuayu.cn" title="GitHub" target="_blank">GitHub</a><ul></ul><a href="https://laonongmin.online?utm_source=xuehuayu.cn" title="看看" target="_blank">看看</a><ul></ul><a href="https://cainiaoblog.cn?utm_source=xuehuayu.cn" title="菜鸟博客" target="_blank">菜鸟博客</a><ul></ul><a href="mailto:cainiaoblog@126.com" title="友链联系" target="_blank">友链联系</a></div></div></div><div class="pure-u-1 pure-u-md-3-4"><div id="footer"><div class="flex-block justify-center align-center flex-wrap"><a class="gxba-link" id="gxba" rel="nofollow" target="_blank" href="http://beian.miit.gov.cn/">京ICP备20007647号-2</a><a class="gaba-link" id="gaba-link" rel="nofollow" target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11010802031264"><img class="nofancybox" src="//cdn.staticaly.com/gh/npljy/npljy.github.io/main/img/gaba.png" alt=""/><span id="gaba">京公网安备 11010802031264号</span><span style="padding-right: 10px;"></span></a><span>Copyright © 2023 </span><a href="/." rel="nofollow">前端壹菜鸟. </a><script>(function(){
|
|
68
|
+
var cnb =window.location.origin.indexOf('cainiaoblog') !==-1
|
|
69
|
+
if (cnb) {
|
|
70
|
+
var gxba =document.getElementById('gxba')
|
|
71
|
+
var gaba =document.getElementById('gaba')
|
|
72
|
+
var gabaLink =document.getElementById('gaba-link')
|
|
73
|
+
gxba.innerText ='京ICP备20007647号-1'
|
|
74
|
+
gaba.innerText ='京公网安备 11010802031254号'
|
|
75
|
+
gabaLink.setAttribute('href','http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11010802031254')
|
|
76
|
+
}
|
|
77
|
+
})()</script></div><div class="flex-block justify-center align-center flex-wrap"><a rel="nofollow" target="_blank" href="https://v6.51.la/s/Guz3lwHCsVme9Cu"><div class="busuanzi_container" id="busuanzi_container"><span class="busuanzi_container_site_pv" id="busuanzi_container_site_pv">访问量:<span id="busuanzi_value_site_pv"><i class="fa fa-spinner"></i></span></span><span class="busuanzi_container_site_uv" id="busuanzi_container_site_uv">访客数:<span id="busuanzi_value_site_uv"><i class="fa fa-spinner"></i></span></span><span style="padding-right: 10px;"></span></div></a><a rel="nofollow" target="_blank" href="https://www.upyun.com/?utm_source=lianmeng&utm_medium=referral"><span style="font-weight:bold;letter-spacing: 1px;">本网站由 </span><img class="nofancybox" height="32" style="vertical-align: middle" src="//cdn.staticaly.com/gh/npljy/npljy.github.io/main/img/upy_logo.min.svg" alt=""/><span style="font-weight:bold;letter-spacing: 1px;">提供CDN加速/云存储服务</span></a><span style="padding-right: 10px;"></span><a rel="nofollow" style="font-size:18px;font-weight:bold;vertical-align: middle" target="_blank" title="注册就送代金券可直接使用" href="https://console.upyun.com/register/?invite=HyDsjZHIL">注册</a></div></div></div></div><a class="show" id="rocket" href="#top"></a><div class="darkmode-toggle">🌓</div><script type="text/javascript" src="//cdn.staticaly.com/gh/npljy/npljy.github.io/main/js/totop.min.js" async></script><script type="text/javascript" src="//cdn.staticaly.com/gh/npljy/npljy.github.io/main/js/dark.min.js" async></script><script type="text/javascript" src="//cdn.staticaly.com/gh/npljy/npljy.github.io/main/js/codeblock-resizer.min.js"></script><script type="text/javascript" src="//cdn.staticaly.com/gh/npljy/npljy.github.io/main/js/smartresize.min.js"></script></div></body></html>
|
package/lib/hbe.js
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const cryptoObj = window.crypto || window.msCrypto;
|
|
5
|
+
const storage = window.localStorage;
|
|
6
|
+
|
|
7
|
+
const storageName = 'hexo-blog-encrypt:#' + window.location.pathname;
|
|
8
|
+
const keySalt = textToArray('hexo-blog-encrypt的作者们都是大帅比!');
|
|
9
|
+
const ivSalt = textToArray('hexo-blog-encrypt是地表最强Hexo加密插件!');
|
|
10
|
+
|
|
11
|
+
// As we can't detect the wrong password with AES-CBC,
|
|
12
|
+
// so adding an empty div and check it when decrption.
|
|
13
|
+
const knownPrefix = "<hbe-prefix></hbe-prefix>";
|
|
14
|
+
|
|
15
|
+
const mainElement = document.getElementById('hexo-blog-encrypt');
|
|
16
|
+
const wrongPassMessage = mainElement.dataset['wpm'];
|
|
17
|
+
const wrongHashMessage = mainElement.dataset['whm'];
|
|
18
|
+
const dataElement = mainElement.getElementsByTagName('script')['hbeData'];
|
|
19
|
+
const encryptedData = dataElement.innerText;
|
|
20
|
+
const HmacDigist = dataElement.dataset['hmacdigest'];
|
|
21
|
+
|
|
22
|
+
function hexToArray(s) {
|
|
23
|
+
return new Uint8Array(s.match(/[\da-f]{2}/gi).map((h => {
|
|
24
|
+
return parseInt(h, 16);
|
|
25
|
+
})));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function textToArray(s) {
|
|
29
|
+
var i = s.length;
|
|
30
|
+
var n = 0;
|
|
31
|
+
var ba = new Array()
|
|
32
|
+
|
|
33
|
+
for (var j = 0; j < i;) {
|
|
34
|
+
var c = s.codePointAt(j);
|
|
35
|
+
if (c < 128) {
|
|
36
|
+
ba[n++] = c;
|
|
37
|
+
j++;
|
|
38
|
+
} else if ((c > 127) && (c < 2048)) {
|
|
39
|
+
ba[n++] = (c >> 6) | 192;
|
|
40
|
+
ba[n++] = (c & 63) | 128;
|
|
41
|
+
j++;
|
|
42
|
+
} else if ((c > 2047) && (c < 65536)) {
|
|
43
|
+
ba[n++] = (c >> 12) | 224;
|
|
44
|
+
ba[n++] = ((c >> 6) & 63) | 128;
|
|
45
|
+
ba[n++] = (c & 63) | 128;
|
|
46
|
+
j++;
|
|
47
|
+
} else {
|
|
48
|
+
ba[n++] = (c >> 18) | 240;
|
|
49
|
+
ba[n++] = ((c >> 12) & 63) | 128;
|
|
50
|
+
ba[n++] = ((c >> 6) & 63) | 128;
|
|
51
|
+
ba[n++] = (c & 63) | 128;
|
|
52
|
+
j += 2;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return new Uint8Array(ba);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function arrayBufferToHex(arrayBuffer) {
|
|
59
|
+
if (typeof arrayBuffer !== 'object' || arrayBuffer === null || typeof arrayBuffer.byteLength !== 'number') {
|
|
60
|
+
throw new TypeError('Expected input to be an ArrayBuffer')
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
var view = new Uint8Array(arrayBuffer)
|
|
64
|
+
var result = ''
|
|
65
|
+
var value
|
|
66
|
+
|
|
67
|
+
for (var i = 0; i < view.length; i++) {
|
|
68
|
+
value = view[i].toString(16)
|
|
69
|
+
result += (value.length === 1 ? '0' + value : value)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return result
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async function getExecutableScript(oldElem) {
|
|
76
|
+
let out = document.createElement('script');
|
|
77
|
+
const attList = ['type', 'text', 'src', 'crossorigin', 'defer', 'referrerpolicy'];
|
|
78
|
+
attList.forEach((att) => {
|
|
79
|
+
if (oldElem[att])
|
|
80
|
+
out[att] = oldElem[att];
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function convertHTMLToElement(content) {
|
|
87
|
+
let out = document.createElement('div');
|
|
88
|
+
out.innerHTML = content;
|
|
89
|
+
out.querySelectorAll('script').forEach(async (elem) => {
|
|
90
|
+
elem.replaceWith(await getExecutableScript(elem));
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function getKeyMaterial(password) {
|
|
97
|
+
let encoder = new TextEncoder();
|
|
98
|
+
return cryptoObj.subtle.importKey(
|
|
99
|
+
'raw',
|
|
100
|
+
encoder.encode(password),
|
|
101
|
+
{
|
|
102
|
+
'name': 'PBKDF2',
|
|
103
|
+
},
|
|
104
|
+
false,
|
|
105
|
+
[
|
|
106
|
+
'deriveKey',
|
|
107
|
+
'deriveBits',
|
|
108
|
+
]
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function getHmacKey(keyMaterial) {
|
|
113
|
+
return cryptoObj.subtle.deriveKey({
|
|
114
|
+
'name': 'PBKDF2',
|
|
115
|
+
'hash': 'SHA-256',
|
|
116
|
+
'salt': keySalt.buffer,
|
|
117
|
+
'iterations': 1024
|
|
118
|
+
}, keyMaterial, {
|
|
119
|
+
'name': 'HMAC',
|
|
120
|
+
'hash': 'SHA-256',
|
|
121
|
+
'length': 256,
|
|
122
|
+
}, true, [
|
|
123
|
+
'verify',
|
|
124
|
+
]);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function getDecryptKey(keyMaterial) {
|
|
128
|
+
return cryptoObj.subtle.deriveKey({
|
|
129
|
+
'name': 'PBKDF2',
|
|
130
|
+
'hash': 'SHA-256',
|
|
131
|
+
'salt': keySalt.buffer,
|
|
132
|
+
'iterations': 1024,
|
|
133
|
+
}, keyMaterial, {
|
|
134
|
+
'name': 'AES-CBC',
|
|
135
|
+
'length': 256,
|
|
136
|
+
}, true, [
|
|
137
|
+
'decrypt',
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function getIv(keyMaterial) {
|
|
142
|
+
return cryptoObj.subtle.deriveBits({
|
|
143
|
+
'name': 'PBKDF2',
|
|
144
|
+
'hash': 'SHA-256',
|
|
145
|
+
'salt': ivSalt.buffer,
|
|
146
|
+
'iterations': 512,
|
|
147
|
+
}, keyMaterial, 16 * 8);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async function verifyContent(key, content) {
|
|
151
|
+
const encoder = new TextEncoder();
|
|
152
|
+
const encoded = encoder.encode(content);
|
|
153
|
+
|
|
154
|
+
let signature = hexToArray(HmacDigist);
|
|
155
|
+
|
|
156
|
+
const result = await cryptoObj.subtle.verify({
|
|
157
|
+
'name': 'HMAC',
|
|
158
|
+
'hash': 'SHA-256',
|
|
159
|
+
}, key, signature, encoded);
|
|
160
|
+
console.log(`Verification result: ${result}`);
|
|
161
|
+
if (!result) {
|
|
162
|
+
alert(wrongHashMessage);
|
|
163
|
+
console.log(`${wrongHashMessage}, got `, signature, ` but proved wrong.`);
|
|
164
|
+
}
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
async function decrypt(decryptKey, iv, hmacKey) {
|
|
169
|
+
let typedArray = hexToArray(encryptedData);
|
|
170
|
+
|
|
171
|
+
const result = await cryptoObj.subtle.decrypt({
|
|
172
|
+
'name': 'AES-CBC',
|
|
173
|
+
'iv': iv,
|
|
174
|
+
}, decryptKey, typedArray.buffer).then(async (result) => {
|
|
175
|
+
const decoder = new TextDecoder();
|
|
176
|
+
const decoded = decoder.decode(result);
|
|
177
|
+
|
|
178
|
+
// check the prefix, if not then we can sure here is wrong password.
|
|
179
|
+
if (!decoded.startsWith(knownPrefix)) {
|
|
180
|
+
throw "Decode successfully but not start with KnownPrefix.";
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const hideButton = document.createElement('button');
|
|
184
|
+
hideButton.textContent = 'Encrypt again';
|
|
185
|
+
hideButton.type = 'button';
|
|
186
|
+
hideButton.classList.add("hbe-button");
|
|
187
|
+
hideButton.addEventListener('click', () => {
|
|
188
|
+
window.localStorage.removeItem(storageName);
|
|
189
|
+
window.location.reload();
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
document.getElementById('hexo-blog-encrypt').style.display = 'inline';
|
|
193
|
+
document.getElementById('hexo-blog-encrypt').innerHTML = '';
|
|
194
|
+
document.getElementById('hexo-blog-encrypt').appendChild(await convertHTMLToElement(decoded));
|
|
195
|
+
document.getElementById('hexo-blog-encrypt').appendChild(hideButton);
|
|
196
|
+
|
|
197
|
+
// support html5 lazyload functionality.
|
|
198
|
+
document.querySelectorAll('img').forEach((elem) => {
|
|
199
|
+
if (elem.getAttribute("data-src") && !elem.src) {
|
|
200
|
+
elem.src = elem.getAttribute('data-src');
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// support theme-next refresh
|
|
205
|
+
window.NexT && NexT.boot && typeof NexT.boot.refresh === 'function' && NexT.boot.refresh();
|
|
206
|
+
|
|
207
|
+
// TOC part
|
|
208
|
+
var tocDiv = document.getElementById("toc-div");
|
|
209
|
+
if (tocDiv) {
|
|
210
|
+
tocDiv.style.display = 'inline';
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
var tocDivs = document.getElementsByClassName('toc-div-class');
|
|
214
|
+
if (tocDivs && tocDivs.length > 0) {
|
|
215
|
+
for (var idx = 0; idx < tocDivs.length; idx++) {
|
|
216
|
+
tocDivs[idx].style.display = 'inline';
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return await verifyContent(hmacKey, decoded);
|
|
221
|
+
}).catch((e) => {
|
|
222
|
+
alert(wrongPassMessage);
|
|
223
|
+
console.log(e);
|
|
224
|
+
return false;
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
return result;
|
|
228
|
+
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function hbeLoader() {
|
|
232
|
+
|
|
233
|
+
const oldStorageData = JSON.parse(storage.getItem(storageName));
|
|
234
|
+
|
|
235
|
+
if (oldStorageData) {
|
|
236
|
+
console.log(`Password got from localStorage(${storageName}): `, oldStorageData);
|
|
237
|
+
|
|
238
|
+
const sIv = hexToArray(oldStorageData.iv).buffer;
|
|
239
|
+
const sDk = oldStorageData.dk;
|
|
240
|
+
const sHmk = oldStorageData.hmk;
|
|
241
|
+
|
|
242
|
+
cryptoObj.subtle.importKey('jwk', sDk, {
|
|
243
|
+
'name': 'AES-CBC',
|
|
244
|
+
'length': 256,
|
|
245
|
+
}, true, [
|
|
246
|
+
'decrypt',
|
|
247
|
+
]).then((dkCK) => {
|
|
248
|
+
cryptoObj.subtle.importKey('jwk', sHmk, {
|
|
249
|
+
'name': 'HMAC',
|
|
250
|
+
'hash': 'SHA-256',
|
|
251
|
+
'length': 256,
|
|
252
|
+
}, true, [
|
|
253
|
+
'verify',
|
|
254
|
+
]).then((hmkCK) => {
|
|
255
|
+
decrypt(dkCK, sIv, hmkCK).then((result) => {
|
|
256
|
+
if (!result) {
|
|
257
|
+
storage.removeItem(storageName);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
mainElement.addEventListener('keydown', async (event) => {
|
|
265
|
+
if (event.isComposing || event.keyCode === 13) {
|
|
266
|
+
const password = document.getElementById('hbePass').value;
|
|
267
|
+
const keyMaterial = await getKeyMaterial(password);
|
|
268
|
+
const hmacKey = await getHmacKey(keyMaterial);
|
|
269
|
+
const decryptKey = await getDecryptKey(keyMaterial);
|
|
270
|
+
const iv = await getIv(keyMaterial);
|
|
271
|
+
|
|
272
|
+
decrypt(decryptKey, iv, hmacKey).then((result) => {
|
|
273
|
+
console.log(`Decrypt result: ${result}`);
|
|
274
|
+
if (result) {
|
|
275
|
+
cryptoObj.subtle.exportKey('jwk', decryptKey).then((dk) => {
|
|
276
|
+
cryptoObj.subtle.exportKey('jwk', hmacKey).then((hmk) => {
|
|
277
|
+
const newStorageData = {
|
|
278
|
+
'dk': dk,
|
|
279
|
+
'iv': arrayBufferToHex(iv),
|
|
280
|
+
'hmk': hmk,
|
|
281
|
+
};
|
|
282
|
+
storage.setItem(storageName, JSON.stringify(newStorageData));
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
hbeLoader();
|
|
292
|
+
|
|
293
|
+
})();
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cainiaoblog",
|
|
3
|
+
"version": "23.2.171",
|
|
4
|
+
"description": "cainiaoblog",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"directories": {
|
|
7
|
+
"lib": "lib"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/npljy/npljy.github.io.git"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"cainiaoblog"
|
|
18
|
+
],
|
|
19
|
+
"author": "cainiao",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/npljy/npljy.github.io/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/npljy/npljy.github.io#readme"
|
|
25
|
+
}
|