_includes/heatmap.js in jekyll-zeta-0.7.5.1 vs _includes/heatmap.js in jekyll-zeta-0.9.0

- old
+ new

@@ -1,15 +1,17 @@ + + ;!function(){ function date2ymd(t){ let m = t.getMonth() + 1; let d = t.getDate() return `${t.getFullYear()}-${m< 10 ? '0' + m : m }-${d<10 ? '0'+d:d}` } +const dateEnd = endYear && endYear.length == 4 ? new Date(`${endYear}-12-31`) : new Date(); -const dateEnd = new Date(); const endStamp = dateEnd.getTime() const dayEleId = Math.random().toString(16).substring(2); let arr = _allyearurl.split('/'); arr.pop(); const jsonUrlBase = arr.join('/') @@ -139,27 +141,17 @@ function update1Day(){ if (G_idxOfDay < 0) { return } const idxOfDay = SEQ[G_idxOfDay --]; - let dateKeyYmd = idx2Ymd(idxOfDay ) - - let arrPostInOneDay = Map[dateKeyYmd]; - // debug - arrPostInOneDay = arrPostInOneDay - - const dayCell = dayCells[idxOfDay] const nobg = parseInt(dateKeyYmd.substring(5,7))%2 == 1? 'hm-check-no-b' : 'hm-check-no-a'; dayCell.classList = `heatmap-day-cell ${!arrPostInOneDay ? nobg :arrPostInOneDay.length > 1 ? 'hm-check2' : 'hm-check' }` - if ((arrPostInOneDay && arrPostInOneDay.length > 0 )) { - - let isDirectly = arrPostInOneDay.length == 1 let tip = document.createElement("div"); if (isDirectly) { let lnk = document.createElement('a'); @@ -195,10 +187,13 @@ } function updateMultiDays(){ let day = heatMapLoadCount; + if (!day || day <= 0) { + day = 8; + } while (day -- ) { update1Day(); } if (G_idxOfDay >= 0) { @@ -207,15 +202,11 @@ } requestAnimationFrame(updateMultiDays) return - - - - - + } function getYearData(year){ @@ -234,11 +225,11 @@ ;(function initMap(){ -let Father = document.getElementById("heatmap"); +let Father = document.getElementById(heatmapid); const Frag = document.createDocumentFragment(); const monthEle = document.createElement("div"); monthEle.className = "heatmap-month"; @@ -300,8 +291,6 @@ -}(); - - +}(); \ No newline at end of file