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/heatmap_svg.js
CHANGED
@@ -1,489 +1,38 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
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
|
-
|
49
|
-
const beginIdx = !dateBegin ? -1 : DayCount - Math.floor((endStamp - dateBegin.getTime()) / (24 * 3600000));
|
50
|
-
|
51
|
-
function getPreYearYmd(stamp) {
|
52
|
-
const t = new Date(stamp);
|
53
|
-
let y = t.getFullYear() - 1;
|
54
|
-
let m = t.getMonth() + 1;
|
55
|
-
let d = t.getDate();
|
56
|
-
let ymd = `${y}-${m < 10 ? "0" + m : m}-${d < 10 ? "0" + d : d}`;
|
57
|
-
return ymd;
|
58
|
-
}
|
59
|
-
|
60
|
-
function idx2Ymd(idx) {
|
61
|
-
let t = new Date(endStamp - (DayCount - idx) * 3600000 * 24);
|
62
|
-
return date2ymd(t);
|
63
|
-
}
|
64
|
-
function date2ymd(t) {
|
65
|
-
let m = t.getMonth() + 1;
|
66
|
-
let d = t.getDate();
|
67
|
-
return `${t.getFullYear()}-${m < 10 ? "0" + m : m}-${d < 10 ? "0" + d : d}`;
|
68
|
-
}
|
69
|
-
|
70
|
-
function createDayItem(idx) {
|
71
|
-
// if (idx < MinYmdIdx || idx > DayCount) {
|
72
|
-
// return
|
73
|
-
// }
|
74
|
-
|
75
|
-
const rc = document.createElementNS(namespaceURI, "rect");
|
76
|
-
rc.setAttribute("width", "" + dayW);
|
77
|
-
rc.setAttribute("height", "" + dayH);
|
78
|
-
rc.setAttribute("rx", "1");
|
79
|
-
rc.setAttribute("ry", "1");
|
80
|
-
|
81
|
-
rc.setAttribute("fill", colorInit);
|
82
|
-
const c = Math.floor(idx / 7);
|
83
|
-
const r = idx - c * 7;
|
84
|
-
|
85
|
-
const x = c * dayW + c * dayGap;
|
86
|
-
const y = r * dayH + r * dayGap;
|
87
|
-
|
88
|
-
rc.setAttribute("x", "" + x);
|
89
|
-
rc.setAttribute("y", "" + y);
|
90
|
-
rc.dataset.x = x
|
91
|
-
rc.dataset.y = y
|
92
|
-
|
93
|
-
let ymd = idx2Ymd(idx);
|
94
|
-
rc.dataset.ymd = ymd;
|
95
|
-
rc.id = "day-item-" + ymd;
|
96
|
-
|
97
|
-
let m = ymd.substring(5, 7);
|
98
|
-
let d = ymd.substring(8, 10);
|
99
|
-
|
100
|
-
if (d <= "07" && idx % 7 == 0) {
|
101
|
-
// showMonth
|
102
|
-
let mon = monthArr[Number(m) - 1];
|
103
|
-
let mEle = document.createElementNS(namespaceURI, "text");
|
104
|
-
mEle.setAttribute("y", `${dayStartY - 8}`);
|
105
|
-
mEle.setAttribute("x", x);
|
106
|
-
mEle.textContent = mon;
|
107
|
-
mEle.setAttribute("fill", idx > TodayIdx ? "#878787" : "#113");
|
108
|
-
mEle.setAttribute("font-size", "13");
|
109
|
-
mEle.setAttribute("font-family", "monospace");
|
110
|
-
// mEle.setAttribute('stroke','# f00')
|
111
|
-
// mEle.setAttribute('stroke-width','1')
|
112
|
-
monthG.appendChild(mEle);
|
113
|
-
}
|
114
|
-
|
115
|
-
return rc;
|
116
|
-
}
|
117
|
-
|
118
|
-
function updateDays(dataMap) {
|
119
|
-
const color = dataMap.color || '#40c463'
|
120
|
-
|
121
|
-
|
122
|
-
const t2 = document.createElementNS(namespaceURI,'tspan')
|
123
|
-
t2.setAttribute('font-size','12')
|
124
|
-
t2.setAttribute('dy','0')
|
125
|
-
t2.setAttribute('dx','10')
|
126
|
-
t2.setAttribute('fill','#888888')
|
127
|
-
t2.setAttribute('font-family','courier')
|
128
|
-
t2.textContent = '';
|
129
|
-
tilteE.append(t2)
|
130
|
-
|
131
|
-
|
132
|
-
let countOfItem = 0
|
133
|
-
|
134
|
-
function shuffle(array) {
|
135
|
-
let currentIndex = array.length;
|
136
|
-
|
137
|
-
// While there remain elements to shuffle...
|
138
|
-
while (currentIndex != 0) {
|
139
|
-
// Pick a remaining element...
|
140
|
-
let randomIndex = Math.floor(Math.random() * currentIndex);
|
141
|
-
currentIndex--;
|
142
|
-
|
143
|
-
// And swap it with the current element.
|
144
|
-
[array[currentIndex], array[randomIndex]] = [
|
145
|
-
array[randomIndex],
|
146
|
-
array[currentIndex],
|
147
|
-
];
|
148
|
-
}
|
149
|
-
}
|
150
|
-
|
151
|
-
let daysHoder = groupDay;
|
152
|
-
let arrNodes = daysHoder.childNodes;
|
153
|
-
let count = WeekCount * 7;
|
154
|
-
let arrUpdates = new Array(count);
|
155
|
-
for (let i = 0; i < count; i++) {
|
156
|
-
arrUpdates[i] = i;
|
157
|
-
}
|
158
|
-
shuffle(arrUpdates);
|
159
|
-
|
160
|
-
function getDayDataCount(idx, ymd) {
|
161
|
-
let y = ymd.substring(0,4)
|
162
|
-
let m = ymd.substring(5,7)
|
163
|
-
let yObj = dataMap[y]
|
164
|
-
if (yObj && yObj[m]) {
|
165
|
-
let arr = yObj[m]
|
166
|
-
let r = arr.filter(e=>e.date == ymd)
|
167
|
-
return r && r.length ? r : null
|
168
|
-
}
|
169
|
-
|
170
|
-
return null;
|
171
|
-
}
|
172
|
-
|
173
|
-
function updateDay1(idx) {
|
174
|
-
let node = arrNodes[idx];
|
175
|
-
if (node) {
|
176
|
-
if (idx < MinYmdIdx || idx > DayCount) {
|
177
|
-
node.setAttribute("display", "none");
|
178
|
-
return;
|
179
|
-
}
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
let ymd = node.dataset.ymd;
|
184
|
-
let m = ymd.substring(5, 7);
|
185
|
-
let isOdd = Number(m) % 2;
|
186
|
-
|
187
|
-
|
188
|
-
let arrData = getDayDataCount(idx, node.dataset.ymd);
|
189
|
-
if(arrData && arrData.length){
|
190
|
-
countOfItem += arrData.length;
|
191
|
-
t2.textContent = `x ${countOfItem}`
|
192
|
-
}
|
193
|
-
if (!arrData && (idx > TodayIdx || idx < beginIdx)) {
|
194
|
-
node.setAttribute("fill", isOdd ? "url(#fillB)" : "url(#fillA)");
|
195
|
-
|
196
|
-
|
197
|
-
node.onmouseenter = function () {
|
198
|
-
node.setAttribute('stroke','#000000')
|
199
|
-
node.setAttribute('stroke-width','1')
|
200
|
-
showTip(node, idx, arrData);
|
201
|
-
};
|
202
|
-
node.onclick = node.onmouseenter
|
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.onclick = node.onmouseenter
|
239
|
-
node.onmouseleave = function () {
|
240
|
-
node.setAttribute('stroke','')
|
241
|
-
node.setAttribute('stroke-width','')
|
242
|
-
showTip(node, -1);
|
243
|
-
};
|
244
|
-
} else {
|
245
|
-
|
246
|
-
|
247
|
-
node.onmouseenter = function () {
|
248
|
-
node.setAttribute('stroke','#000000')
|
249
|
-
node.setAttribute('stroke-width','1')
|
250
|
-
showTip(node, idx, arrData);
|
251
|
-
};
|
252
|
-
node.onclick = node.onmouseenter
|
253
|
-
node.onmouseleave = function () {
|
254
|
-
node.setAttribute('stroke','')
|
255
|
-
node.setAttribute('stroke-width','')
|
256
|
-
showTip(node, -1);
|
257
|
-
};
|
258
|
-
|
259
|
-
let ymd = node.dataset.ymd;
|
260
|
-
if (ymd) {
|
261
|
-
let m = ymd.substring(5, 7);
|
262
|
-
let isOdd = Number(m) % 2;
|
263
|
-
node.setAttribute("fill", isOdd ? "#edebf0" : "#edebf0aa");
|
264
|
-
} else {
|
265
|
-
node.setAttribute("fill", "#efefef");
|
266
|
-
}
|
267
|
-
}
|
268
|
-
}
|
269
|
-
}
|
270
|
-
|
271
|
-
var startIdx = 0;
|
272
|
-
function updateMultiDays() {
|
273
|
-
if (startIdx < arrUpdates.length) {
|
274
|
-
const C = 19;
|
275
|
-
var i = 0;
|
276
|
-
while (i++ < C) {
|
277
|
-
if (startIdx >= arrUpdates.length) return;
|
278
|
-
updateDay1(arrUpdates[startIdx++]);
|
279
|
-
}
|
280
|
-
|
281
|
-
requestAnimationFrame(updateMultiDays);
|
282
|
-
}
|
283
|
-
}
|
284
|
-
updateMultiDays();
|
285
|
-
}
|
286
|
-
|
287
|
-
// 创建 <svg> 根元素
|
288
|
-
const svg = document.createElementNS(namespaceURI, "svg");
|
289
|
-
svg.id = mapId;
|
290
|
-
svg.setAttribute("width", "" + mapW);
|
291
|
-
svg.setAttribute("height", "" + mapH);
|
292
|
-
|
293
|
-
// svg.style.backgroundColor = "#fffff0";
|
294
|
-
svg.style.overflow = "visible";
|
295
|
-
|
296
|
-
|
297
|
-
let defsObj = document.createElementNS(namespaceURI, "defs");
|
298
|
-
defsObj.innerHTML = `
|
299
|
-
<pattern id="fillA" patternUnits="userSpaceOnUse" width="${3}" height="${3}">
|
300
|
-
<path d="M 0 0 L 6 6" stroke="#ccc" stroke-width="1"/>
|
301
|
-
</pattern>
|
302
|
-
|
303
|
-
<pattern id="fillB" patternUnits="userSpaceOnUse" width="${6}" height="${6}">
|
304
|
-
<path d="M 0 6 L 6 0" stroke="#bbb" stroke-width="1"/>
|
305
|
-
</pattern>
|
306
|
-
`;
|
307
|
-
|
308
|
-
svg.appendChild(defsObj);
|
309
|
-
|
310
|
-
const monthG = document.createElementNS(namespaceURI, "g");
|
311
|
-
monthG.setAttribute("transform", `translate(${dayStartX}, ${0})`);
|
312
|
-
svg.appendChild(monthG);
|
313
|
-
|
314
|
-
const weekG = document.createElementNS(namespaceURI, "g");
|
315
|
-
weekG.setAttribute("transform", `translate(${0}, ${dayStartY})`);
|
316
|
-
svg.appendChild(weekG);
|
317
|
-
function createWeek(str, pos) {
|
318
|
-
let w2 = document.createElementNS(namespaceURI, "text");
|
319
|
-
w2.textContent = str;
|
320
|
-
w2.setAttribute("font-family", "monospace");
|
321
|
-
w2.setAttribute("font-size", "13");
|
322
|
-
w2.setAttribute("fill", "#333");
|
323
|
-
// w2.setAttribute('text-anchor','end')
|
324
|
-
w2.setAttribute("width", "" + (dayStartX + 10));
|
325
|
-
w2.setAttribute("height", "" + dayH);
|
326
|
-
w2.setAttribute("x", "5");
|
327
|
-
const y = pos * (dayH + dayGap) + 10;
|
328
|
-
w2.setAttribute("y", "" + y);
|
329
|
-
|
330
|
-
weekG.appendChild(w2);
|
331
|
-
return w2;
|
332
|
-
}
|
333
|
-
|
334
|
-
createWeek(weekarr[(WeekStart + 1) % 7], 1);
|
335
|
-
createWeek(weekarr[(WeekStart + 3) % 7], 3);
|
336
|
-
createWeek(weekarr[(WeekStart + 5) % 7], 5);
|
337
|
-
|
338
|
-
// 创建一个 <rect> 元素(矩形)
|
339
|
-
const groupDay = document.createElementNS(namespaceURI, "g");
|
340
|
-
groupDay.id = daysId;
|
341
|
-
groupDay.setAttribute("transform", `translate(${dayStartX}, ${dayStartY})`);
|
342
|
-
|
343
|
-
svg.appendChild(groupDay);
|
344
|
-
|
345
|
-
const fragment = document.createDocumentFragment();
|
346
|
-
|
347
|
-
const count = 7 * 53;
|
348
|
-
for (let i = 0; i < count; i++) {
|
349
|
-
const rc = createDayItem(i);
|
350
|
-
if (rc) {
|
351
|
-
fragment.appendChild(rc);
|
352
|
-
}
|
353
|
-
}
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
groupDay.appendChild(fragment);
|
358
|
-
|
359
|
-
const tilteE = document.createElementNS(namespaceURI, "text");
|
360
|
-
tilteE.setAttribute("y", `${dayStartY + (dayGap + dayH) * 7 + 10 } `);
|
361
|
-
tilteE.setAttribute("x", `${mapW - 10}` );
|
362
|
-
|
363
|
-
tilteE.setAttribute("fill", '#999999');
|
364
|
-
tilteE.setAttribute("font-size", "15");
|
365
|
-
// tilteE.setAttribute("font-weight", "medium");
|
366
|
-
tilteE.setAttribute("font-family", "monospace");
|
367
|
-
tilteE.setAttribute('text-anchor','end')
|
368
|
-
tilteE.setAttribute('dominant-baseline','middle')
|
369
|
-
svg.appendChild(tilteE)
|
370
|
-
|
371
|
-
|
372
|
-
const beginYmd = idx2Ymd(MinYmdIdx)
|
373
|
-
if (beginYmd.substring(0,4) == endYmd.substring(0,4)) {
|
374
|
-
tilteE.textContent = beginYmd.substring(0,4)
|
375
|
-
}else{
|
376
|
-
tilteE.textContent = ` ~ ${endYmd}`
|
377
|
-
}
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
const tipG = document.createElementNS(namespaceURI, "g");
|
384
|
-
tipG.id = tipId;
|
385
|
-
svg.appendChild(tipG);
|
386
|
-
|
387
|
-
var tipState = {
|
388
|
-
showFlag: 0,
|
389
|
-
idx: -1,
|
390
|
-
};
|
391
|
-
function showTip(dayNode, dayidx, items) {
|
392
|
-
if (dayidx < 0 ) {
|
393
|
-
tipState.showFlag = 0;
|
394
|
-
setTimeout(() => {
|
395
|
-
if (tipState.showFlag == 0) {
|
396
|
-
tipG.style.display = 'none'
|
397
|
-
}
|
398
|
-
}, 50);
|
399
|
-
|
400
|
-
return;
|
401
|
-
}
|
402
|
-
|
403
|
-
if (tipState.showFlag == 2) {
|
404
|
-
return;
|
405
|
-
}
|
406
|
-
|
407
|
-
tipState.showFlag = 1;
|
408
|
-
tipState.idx = dayidx;
|
409
|
-
tipG.innerHTML = ''
|
410
|
-
tipG.style.display = 'block'
|
411
|
-
|
412
|
-
const isEmpy = items ? 0 : 1
|
413
|
-
if(!items){
|
414
|
-
items = [{date:dayNode.dataset.ymd}]
|
415
|
-
}
|
416
|
-
|
417
|
-
tipG.setAttribute("class", "svg-hm-day-tip");
|
418
|
-
var width = "200";
|
419
|
-
const count = items.length
|
420
|
-
const vSpace = 10;
|
421
|
-
const lineH = 25;
|
422
|
-
const height = vSpace * 2 + lineH * count + "";
|
423
|
-
|
424
|
-
|
425
|
-
const frag = document.createDocumentFragment();
|
426
|
-
let rcbg = document.createElementNS(namespaceURI, "rect");
|
427
|
-
rcbg.setAttribute("fill", "#333333cc");
|
428
|
-
|
429
|
-
rcbg.setAttribute("height", height);
|
430
|
-
rcbg.setAttribute("rx", "5");
|
431
|
-
rcbg.setAttribute("ry", "5");
|
432
|
-
frag.append(rcbg);
|
433
|
-
|
434
|
-
tipG.onmouseenter = function () {
|
435
|
-
if(isEmpy)return
|
436
|
-
tipState.showFlag = 2;
|
437
|
-
};
|
438
|
-
|
439
|
-
tipG.onmouseleave = function () {
|
440
|
-
tipState.showFlag = 0;
|
441
|
-
tipG.style.display = 'none'
|
442
|
-
};
|
443
|
-
let txtLen = 0
|
444
|
-
items.forEach((e, i) => {
|
445
|
-
let m = e.date.substring(5,7)
|
446
|
-
let d = e.date.substring(8,10)
|
447
|
-
m = m.startsWith('0') ? m.substring(1):m
|
448
|
-
d = d.startsWith('0') ? d.substring(1):d
|
449
|
-
const txt = `${m}-${d} ${e.title || ""}`;
|
450
|
-
if(txt.length > txtLen){
|
451
|
-
txtLen = txt.length
|
452
|
-
}
|
453
|
-
const txtE = document.createElementNS(namespaceURI, "text");
|
454
|
-
txtE.textContent = txt;
|
455
|
-
txtE.setAttribute("fill", "#fff");
|
456
|
-
txtE.setAttribute("font-size", "16");
|
457
|
-
txtE.setAttribute("font-family", "monospace");
|
458
|
-
txtE.setAttribute("x", "10");
|
459
|
-
if (e.url) {
|
460
|
-
const xlinkNS = "http://www.w3.org/1999/xlink";
|
461
|
-
const a = document.createElementNS(namespaceURI, "a");
|
462
|
-
a.setAttributeNS(xlinkNS, "xlink:href", e.url);
|
463
|
-
a.setAttribute("target", "_blank");
|
464
|
-
txtE.setAttribute("y", "" + (vSpace + i * lineH + 18));
|
465
|
-
|
466
|
-
a.appendChild(txtE);
|
467
|
-
frag.appendChild(a);
|
468
|
-
} else {
|
469
|
-
txtE.setAttribute("y", "" + (vSpace + i * lineH + 15));
|
470
|
-
frag.appendChild(txtE);
|
471
|
-
}
|
472
|
-
});
|
473
|
-
|
474
|
-
width = txtLen * 14.55 + 25
|
475
|
-
|
476
|
-
rcbg.setAttribute("width", width);
|
477
|
-
tipG.appendChild(frag);
|
478
|
-
|
479
|
-
const row = dayidx % 7;
|
480
|
-
const column = (dayidx - row) / 7;
|
481
|
-
const x = dayStartX + column * (dayGap + dayW) + dayW / 2 - width / 2;
|
482
|
-
const y = dayStartY + row * (dayGap + dayH) - height - dayGap;
|
483
|
-
|
484
|
-
tipG.setAttribute("transform", `translate(${x}, ${y})`);
|
485
|
-
}
|
486
|
-
|
487
|
-
return {svg,updateDays}
|
488
|
-
}
|
489
|
-
|
1
|
+
function createSVGMap(t,e,n,r,i){const s=n.split(" "),o=r.split(" "),l=i||0;t?4==t.length&&(t=`${t}-12-31`):t=`${(new Date).getFullYear()}-12-31`
|
2
|
+
;let u=new Date(v(new Date(t))),a=e?new Date(v(new Date(e))):e
|
3
|
+
;const d="http://www.w3.org/2000/svg",c=30,b=12,f="MP-"+Math.random().toString(16).substring(2),h=f+"days",m=f+"tip",A=u.getDay(),g=u.getTime(),p=364+(7+A-l)%7;var w=function(t){const e=new Date(t)
|
4
|
+
;let n=e.getFullYear()-1,r=e.getMonth()+1,i=e.getDate();return`${n}-${r<10?"0"+r:r}-${i<10?"0"+i:i}`}(g)
|
5
|
+
;const y=p-Math.floor((g-new Date(w))/864e5)+1,x=p-Math.floor((g-new Date(v(new Date)))/864e5),k=a?p-Math.floor((g-a.getTime())/864e5):-1;function C(t){return v(new Date(g-36e5*(p-t)*24))}
|
6
|
+
function v(t){let e=t.getMonth()+1,n=t.getDate();return`${t.getFullYear()}-${e<10?"0"+e:e}-${n<10?"0"+n:n}`}function N(t){const e=document.createElementNS(d,"rect");e.setAttribute("width","12"),
|
7
|
+
e.setAttribute("height","12"),e.setAttribute("rx","1"),e.setAttribute("ry","1"),e.setAttribute("fill","#eef7f2");const n=Math.floor(t/7),r=t-7*n,i=12*n+2*n,o=r*b+2*r;e.setAttribute("x",""+i),
|
8
|
+
e.setAttribute("y",""+o),e.dataset.x=i,e.dataset.y=o;let l=C(t);e.dataset.ymd=l,e.id="day-item-"+l;let u=l.substring(5,7);if(l.substring(8,10)<="07"&&t%7==0){
|
9
|
+
let e=s[Number(u)-1],n=document.createElementNS(d,"text");n.setAttribute("y","22"),n.setAttribute("x",i),n.textContent=e,n.setAttribute("fill",t>x?"#878787":"#113"),n.setAttribute("font-size","13"),
|
10
|
+
n.setAttribute("font-family","monospace"),E.appendChild(n)}return e}const S=document.createElementNS(d,"svg");S.id=f,S.setAttribute("width","787"),S.setAttribute("height","148"),
|
11
|
+
S.style.overflow="visible";let D=document.createElementNS(d,"defs")
|
12
|
+
;D.innerHTML='\n <pattern id="fillA" patternUnits="userSpaceOnUse" width="3" height="3">\n <path d="M 0 0 L 6 6" stroke="#ccc" stroke-width="1"/>\n </pattern>\n\n <pattern id="fillB" patternUnits="userSpaceOnUse" width="6" height="6">\n <path d="M 0 6 L 6 0" stroke="#bbb" stroke-width="1"/>\n </pattern>\n ',
|
13
|
+
S.appendChild(D);const E=document.createElementNS(d,"g");E.setAttribute("transform","translate(35, 0)"),S.appendChild(E);const M=document.createElementNS(d,"g");function $(t,e){
|
14
|
+
let n=document.createElementNS(d,"text");n.textContent=t,n.setAttribute("font-family","monospace"),n.setAttribute("font-size","13"),n.setAttribute("fill","#333"),n.setAttribute("width","45"),
|
15
|
+
n.setAttribute("height","12"),n.setAttribute("x","5");const r=14*e+10;return n.setAttribute("y",""+r),M.appendChild(n),n}M.setAttribute("transform","translate(0, 30)"),S.appendChild(M),
|
16
|
+
$(o[(l+1)%7],1),$(o[(l+3)%7],3),$(o[(l+5)%7],5);const F=document.createElementNS(d,"g");F.id=h,F.setAttribute("transform","translate(35, 30)"),S.appendChild(F)
|
17
|
+
;const z=document.createDocumentFragment();for(let t=0;t<371;t++){const e=N(t);e&&z.appendChild(e)}F.appendChild(z);const T=document.createElementNS(d,"text");T.setAttribute("y","138 "),
|
18
|
+
T.setAttribute("x","777"),T.setAttribute("fill","#999999"),T.setAttribute("font-size","15"),T.setAttribute("font-family","monospace"),T.setAttribute("text-anchor","end"),
|
19
|
+
T.setAttribute("dominant-baseline","middle"),S.appendChild(T);const L=C(y);L.substring(0,4)==t.substring(0,4)?T.textContent=L.substring(0,4):T.textContent=` ~ ${t}`
|
20
|
+
;const U=document.createElementNS(d,"g");U.id=m,S.appendChild(U);var Y={showFlag:0,idx:-1};function B(t,e,n){if(e<0)return Y.showFlag=0,void setTimeout((()=>{0==Y.showFlag&&(U.style.display="none")
|
21
|
+
}),50);if(2==Y.showFlag)return;Y.showFlag=1,Y.idx=e,U.innerHTML="",U.style.display="block";const r=n?0:1;n||(n=[{date:t.dataset.ymd}]),U.setAttribute("class","svg-hm-day-tip");var i
|
22
|
+
;const s=n.length,o=20+25*s+"",l=document.createDocumentFragment();let u=document.createElementNS(d,"rect");u.setAttribute("fill","#333333cc"),u.setAttribute("height",o),u.setAttribute("rx","5"),
|
23
|
+
u.setAttribute("ry","5"),l.append(u),U.onmouseenter=function(){r||(Y.showFlag=2)},U.onmouseleave=function(){Y.showFlag=0,U.style.display="none"};let a=0;n.forEach(((t,e)=>{
|
24
|
+
let n=t.date.substring(5,7),r=t.date.substring(8,10);n=n.startsWith("0")?n.substring(1):n,r=r.startsWith("0")?r.substring(1):r;const i=`${n}-${r} ${t.title||""}`;i.length>a&&(a=i.length)
|
25
|
+
;const s=document.createElementNS(d,"text");if(s.textContent=i,s.setAttribute("fill","#fff"),s.setAttribute("font-size","16"),s.setAttribute("font-family","monospace"),s.setAttribute("x","10"),t.url){
|
26
|
+
const n="http://www.w3.org/1999/xlink",r=document.createElementNS(d,"a");r.setAttributeNS(n,"xlink:href",t.url),r.setAttribute("target","_blank"),s.setAttribute("y",""+(10+25*e+18)),r.appendChild(s),
|
27
|
+
l.appendChild(r)}else s.setAttribute("y",""+(10+25*e+15)),l.appendChild(s)})),i=14.55*a+25,u.setAttribute("width",i),U.appendChild(l);const b=e%7,f=35+14*((e-b)/7)+6-i/2,h=c+14*b-o-2
|
28
|
+
;U.setAttribute("transform",`translate(${f}, ${h})`)}return{svg:S,updateDays:function(t){const e=t.color||"#40c463",n=document.createElementNS(d,"tspan");n.setAttribute("font-size","12"),
|
29
|
+
n.setAttribute("dy","0"),n.setAttribute("dx","10"),n.setAttribute("fill","#888888"),n.setAttribute("font-family","courier"),n.textContent="",T.append(n);let r=0,i=F.childNodes,s=new Array(371)
|
30
|
+
;for(let t=0;t<371;t++)s[t]=t;function o(s){let o=i[s];if(o){if(s<y||s>p)return void o.setAttribute("display","none");let i=o.dataset.ymd.substring(5,7),l=Number(i)%2,u=function(e,n){
|
31
|
+
let r=n.substring(0,4),i=n.substring(5,7),s=t[r];if(s&&s[i]){let t=s[i].filter((t=>t.date==n));return t&&t.length?t:null}return null}(0,o.dataset.ymd);if(u&&u.length&&(r+=u.length,
|
32
|
+
n.textContent=`x ${r}`),!u&&(s>x||s<k))return o.setAttribute("fill",l?"url(#fillB)":"url(#fillA)"),o.onmouseenter=function(){o.setAttribute("stroke","#000000"),o.setAttribute("stroke-width","1"),
|
33
|
+
B(o,s,u)},o.onclick=o.onmouseenter,void(o.onmouseleave=function(){o.setAttribute("stroke",""),o.setAttribute("stroke-width",""),B(o,-1)});const a=u&&u.length;let d=e;if(a){let t=u.find((t=>t.color))
|
34
|
+
;t&&(d=t.color),o.setAttribute("class","svg-day-1"),o.setAttribute("fill",1==a?d+"77":2==a?d+"aa":d+"ff"),o.onmouseenter=function(){o.setAttribute("stroke","#000000"),
|
35
|
+
o.setAttribute("stroke-width","1"),B(o,s,u)},o.onclick=o.onmouseenter,o.onmouseleave=function(){o.setAttribute("stroke",""),o.setAttribute("stroke-width",""),B(o,-1)}}else{o.onmouseenter=function(){
|
36
|
+
o.setAttribute("stroke","#000000"),o.setAttribute("stroke-width","1"),B(o,s,u)},o.onclick=o.onmouseenter,o.onmouseleave=function(){o.setAttribute("stroke",""),o.setAttribute("stroke-width",""),B(o,-1)
|
37
|
+
};let t=o.dataset.ymd;if(t){let e=t.substring(5,7),n=Number(e)%2;o.setAttribute("fill",n?"#edebf0":"#edebf0aa")}else o.setAttribute("fill","#efefef")}}}!function(t){let e=t.length;for(;0!=e;){
|
38
|
+
let n=Math.floor(Math.random()*e);e--,[t[e],t[n]]=[t[n],t[e]]}}(s);var l=0;!function t(){if(l<s.length){const n=19;for(var e=0;e++<n;){if(l>=s.length)return;o(s[l++])}requestAnimationFrame(t)}}()}}}
|