jekyll-zeta 0.10.4 → 0.10.5
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.
- checksums.yaml +4 -4
- data/_includes/encrypt_page.js +17 -0
- data/_includes/encrypted.html +15 -241
- data/_includes/getPostData.js +6 -128
- data/_includes/getmapdata.js +17 -280
- data/_includes/heatmap.html +3 -6
- data/_includes/heatmap.js +28 -463
- data/_includes/heatmap_svg.js +38 -489
- data/_includes/js_source/encrypt_page.js +229 -0
- data/_includes/js_source/getPostData.js +128 -0
- data/_includes/js_source/getmapdata.js +280 -0
- data/_includes/js_source/heatmap.js +463 -0
- data/_includes/js_source/heatmap_svg.js +490 -0
- data/_includes/js_source/terser.json +11 -0
- data/_includes/lovemap_layout.html +6 -2
- metadata +8 -1
data/_includes/getmapdata.js
CHANGED
@@ -1,280 +1,17 @@
|
|
1
|
-
|
2
|
-
(function ()
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
}
|
19
|
-
|
20
|
-
return ymd
|
21
|
-
}
|
22
|
-
|
23
|
-
|
24
|
-
function getConfigFromStr(str,obj){
|
25
|
-
if (str && str.startsWith('#')) {
|
26
|
-
// #color #121212
|
27
|
-
// #title 123
|
28
|
-
let arr = str.split(' ')
|
29
|
-
if(arr.length >= 2){
|
30
|
-
let key = arr[0].substring(1)
|
31
|
-
if(key ){
|
32
|
-
obj[key] = str.substring(key.length + 2).trim()
|
33
|
-
return 1
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
return 0
|
38
|
-
}
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
function date2ymd(t) {
|
43
|
-
let m = t.getMonth() + 1;
|
44
|
-
let d = t.getDate();
|
45
|
-
return `${t.getFullYear()}-${m < 10 ? "0" + m : m}-${d < 10 ? "0" + d : d}`;
|
46
|
-
}
|
47
|
-
/// 2025-01-01 描述,日期格式yyyy-mm-dd,空格后跟上 描述
|
48
|
-
function getDataFromSignleLine(str0,gData) {
|
49
|
-
if(!str0) return null
|
50
|
-
let str = str0.trim()
|
51
|
-
if (!str) return null
|
52
|
-
|
53
|
-
if(gData && getConfigFromStr(str,gData)) return null
|
54
|
-
|
55
|
-
|
56
|
-
var arr = str.split(" ")
|
57
|
-
var date0 = arr[0]
|
58
|
-
date0 = date0.replace('~','~')
|
59
|
-
if (gData && date0.indexOf("~") > 0) {
|
60
|
-
let arrRg = date0.split('~')
|
61
|
-
let beginYmd = arrRg[0]
|
62
|
-
let endYmd = arrRg[1]
|
63
|
-
let dateBegin = ymd2Date(normalizeYmd(beginYmd))
|
64
|
-
if (!dateBegin || isNaN(dateBegin)) {
|
65
|
-
|
66
|
-
return
|
67
|
-
}
|
68
|
-
let rangCount = 7
|
69
|
-
if(endYmd){
|
70
|
-
let dend = ymd2Date(normalizeYmd(endYmd))
|
71
|
-
if (dend && !isNaN(dend)) {
|
72
|
-
rangCount = Math.floor((dend.getTime() - dateBegin.getTime())/ 86400000) + 1
|
73
|
-
}
|
74
|
-
|
75
|
-
}else{
|
76
|
-
rangCount = Math.floor((Date.now() - dateBegin.getTime())/ 86400000) + 1;
|
77
|
-
if(rangCount > 7) rangCount =7
|
78
|
-
}
|
79
|
-
|
80
|
-
const desc = arr.slice(1).join(' ')
|
81
|
-
|
82
|
-
let resultArr = []
|
83
|
-
const timeStampBegin = dateBegin.getTime()
|
84
|
-
for (let i = 0; i < rangCount; i ++) {
|
85
|
-
const ymd = date2ymd(new Date(timeStampBegin + i * 86400000))
|
86
|
-
const newStr = ymd + ' ' + desc
|
87
|
-
const newEle = getDataFromSignleLine(newStr)
|
88
|
-
if(newEle){
|
89
|
-
resultArr.push(newEle)
|
90
|
-
}
|
91
|
-
}
|
92
|
-
return resultArr.length ? resultArr : null
|
93
|
-
|
94
|
-
}
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
let date = ''
|
99
|
-
if (date0) {
|
100
|
-
let ymd = date0.split("-")
|
101
|
-
if (ymd.length == 3) {
|
102
|
-
let year = ymd[0]
|
103
|
-
let month = ymd[1]
|
104
|
-
let day = ymd[2]
|
105
|
-
|
106
|
-
let nY = Number(year)
|
107
|
-
let nM = Number(month)
|
108
|
-
let nD = Number(month)
|
109
|
-
if (isNaN(nY) || isNaN(nD) || isNaN(nM) || nY < 1900 || nY > 2100 || nM < 1 || nM > 12 || nD < 1 || nD > 31) {
|
110
|
-
return null
|
111
|
-
}
|
112
|
-
date = year + "-" + month.padStart(2, '0') + "-" + day.padStart(2, '0')
|
113
|
-
}
|
114
|
-
}
|
115
|
-
else {
|
116
|
-
return null
|
117
|
-
}
|
118
|
-
|
119
|
-
if (!date) {
|
120
|
-
return null
|
121
|
-
}
|
122
|
-
var title = ""
|
123
|
-
let color = undefined
|
124
|
-
if (arr.length > 1) {
|
125
|
-
title = arr.slice(1).join(" ")
|
126
|
-
|
127
|
-
const regColor = /#[0-9a-fA-F]{6}/
|
128
|
-
let colorScaned = regColor.exec(title)
|
129
|
-
if (colorScaned && colorScaned.length) {
|
130
|
-
color = colorScaned[0]
|
131
|
-
title = title.replace(regColor,'')
|
132
|
-
}
|
133
|
-
|
134
|
-
}
|
135
|
-
return { date: date, title: title ,color}
|
136
|
-
}
|
137
|
-
|
138
|
-
function fillDataObj(data, item) {
|
139
|
-
if (!item) return
|
140
|
-
let y = item.date.substring(0, 4);
|
141
|
-
let m = item.date.substring(5, 7);
|
142
|
-
let c = data.allYear[y];
|
143
|
-
data.allYear[y] = c ? c + 1 : 1;
|
144
|
-
|
145
|
-
let yObj = data[y]
|
146
|
-
if (!yObj) {
|
147
|
-
yObj = {}
|
148
|
-
data[y] = yObj;
|
149
|
-
}
|
150
|
-
|
151
|
-
let arr = yObj[m]
|
152
|
-
if (!arr) {
|
153
|
-
arr = []
|
154
|
-
yObj[m] = arr
|
155
|
-
}
|
156
|
-
arr.push(item)
|
157
|
-
|
158
|
-
}
|
159
|
-
|
160
|
-
|
161
|
-
async function wait (t ) {
|
162
|
-
return new Promise(function(r){
|
163
|
-
setTimeout(() => {
|
164
|
-
r()
|
165
|
-
}, t );
|
166
|
-
})
|
167
|
-
}
|
168
|
-
|
169
|
-
function parseDataAndCeateMap(strData,node) {
|
170
|
-
|
171
|
-
|
172
|
-
let allYear = {}
|
173
|
-
let dataObj = { allYear: allYear };
|
174
|
-
|
175
|
-
let Recent365Count = 0;
|
176
|
-
let nowDate = new Date
|
177
|
-
let Recent365YMD = `${nowDate.getFullYear() - 1}-${(nowDate.getMonth() + 1).toString().padStart(2, '0')}-${nowDate.getDate().toString().padStart(2, '0')}`
|
178
|
-
|
179
|
-
|
180
|
-
strData.split("\n").forEach(function (str,idx) {
|
181
|
-
if(idx == 0) return
|
182
|
-
let item = getDataFromSignleLine(str,dataObj)
|
183
|
-
if (item && Array.isArray(item)) {
|
184
|
-
item.forEach(e=>{
|
185
|
-
fillDataObj(dataObj, e)
|
186
|
-
if (e) {
|
187
|
-
if (e.date >= Recent365YMD) {
|
188
|
-
Recent365Count++
|
189
|
-
}
|
190
|
-
}
|
191
|
-
})
|
192
|
-
}else{
|
193
|
-
fillDataObj(dataObj, item)
|
194
|
-
if (item) {
|
195
|
-
if (item.date >= Recent365YMD) {
|
196
|
-
Recent365Count++
|
197
|
-
}
|
198
|
-
}
|
199
|
-
}
|
200
|
-
|
201
|
-
})
|
202
|
-
|
203
|
-
|
204
|
-
if (dataObj.title ) {
|
205
|
-
|
206
|
-
|
207
|
-
let divTitle = document.createElement('div')
|
208
|
-
divTitle.className = 'custom-map-title'
|
209
|
-
divTitle.innerText = dataObj.title || ''
|
210
|
-
|
211
|
-
let codeHolder = node.parentNode
|
212
|
-
codeHolder.insertBefore(divTitle,node)
|
213
|
-
|
214
|
-
}
|
215
|
-
|
216
|
-
|
217
|
-
let allYearArr = Object.keys(allYear).sort().reverse()
|
218
|
-
|
219
|
-
|
220
|
-
let RCT = dataObj['recent'];
|
221
|
-
let showRct = true
|
222
|
-
if (!RCT) {
|
223
|
-
showRct = Recent365Count && allYearArr.length > 1
|
224
|
-
}else{
|
225
|
-
showRct = RCT == '1'
|
226
|
-
}
|
227
|
-
if(showRct){
|
228
|
-
create_heatmap_lv('lmpRecent365' + g_id ++, '', dataObj, "Last 1Y", Recent365Count,node)
|
229
|
-
}
|
230
|
-
|
231
|
-
for (let i = 0; i < allYearArr.length; i++) {
|
232
|
-
let y = allYearArr[i]
|
233
|
-
create_heatmap_lv('lmp' + y + g_id ++ , y, dataObj,undefined,undefined,node)
|
234
|
-
}
|
235
|
-
|
236
|
-
node.style.display = 'none'
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
};
|
241
|
-
|
242
|
-
async function initData(){
|
243
|
-
let arrCodes = document.querySelectorAll('pre > code')
|
244
|
-
if (!arrCodes || arrCodes.length == 0) return
|
245
|
-
|
246
|
-
if (arrCodes.length > 0) {
|
247
|
-
for (let i = 0; i < arrCodes.length; i ++) {
|
248
|
-
const code = arrCodes[i ];
|
249
|
-
var strAll = code.textContent
|
250
|
-
if (!strAll.startsWith("#mapdata")) {
|
251
|
-
return
|
252
|
-
}
|
253
|
-
|
254
|
-
parseDataAndCeateMap(strAll,code.parentNode.parentNode.parentNode)
|
255
|
-
|
256
|
-
|
257
|
-
}
|
258
|
-
|
259
|
-
}
|
260
|
-
}
|
261
|
-
|
262
|
-
initData()
|
263
|
-
|
264
|
-
window['_after_dec_fun'] = function () {
|
265
|
-
let con = document.getElementById('loveiContainer')
|
266
|
-
if (!con) {
|
267
|
-
let decryptContent = document.getElementById('decryptContent')
|
268
|
-
if (!decryptContent) return
|
269
|
-
con = document.createElement('div')
|
270
|
-
con.id = 'loveiContainer'
|
271
|
-
decryptContent.insertBefore(con, decryptContent.firstChild)
|
272
|
-
|
273
|
-
}
|
274
|
-
|
275
|
-
initData()
|
276
|
-
}
|
277
|
-
window['_after_enc_fun'] = function () {
|
278
|
-
document.getElementById('loveiContainer').innerHTML = ''
|
279
|
-
}
|
280
|
-
})();
|
1
|
+
!function(){var t=100;function e(t){const e=t.split("-").map(Number);if(3!==e.length)throw new Error(`Invalid date format: ${t}`);const[n,r,l]=e;return new Date(n,r-1,l)}function n(t){if(t){
|
2
|
+
const e=t.split("-");return`${e[0]}-${e[1].padStart(2,"0")}-${e[2].padStart(2,"0")}`}return t}function r(t){let e=t.getMonth()+1,n=t.getDate()
|
3
|
+
;return`${t.getFullYear()}-${e<10?"0"+e:e}-${n<10?"0"+n:n}`}function l(t,i){if(!t)return null;let a=t.trim();if(!a)return null;if(i&&function(t,e){if(t&&t.startsWith("#")){let n=t.split(" ")
|
4
|
+
;if(n.length>=2){let r=n[0].substring(1);if(r)return e[r]=t.substring(r.length+2).trim(),1}}return 0}(a,i))return null;var o=a.split(" "),u=o[0];if(u=u.replace("~","~"),i&&u.indexOf("~")>0){
|
5
|
+
let t=u.split("~"),i=t[0],a=t[1],f=e(n(i));if(!f||isNaN(f))return;let s=7;if(a){let t=e(n(a));t&&!isNaN(t)&&(s=Math.floor((t.getTime()-f.getTime())/864e5)+1)
|
6
|
+
}else s=Math.floor((Date.now()-f.getTime())/864e5)+1,s>7&&(s=7);const c=o.slice(1).join(" ");let d=[];const g=f.getTime();for(let t=0;t<s;t++){const e=l(r(new Date(g+864e5*t))+" "+c);e&&d.push(e)}
|
7
|
+
return d.length?d:null}let f="";if(!u)return null;{let t=u.split("-");if(3==t.length){let e=t[0],n=t[1],r=t[2],l=Number(e),i=Number(n),a=Number(n)
|
8
|
+
;if(isNaN(l)||isNaN(a)||isNaN(i)||l<1900||l>2100||i<1||i>12||a<1||a>31)return null;f=e+"-"+n.padStart(2,"0")+"-"+r.padStart(2,"0")}}if(!f)return null;var s="";let c;if(o.length>1){
|
9
|
+
s=o.slice(1).join(" ");const t=/#[0-9a-fA-F]{6}/;let e=t.exec(s);e&&e.length&&(c=e[0],s=s.replace(t,""))}return{date:f,title:s,color:c}}function i(t,e){if(!e)return
|
10
|
+
;let n=e.date.substring(0,4),r=e.date.substring(5,7),l=t.allYear[n];t.allYear[n]=l?l+1:1;let i=t[n];i||(i={},t[n]=i);let a=i[r];a||(a=[],i[r]=a),a.push(e)}function a(e,n){let r={},a={allYear:r
|
11
|
+
},o=0,u=new Date,f=`${u.getFullYear()-1}-${(u.getMonth()+1).toString().padStart(2,"0")}-${u.getDate().toString().padStart(2,"0")}`;if(e.split("\n").forEach((function(t,e){if(0==e)return;let n=l(t,a)
|
12
|
+
;n&&Array.isArray(n)?n.forEach((t=>{i(a,t),t&&t.date>=f&&o++})):(i(a,n),n&&n.date>=f&&o++)})),a.title){let t=document.createElement("div");t.className="custom-map-title",t.innerText=a.title||"",
|
13
|
+
n.parentNode.insertBefore(t,n)}let s=Object.keys(r).sort().reverse(),c=a.recent,d=!0;d=c?"1"==c:o&&s.length>1,d&&create_heatmap_lv("lmpRecent365"+t++,"",a,"Last 1Y",o,n);for(let e=0;e<s.length;e++){
|
14
|
+
let r=s[e];create_heatmap_lv("lmp"+r+t++,r,a,void 0,void 0,n)}n.style.display="none"}async function o(){let t=document.querySelectorAll("pre > code")
|
15
|
+
;if(t&&0!=t.length&&t.length>0)for(let n=0;n<t.length;n++){const r=t[n];var e=r.textContent;if(!e.startsWith("#mapdata"))return;a(e,r.parentNode.parentNode.parentNode)}}o(),
|
16
|
+
window._after_dec_fun=function(){let t=document.getElementById("loveiContainer");if(!t){let e=document.getElementById("decryptContent");if(!e)return;t=document.createElement("div"),
|
17
|
+
t.id="loveiContainer",e.insertBefore(t,e.firstChild)}o()},window._after_enc_fun=function(){document.getElementById("loveiContainer").innerHTML=""}}();
|
data/_includes/heatmap.html
CHANGED
@@ -42,11 +42,10 @@
|
|
42
42
|
|
43
43
|
{% assign MothStr = site.theme_config.heatMapMonth -%}
|
44
44
|
{%- assign HeatMapShowWeek = site.theme_config.heatMapShowWeek -%}
|
45
|
-
|
45
|
+
|
46
46
|
|
47
|
-
const
|
47
|
+
const WeeKStart = {{ site.theme_config.heatMapWeekStart | default: 1 }} ;// 0 sunday 1 monday 2. tuesday ...
|
48
48
|
|
49
|
-
const heatMapLoadCount = {{heatMapLoadCount}};
|
50
49
|
var _MonthStr = '{{ MothStr | default: "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec" }}';
|
51
50
|
var _showWeek = '{{ HeatMapShowWeek | default: "Sun Mon Tue Wed Thu Fri Sat" }}';
|
52
51
|
var _allyearurl = '{{ "assets/dyn/allyear.json" | relative_url }}';
|
@@ -60,7 +59,7 @@
|
|
60
59
|
endYear = '' + endYear + '-12-31'
|
61
60
|
}
|
62
61
|
|
63
|
-
const svgmap = createSVGMap(endYear)
|
62
|
+
const svgmap = createSVGMap(endYear,null,_MonthStr,_showWeek,WeeKStart)
|
64
63
|
|
65
64
|
let father = document.getElementById(heatmapid)
|
66
65
|
if (!father) {
|
@@ -70,9 +69,7 @@
|
|
70
69
|
father.appendChild(svgmap.svg);
|
71
70
|
|
72
71
|
const p = hm_getPostData(endYear,_allyearurl);
|
73
|
-
console.log(p)
|
74
72
|
p.then(d=>{
|
75
|
-
console.log(d)
|
76
73
|
svgmap.updateDays(d)
|
77
74
|
})
|
78
75
|
|