jekyll-zeta 0.9.15 → 0.9.17

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49f440245117ccbd1620acfaf1eaff93c7d0ae5da0a47b1a5b2aad53f487d95f
4
- data.tar.gz: f6a84386270feba1985104c5b5ca0064d03fb21f354cfdaa49501696bb62900f
3
+ metadata.gz: 8bd46a233c132a633e0ba426d464460273fbcfffa520d4803324ea495b996a37
4
+ data.tar.gz: d793bbed01415f67e92101dad5348905bfba818499c09e031bf133b3dcfce787
5
5
  SHA512:
6
- metadata.gz: d97487258e046b46c2bc548085ca1821afbdf501e5cb6bf3fe6c7e8a3c38f3757102598e7e655dbfa562cca4e966d0edda4c5b2c88ff42b98778a8a2553536c3
7
- data.tar.gz: 8b5433e0ccc4c5029d28e0f0f0ec74bc2dfdc43fbaf98a9a1f8540ab90cfae744d6bc09ddd6375974ac982436af9814f777e3be1838678f3f8ace99512fe7a0a
6
+ metadata.gz: 0b85a2f1a239ecdf6ff5ffecdbb394349678551f2833c8442635991058c9ebd0f08f82565901ac943482a5b925d483fd2d44b933b560b511ae70ef049e316dd0
7
+ data.tar.gz: f9b455eb201241f93cd4b457d3a3e02e6f273b32ea59c86686ab78e2a4d61d50639691629d5037ae3f8f82ba17590e612d7992ae2a4f2af28a9cc12de7c8b797
@@ -199,7 +199,12 @@ function uint8ArrayToHex(uint8Array) {
199
199
 
200
200
  document.getElementById("decrypted").style.display = 'block'
201
201
  document.getElementById("decryptContent").innerHTML = plain
202
-
202
+
203
+ const DECFUN = window['_after_dec_fun']
204
+
205
+ if (DECFUN && typeof DECFUN == 'function') {
206
+ DECFUN()
207
+ }
203
208
  setTimeout(function(){
204
209
  var loadevent = document.createEvent("Event")
205
210
  loadevent.initEvent("load", true, true)
@@ -210,11 +215,7 @@ function uint8ArrayToHex(uint8Array) {
210
215
  window.dispatchEvent(loadevent)
211
216
  window.dispatchEvent(DOMContentLoaded_event)
212
217
 
213
- const DECFUN = window['_after_dec_fun']
214
218
 
215
- if (DECFUN && typeof DECFUN == 'function') {
216
- DECFUN()
217
- }
218
219
 
219
220
  }, 100);
220
221
  } catch (error) {
@@ -0,0 +1,128 @@
1
+ ;function hm_getPostData( endYear ,_allyearurl) {
2
+ endYear = ('' + endYear).substring(0,4)
3
+
4
+ let arr = _allyearurl.split("/");
5
+ arr.pop();
6
+ const jsonUrlBase = arr.join("/");
7
+
8
+ var GDATA = window['__GDATA__']
9
+ if (!GDATA) {
10
+ GDATA = {}
11
+ window['__GDATA__']
12
+ }
13
+
14
+
15
+ let queue = window._y_queue || []
16
+ window._y_queue = queue;
17
+
18
+
19
+ function getAllYearCfg(){
20
+
21
+
22
+ if (GDATA['_allYear']) {
23
+ return GDATA['_allYear'];
24
+ }
25
+
26
+ if (window._isFetchAllYearData == 1) {
27
+ return new Promise(r=>{
28
+ queue.push(r);
29
+ })
30
+ }
31
+
32
+
33
+ window._isFetchAllYearData = 1;
34
+ return fetch(_allyearurl)
35
+ .then((r) => r.json())
36
+ .then(d => {
37
+ window._isFetchAllYearData = 0;
38
+ if (queue.length) {
39
+ queue.forEach(calback=>{calback(d)});
40
+ queue.length = 0;
41
+ }
42
+ GDATA['_allYear'] = d ;return d ;})
43
+ }
44
+
45
+ function getYearData(year) {
46
+ year = '' + year
47
+
48
+ if(GDATA[year]){
49
+ return GDATA[year]
50
+ }
51
+
52
+ let queueFlgKey = '_singleyearFlg' + year
53
+ let queueArrKey = '_singleyearQueue' + year
54
+ if (GDATA[queueFlgKey] == 1) {
55
+ // console.log('put in queue',year,Math.random())
56
+ let arrQueue = GDATA[queueArrKey]
57
+ if (!arrQueue) {
58
+ arrQueue = []
59
+ GDATA[queueArrKey] = arrQueue;
60
+ }
61
+
62
+ return new Promise(r=>{
63
+ arrQueue.push(r);
64
+ });
65
+ }
66
+
67
+
68
+ GDATA[queueFlgKey] = 1;
69
+ // console.log('RealQuery',year,Math.random())
70
+ return fetch(`${jsonUrlBase}/${year}.json`)
71
+ .then((r) => r.json())
72
+ .then(d=>{
73
+ GDATA[queueFlgKey] = 0 ;GDATA[year] = d;
74
+ let queue = GDATA[queueArrKey];
75
+ // console.log('queryFinish',year)
76
+ if(queue && queue.length){
77
+ queue.forEach(cb=>{
78
+ // console.log('queryFinishQueue',year,queue.length,Math.random());
79
+ cb(d);})
80
+ queue.length = 0;
81
+ GDATA[queueArrKey] = undefined
82
+ }
83
+
84
+ return d})
85
+ .catch((e) => {
86
+ return null;
87
+ });
88
+ }
89
+
90
+ function _getAllData() {
91
+ let year = "" + endYear
92
+ let preYear = "" + (Number(year) - 1);
93
+ return getAllYearCfg()
94
+ .then((d) => {
95
+ let yearCfg = d;
96
+
97
+ let arr = [];
98
+ if (yearCfg[year]) {
99
+ arr.push(getYearData(year));
100
+ }
101
+
102
+ if (yearCfg[preYear]) {
103
+ arr.push(getYearData(preYear));
104
+ }
105
+ return Promise.all(arr).then((alldata) => {
106
+ let combineData = {};
107
+ let d1 = alldata[0];
108
+ let d2 = alldata[1];
109
+
110
+
111
+
112
+ if(d1 && d1.year){
113
+ combineData[d1.year] = d1
114
+ }
115
+
116
+ if(d2 && d2.year){
117
+ combineData[d2.year] = d2
118
+ }
119
+
120
+ return Promise.resolve(combineData)
121
+ });
122
+ });
123
+ }
124
+
125
+
126
+ return _getAllData()
127
+
128
+ };
@@ -25,11 +25,21 @@
25
25
  只加载一次
26
26
  {% endcomment %}
27
27
  <script >
28
+
28
29
  function create_heatmap(heatmapid,endYear){
30
+ {%- include getPostData.js -%}
31
+ {%- include heatmap_svg.js -%}
32
+
33
+
34
+ /**************************************/
35
+ /**************************************/
36
+ /**************************************/
29
37
 
30
- {%- assign MothStr = site.theme_config.heatMapMonth -%}
38
+
39
+
40
+ {% assign MothStr = site.theme_config.heatMapMonth -%}
31
41
  {%- assign HeatMapShowWeek = site.theme_config.heatMapShowWeek -%}
32
- {%- assign heatMapLoadCount = site.theme_config.heatMapLoadCount | default: 8 -%}
42
+ {%- assign heatMapLoadCount = site.theme_config.heatMapLoadCount | default: 8 %}
33
43
 
34
44
  const WeeKStartStr = "{{ site.theme_config.heatMapWeekStart | default: 0 }}" ;// 0 sunday 1 monday 2. tuesday ...
35
45
 
@@ -37,9 +47,31 @@
37
47
  var _MonthStr = '{{ MothStr | default: "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec" }}';
38
48
  var _showWeek = '{{ HeatMapShowWeek | default: "Sun Mon Tue Wed Thu Fri Sat" }}';
39
49
  var _allyearurl = '{{ "assets/dyn/allyear.json" | relative_url }}';
40
- {% include heatmap.js %}
50
+
51
+
52
+
53
+ if (!endYear) {
54
+ let now = new Date()
55
+ endYear = `${now.getFullYear()}-${(101 + now.getMonth()).toString().substring(1)}-${(100 + now.getDate()).toString().substring(1)}`
56
+ }else if(('' + endYear).length == 4 ){
57
+ endYear = '' + endYear + '-12-31'
58
+ }
59
+
60
+ const svgmap = createSVGMap(endYear)
61
+
62
+ let father = document.getElementById(heatmapid)
63
+ father.appendChild(svgmap.svg);
64
+
65
+ const p = hm_getPostData(endYear,_allyearurl);
66
+ console.log(p)
67
+ p.then(d=>{
68
+ console.log(d)
69
+ svgmap.updateDays(d)
70
+ })
71
+
72
+
41
73
 
42
- __filldata(heatmapid,endYear,WeeKStartStr,heatMapLoadCount,_MonthStr,_showWeek,_allyearurl)
74
+
43
75
  }
44
76
  </script>
45
77
 
@@ -0,0 +1,483 @@
1
+ ;function createSVGMap (endYmd,dateBeginYmd) {
2
+ const monthArr = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ");
3
+ const weekarr = "Sun Mon Tue Wed Thu Fri Sat".split(" ");
4
+
5
+ if (!endYmd) {
6
+ endYmd = `${new Date().getFullYear()}-12-31`;
7
+ }
8
+ else if(endYmd.length == 4){
9
+ endYmd = `${endYmd}-12-31`;
10
+ }
11
+ let dateEnd = new Date(date2ymd(new Date(endYmd)));
12
+ let dateBegin = dateBeginYmd ? new Date(date2ymd(new Date(dateBeginYmd))) : dateBeginYmd
13
+
14
+ const colorInit = '#eef7f2'
15
+
16
+
17
+ const namespaceURI = "http://www.w3.org/2000/svg";
18
+ const dayStartX = 35;
19
+ const dayStartY = 30;
20
+ const dayW = 12;
21
+ const dayH = 12;
22
+ const dayGap = 2;
23
+
24
+ const WeekCount = 53;
25
+ const WeekStart = 1; // sunday
26
+
27
+ const mapW = dayStartX + (dayGap + dayW) * WeekCount + 10;
28
+ const mapH = dayStartY + (dayGap + dayH) * 7 + 20
29
+
30
+ const mapId = "MP-" + Math.random().toString(16).substring(2);
31
+ const daysId = mapId + "days";
32
+ const tipId = mapId + "tip";
33
+
34
+
35
+ const endDateDay = dateEnd.getDay();
36
+ const endStamp = dateEnd.getTime();
37
+ const DayCount = (WeekCount - 1) * 7 + ((7 + endDateDay - WeekStart) % 7);
38
+ var minYmd = getPreYearYmd(endStamp);
39
+
40
+ const MinYmdIdx =
41
+ DayCount - Math.floor((endStamp - new Date(minYmd)) / (24 * 3600000)) + 1;
42
+
43
+
44
+
45
+ const TodayIdx =
46
+ DayCount - Math.floor((endStamp - new Date(date2ymd(new Date))) / (24 * 3600000));
47
+
48
+ console.log('xxxxx',Math.floor((endStamp - Date.now()) / (24 * 3600000)));
49
+
50
+ const beginIdx = !dateBegin ? -1 : DayCount - Math.floor((endStamp - dateBegin.getTime()) / (24 * 3600000));
51
+
52
+ function getPreYearYmd(stamp) {
53
+ const t = new Date(stamp);
54
+ let y = t.getFullYear() - 1;
55
+ let m = t.getMonth() + 1;
56
+ let d = t.getDate();
57
+ let ymd = `${y}-${m < 10 ? "0" + m : m}-${d < 10 ? "0" + d : d}`;
58
+ return ymd;
59
+ }
60
+
61
+ function idx2Ymd(idx) {
62
+ let t = new Date(endStamp - (DayCount - idx) * 3600000 * 24);
63
+ return date2ymd(t);
64
+ }
65
+ function date2ymd(t) {
66
+ let m = t.getMonth() + 1;
67
+ let d = t.getDate();
68
+ return `${t.getFullYear()}-${m < 10 ? "0" + m : m}-${d < 10 ? "0" + d : d}`;
69
+ }
70
+
71
+ function createDayItem(idx) {
72
+ // if (idx < MinYmdIdx || idx > DayCount) {
73
+ // return
74
+ // }
75
+
76
+ const rc = document.createElementNS(namespaceURI, "rect");
77
+ rc.setAttribute("width", "" + dayW);
78
+ rc.setAttribute("height", "" + dayH);
79
+ rc.setAttribute("rx", "1");
80
+ rc.setAttribute("ry", "1");
81
+
82
+ rc.setAttribute("fill", colorInit);
83
+ const c = Math.floor(idx / 7);
84
+ const r = idx - c * 7;
85
+
86
+ const x = c * dayW + c * dayGap;
87
+ const y = r * dayH + r * dayGap;
88
+
89
+ rc.setAttribute("x", "" + x);
90
+ rc.setAttribute("y", "" + y);
91
+ rc.dataset.x = x
92
+ rc.dataset.y = y
93
+
94
+ let ymd = idx2Ymd(idx);
95
+ rc.dataset.ymd = ymd;
96
+ rc.id = "day-item-" + ymd;
97
+
98
+ let m = ymd.substring(5, 7);
99
+ let d = ymd.substring(8, 10);
100
+
101
+ if (d <= "07" && idx % 7 == 0) {
102
+ // showMonth
103
+ let mon = monthArr[Number(m) - 1];
104
+ let mEle = document.createElementNS(namespaceURI, "text");
105
+ mEle.setAttribute("y", `${dayStartY - 8}`);
106
+ mEle.setAttribute("x", x);
107
+ mEle.textContent = mon;
108
+ mEle.setAttribute("fill", idx > TodayIdx ? "#878787" : "#113");
109
+ mEle.setAttribute("font-size", "13");
110
+ mEle.setAttribute("font-family", "monospace");
111
+ // mEle.setAttribute('stroke','# f00')
112
+ // mEle.setAttribute('stroke-width','1')
113
+ monthG.appendChild(mEle);
114
+ }
115
+
116
+ return rc;
117
+ }
118
+
119
+ function updateDays(dataMap) {
120
+ const color = dataMap.color || '#40c463'
121
+
122
+
123
+ const t2 = document.createElementNS(namespaceURI,'tspan')
124
+ t2.setAttribute('font-size','12')
125
+ t2.setAttribute('dy','0')
126
+ t2.setAttribute('dx','10')
127
+ t2.setAttribute('fill','#888888')
128
+ t2.setAttribute('font-family','courier')
129
+ t2.textContent = '';
130
+ tilteE.append(t2)
131
+
132
+
133
+ let countOfItem = 0
134
+
135
+ function shuffle(array) {
136
+ let currentIndex = array.length;
137
+
138
+ // While there remain elements to shuffle...
139
+ while (currentIndex != 0) {
140
+ // Pick a remaining element...
141
+ let randomIndex = Math.floor(Math.random() * currentIndex);
142
+ currentIndex--;
143
+
144
+ // And swap it with the current element.
145
+ [array[currentIndex], array[randomIndex]] = [
146
+ array[randomIndex],
147
+ array[currentIndex],
148
+ ];
149
+ }
150
+ }
151
+
152
+ let daysHoder = groupDay;
153
+ let arrNodes = daysHoder.childNodes;
154
+ let count = WeekCount * 7;
155
+ let arrUpdates = new Array(count);
156
+ for (let i = 0; i < count; i++) {
157
+ arrUpdates[i] = i;
158
+ }
159
+ shuffle(arrUpdates);
160
+
161
+ function getDayDataCount(idx, ymd) {
162
+ let y = ymd.substring(0,4)
163
+ let m = ymd.substring(5,7)
164
+ let yObj = dataMap[y]
165
+ if (yObj && yObj[m]) {
166
+ let arr = yObj[m]
167
+ let r = arr.filter(e=>e.date == ymd)
168
+ return r && r.length ? r : null
169
+ }
170
+
171
+ return null;
172
+ }
173
+
174
+ function updateDay1(idx) {
175
+ let node = arrNodes[idx];
176
+ if (node) {
177
+ if (idx < MinYmdIdx || idx > DayCount) {
178
+ node.setAttribute("display", "none");
179
+ return;
180
+ }
181
+
182
+
183
+
184
+ let ymd = node.dataset.ymd;
185
+ let m = ymd.substring(5, 7);
186
+ let isOdd = Number(m) % 2;
187
+
188
+
189
+ let arrData = getDayDataCount(idx, node.dataset.ymd);
190
+ if(arrData && arrData.length){
191
+ countOfItem += arrData.length;
192
+ t2.textContent = `x ${countOfItem}`
193
+ }
194
+ if (!arrData && (idx > TodayIdx || idx < beginIdx)) {
195
+ node.setAttribute("fill", isOdd ? "url(#fillB)" : "url(#fillA)");
196
+
197
+
198
+ node.onmouseenter = function () {
199
+ node.setAttribute('stroke','#000000')
200
+ node.setAttribute('stroke-width','1')
201
+ showTip(node, idx, arrData);
202
+ };
203
+ node.onmouseleave = function () {
204
+ node.setAttribute('stroke','')
205
+ node.setAttribute('stroke-width','')
206
+ showTip(node, -1);
207
+ };
208
+
209
+ return;
210
+ }
211
+
212
+
213
+
214
+
215
+ const c = arrData && arrData.length;
216
+ let colorSet = color
217
+ if (c) {
218
+ let customColor = arrData.find(e=>e.color)
219
+ if(customColor ){
220
+ colorSet = customColor.color
221
+ }
222
+
223
+ node.setAttribute("class", "svg-day-1");
224
+ node.setAttribute(
225
+ "fill",
226
+ c == 1
227
+ ? colorSet + "77"
228
+ : c == 2
229
+ ? colorSet + "aa"
230
+ : colorSet + "ff"
231
+ );
232
+
233
+ node.onmouseenter = function () {
234
+ node.setAttribute('stroke','#000000')
235
+ node.setAttribute('stroke-width','1')
236
+ showTip(node, idx, arrData);
237
+ };
238
+ node.onmouseleave = function () {
239
+ node.setAttribute('stroke','')
240
+ node.setAttribute('stroke-width','')
241
+ showTip(node, -1);
242
+ };
243
+ } else {
244
+
245
+
246
+ node.onmouseenter = function () {
247
+ node.setAttribute('stroke','#000000')
248
+ node.setAttribute('stroke-width','1')
249
+ showTip(node, idx, arrData);
250
+ };
251
+ node.onmouseleave = function () {
252
+ node.setAttribute('stroke','')
253
+ node.setAttribute('stroke-width','')
254
+ showTip(node, -1);
255
+ };
256
+
257
+ let ymd = node.dataset.ymd;
258
+ if (ymd) {
259
+ let m = ymd.substring(5, 7);
260
+ let isOdd = Number(m) % 2;
261
+ node.setAttribute("fill", isOdd ? "#edebf0" : "#edebf0aa");
262
+ } else {
263
+ node.setAttribute("fill", "#efefef");
264
+ }
265
+ }
266
+ }
267
+ }
268
+
269
+ var startIdx = 0;
270
+ function updateMultiDays() {
271
+ if (startIdx < arrUpdates.length) {
272
+ const C = 19;
273
+ var i = 0;
274
+ while (i++ < C) {
275
+ if (startIdx >= arrUpdates.length) return;
276
+ updateDay1(arrUpdates[startIdx++]);
277
+ }
278
+
279
+ requestAnimationFrame(updateMultiDays);
280
+ }
281
+ }
282
+ updateMultiDays();
283
+ }
284
+
285
+ // 创建 <svg> 根元素
286
+ const svg = document.createElementNS(namespaceURI, "svg");
287
+ svg.id = mapId;
288
+ svg.setAttribute("width", "" + mapW);
289
+ svg.setAttribute("height", "" + mapH);
290
+
291
+ // svg.style.backgroundColor = "#fffff0";
292
+ svg.style.overflow = "visible";
293
+
294
+
295
+ let defsObj = document.createElementNS(namespaceURI, "defs");
296
+ defsObj.innerHTML = `
297
+ <pattern id="fillA" patternUnits="userSpaceOnUse" width="${3}" height="${3}">
298
+ <path d="M 0 0 L 6 6" stroke="#ccc" stroke-width="1"/>
299
+ </pattern>
300
+
301
+ <pattern id="fillB" patternUnits="userSpaceOnUse" width="${6}" height="${6}">
302
+ <path d="M 0 6 L 6 0" stroke="#bbb" stroke-width="1"/>
303
+ </pattern>
304
+ `;
305
+
306
+ svg.appendChild(defsObj);
307
+
308
+ const monthG = document.createElementNS(namespaceURI, "g");
309
+ monthG.setAttribute("transform", `translate(${dayStartX}, ${0})`);
310
+ svg.appendChild(monthG);
311
+
312
+ const weekG = document.createElementNS(namespaceURI, "g");
313
+ weekG.setAttribute("transform", `translate(${0}, ${dayStartY})`);
314
+ svg.appendChild(weekG);
315
+ function createWeek(str, pos) {
316
+ let w2 = document.createElementNS(namespaceURI, "text");
317
+ w2.textContent = str;
318
+ w2.setAttribute("font-family", "monospace");
319
+ w2.setAttribute("font-size", "13");
320
+ w2.setAttribute("fill", "#333");
321
+ // w2.setAttribute('text-anchor','end')
322
+ w2.setAttribute("width", "" + (dayStartX + 10));
323
+ w2.setAttribute("height", "" + dayH);
324
+ w2.setAttribute("x", "5");
325
+ const y = pos * (dayH + dayGap) + 10;
326
+ w2.setAttribute("y", "" + y);
327
+
328
+ weekG.appendChild(w2);
329
+ return w2;
330
+ }
331
+
332
+ createWeek(weekarr[(WeekStart + 1) % 7], 1);
333
+ createWeek(weekarr[(WeekStart + 3) % 7], 3);
334
+ createWeek(weekarr[(WeekStart + 5) % 7], 5);
335
+
336
+ // 创建一个 <rect> 元素(矩形)
337
+ const groupDay = document.createElementNS(namespaceURI, "g");
338
+ groupDay.id = daysId;
339
+ groupDay.setAttribute("transform", `translate(${dayStartX}, ${dayStartY})`);
340
+
341
+ svg.appendChild(groupDay);
342
+
343
+ const fragment = document.createDocumentFragment();
344
+
345
+ const count = 7 * 53;
346
+ for (let i = 0; i < count; i++) {
347
+ const rc = createDayItem(i);
348
+ if (rc) {
349
+ fragment.appendChild(rc);
350
+ }
351
+ }
352
+
353
+
354
+
355
+ groupDay.appendChild(fragment);
356
+
357
+ const tilteE = document.createElementNS(namespaceURI, "text");
358
+ tilteE.setAttribute("y", `${dayStartY + (dayGap + dayH) * 7 + 10 } `);
359
+ tilteE.setAttribute("x", `${mapW - 10}` );
360
+
361
+ tilteE.setAttribute("fill", '#999999');
362
+ tilteE.setAttribute("font-size", "15");
363
+ // tilteE.setAttribute("font-weight", "medium");
364
+ tilteE.setAttribute("font-family", "monospace");
365
+ tilteE.setAttribute('text-anchor','end')
366
+ tilteE.setAttribute('dominant-baseline','middle')
367
+ svg.appendChild(tilteE)
368
+
369
+
370
+ const beginYmd = idx2Ymd(MinYmdIdx)
371
+ if (beginYmd.substring(0,4) == endYmd.substring(0,4)) {
372
+ tilteE.textContent = beginYmd.substring(0,4)
373
+ }else{
374
+ tilteE.textContent = ` ~ ${endYmd}`
375
+ }
376
+
377
+
378
+
379
+
380
+
381
+ const tipG = document.createElementNS(namespaceURI, "g");
382
+ tipG.id = tipId;
383
+ svg.appendChild(tipG);
384
+
385
+ var tipState = {
386
+ showFlag: 0,
387
+ idx: -1,
388
+ };
389
+ function showTip(dayNode, dayidx, items) {
390
+ if (dayidx < 0 ) {
391
+ tipState.showFlag = 0;
392
+ setTimeout(() => {
393
+ if (tipState.showFlag == 0) {
394
+ tipG.innerHTML = "";
395
+ }
396
+ }, 50);
397
+
398
+ return;
399
+ }
400
+
401
+ if (tipState.showFlag == 2) {
402
+ return;
403
+ }
404
+
405
+ tipState.showFlag = 1;
406
+ tipState.idx = dayidx;
407
+ tipG.innerHTML = "";
408
+
409
+ const isEmpy = items ? 0 : 1
410
+ if(!items){
411
+ items = [{date:dayNode.dataset.ymd}]
412
+ }
413
+
414
+ tipG.setAttribute("class", "svg-hm-day-tip");
415
+ var width = "200";
416
+ const count = items.length
417
+ const vSpace = 10;
418
+ const lineH = 25;
419
+ const height = vSpace * 2 + lineH * count + "";
420
+ const frag = document.createDocumentFragment();
421
+ let rcbg = document.createElementNS(namespaceURI, "rect");
422
+ rcbg.setAttribute("fill", "#333333cc");
423
+
424
+ rcbg.setAttribute("height", height);
425
+ rcbg.setAttribute("rx", "5");
426
+ rcbg.setAttribute("ry", "5");
427
+ frag.append(rcbg);
428
+
429
+ tipG.onmouseenter = function () {
430
+ if(isEmpy)return
431
+ tipState.showFlag = 2;
432
+ };
433
+ tipG.onmouseleave = function () {
434
+ tipState.showFlag = 0;
435
+ tipG.innerHTML = "";
436
+ };
437
+ let txtLen = 0
438
+ items.forEach((e, i) => {
439
+ let m = e.date.substring(5,7)
440
+ let d = e.date.substring(8,10)
441
+ m = m.startsWith('0') ? m.substring(1):m
442
+ d = d.startsWith('0') ? d.substring(1):d
443
+ const txt = `${m}-${d} ${e.title || ""}`;
444
+ if(txt.length > txtLen){
445
+ txtLen = txt.length
446
+ }
447
+ const txtE = document.createElementNS(namespaceURI, "text");
448
+ txtE.textContent = txt;
449
+ txtE.setAttribute("fill", "#fff");
450
+ txtE.setAttribute("font-size", "16");
451
+ txtE.setAttribute("font-family", "monospace");
452
+ txtE.setAttribute("x", "10");
453
+ if (e.url) {
454
+ const xlinkNS = "http://www.w3.org/1999/xlink";
455
+ const a = document.createElementNS(namespaceURI, "a");
456
+ a.setAttributeNS(xlinkNS, "xlink:href", e.url);
457
+ a.setAttribute("target", "_blank");
458
+ txtE.setAttribute("y", "" + (vSpace + i * lineH + 18));
459
+
460
+ a.appendChild(txtE);
461
+ frag.appendChild(a);
462
+ } else {
463
+ txtE.setAttribute("y", "" + (vSpace + i * lineH + 15));
464
+ frag.appendChild(txtE);
465
+ }
466
+ });
467
+
468
+ width = txtLen * 14.55 + 25
469
+
470
+ rcbg.setAttribute("width", width);
471
+ tipG.appendChild(frag);
472
+
473
+ const row = dayidx % 7;
474
+ const column = (dayidx - row) / 7;
475
+ const x = dayStartX + column * (dayGap + dayW) + dayW / 2 - width / 2;
476
+ const y = dayStartY + row * (dayGap + dayH) - height - dayGap;
477
+
478
+ tipG.setAttribute("transform", `translate(${x}, ${y})`);
479
+ }
480
+
481
+ return {svg,updateDays}
482
+ }
483
+
@@ -64,23 +64,23 @@ layout: default
64
64
 
65
65
  <script >
66
66
  function create_heatmap(heatmapid,endYear,dataObj,title,count,node){
67
- let container = document.createElement('div')
68
- container.className = 'map-container'
69
- let divtitle = document.createElement('div')
70
- divtitle.className = 'lv-year'
71
-
72
- let divYear = document.createElement('div')
73
- divYear.className = 'lv-year-title'
74
- divYear.innerText = title || endYear
75
- divtitle.appendChild(divYear)
76
67
 
77
- let divYearC = document.createElement('div')
78
- divYearC.className = 'lv-year-count'
79
- divYearC.innerText = '' + (count || (dataObj.allYear[endYear] ||''))
80
- divtitle.appendChild(divYearC)
81
68
 
69
+ {%- include getPostData.js -%}
70
+
71
+
72
+
73
+ {%- include heatmap_svg.js -%}
74
+ /*******************************/
75
+ /*******************************/
76
+ /*******************************/
82
77
 
83
78
 
79
+ let container = document.createElement('div')
80
+ container.className = 'map-container'
81
+ let divtitle = document.createElement('div')
82
+ divtitle.className = 'lv-year'
83
+
84
84
  container.appendChild(divtitle)
85
85
  let div = document.createElement('div')
86
86
  div.className = 'heatmap'
@@ -88,29 +88,21 @@ layout: default
88
88
 
89
89
  container.appendChild(div)
90
90
  node.parentNode.insertBefore(container,node)
91
+
92
+ if (!endYear) {
93
+ let now = new Date()
94
+ endYear = `${now.getFullYear()}-${(101 + now.getMonth()).toString().substring(1)}-${(100 + now.getDate()).toString().substring(1)}`
95
+ }else if(('' + endYear).length == 4 ){
96
+ endYear = '' + endYear + '-12-31'
97
+ }
91
98
 
92
- setTimeout(() => {
93
- create_heatmap0( heatmapid,endYear,dataObj)
94
- }, 1);
95
- }
96
- function create_heatmap0(heatmapid,endYear,dataObj){
97
-
98
- {%- assign MothStr = site.theme_config.heatMapMonth -%}
99
- {%- assign HeatMapShowWeek = site.theme_config.heatMapShowWeek -%}
100
- {%- assign heatMapLoadCount = site.theme_config.heatMapLoadCount | default: 9 -%}
101
-
102
- const WeeKStartStr = "{{ site.theme_config.heatMapWeekStart | default: 0 }}" ;// 0 sunday 1 monday 2. tuesday ...
103
-
104
- const heatMapLoadCount = {{heatMapLoadCount}};
105
- var _MonthStr = '{{ MothStr | default: "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec" }}';
106
- var _showWeek = '{{ HeatMapShowWeek | default: "Sun Mon Tue Wed Thu Fri Sat" }}';
107
- var _allyearurl = '{{ "assets/dyn/allyear.json" | relative_url }}';
108
- {% include heatmap.js %}
109
-
110
-
111
- __filldata(heatmapid,endYear,WeeKStartStr,heatMapLoadCount,_MonthStr,_showWeek,_allyearurl,dataObj,'lv')
112
- }
113
99
 
100
+ const svgmap = createSVGMap(endYear,dataObj.beginDate)
101
+ container.appendChild(svgmap.svg);
102
+ svgmap.updateDays(dataObj)
103
+ }
104
+
105
+
114
106
 
115
107
 
116
108
  </script>
data/_sass/heatmap.scss CHANGED
@@ -244,4 +244,20 @@ $bh:2px;
244
244
 
245
245
  .border{
246
246
  border:solid 1px red;
247
- }
247
+ }
248
+
249
+
250
+ // .svg-day-1 {
251
+
252
+ // transition: transform 0.1s;
253
+ // transform-origin: center;
254
+ // transform-box: fill-box;
255
+ // /* z-index: 1 */
256
+ // }
257
+
258
+
259
+
260
+ // .svg-day-1:hover{
261
+ // transform: scale(1.25);
262
+ // /* z-index: 1000 */
263
+ // }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-zeta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.15
4
+ version: 0.9.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - vitock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-14 00:00:00.000000000 Z
11
+ date: 2025-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -66,11 +66,13 @@ files:
66
66
  - _includes/back_link.html
67
67
  - _includes/collecttags.html
68
68
  - _includes/encrypted.html
69
+ - _includes/getPostData.js
69
70
  - _includes/getmapdata.js
70
71
  - _includes/goat_counter.html
71
72
  - _includes/head.html
72
73
  - _includes/heatmap.html
73
74
  - _includes/heatmap.js
75
+ - _includes/heatmap_svg.js
74
76
  - _includes/home.html
75
77
  - _includes/main.css
76
78
  - _includes/menu_item.html