_includes/heatmap.js in jekyll-zeta-0.9.2.2 vs _includes/heatmap.js in jekyll-zeta-0.9.3
- old
+ new
@@ -1,7 +1,10 @@
;!(function () {
+
+ const WeeKStart = parseInt(WeeKStartStr)
+
var GDATA = window._G_DATA;
if (!GDATA) {
GDATA = {}
window._G_DATA = GDATA
}
@@ -20,13 +23,14 @@
const dayEleId = Math.random().toString(16).substring(2);
let arr = _allyearurl.split("/");
arr.pop();
const jsonUrlBase = arr.join("/");
+ const nLastColumnCount = (dateEnd.getDay() - WeeKStart + 7) % 7 + 1
const ColumnsCount = 53;
const RowCount = 7;
- const DayCount = (ColumnsCount - 1) * RowCount + dateEnd.getDay() + 1;
+ const DayCount = (ColumnsCount - 1) * RowCount + nLastColumnCount;
let queue = window._y_queue || []
window._y_queue = queue;
@@ -299,11 +303,11 @@
monthEle.className = "heatmap-month";
Frag.appendChild(monthEle);
const monthStr = _MonthStr.split(" ");
let nowM = dateEnd.getMonth();
- let nowWeek = dateEnd.getDay();
+ let nowWeekIdx = nLastColumnCount - 1;
for (let i = 0; i < monthStr.length; i++) {
let m = document.createElement("span");
m.className = "heatmap-month-cell";
m.innerHTML = `${monthStr[(i + nowM + 1) % 12]}`;
@@ -313,29 +317,28 @@
const weekEle = document.createElement("div");
weekEle.className = "heatmap-week";
const WeekStr = _showWeek.split(" ");
for (let i = 0; i < WeekStr.length; i++) {
+ const idx = (i + WeeKStart) % 7
let m = document.createElement("div");
m.className = "heatmap-week-cell";
- m.innerHTML = `<span>${WeekStr[i]}</span>`;
+ m.innerHTML = i % 2 ? `<span>${WeekStr[idx]}</span>` : ''
weekEle.appendChild(m);
}
Frag.appendChild(weekEle);
const dayEle = document.createElement("div");
dayEle.className = "heatmap-day";
dayEle.id = dayEleId;
- let firstDateDayDiff = (ColumnsCount - 1) * RowCount + nowWeek;
+ // console.log(nowWeekIdx, firstDateDayDiff);
- // console.log(nowWeek, firstDateDayDiff);
-
for (let c = 0; c < ColumnsCount; c++) {
for (let r = 0; r < RowCount; r++) {
- if (r > nowWeek && c == ColumnsCount - 1) {
+ if (r > nowWeekIdx && c == ColumnsCount - 1) {
break;
}
let m = document.createElement("span");
m.classList = `heatmap-day-cell hm-check-nodata`;