git ssb

0+

Rômulo Alves / dat-letnice



Commit 3e066192afe0e2526a7c7fb27edc12975fff2216

future past

nomand committed on 6/6/2018, 11:41:33 AM
Parent: 1f6537ee5b47f8d5332b0334c11845264d6264d9

Files changed

js/letnice.jschanged
js/letnice.jsView
@@ -4,9 +4,9 @@
44 base.innerHTML = "";
55 let year;
66
77 isNaN(letnice) || letnice==null ? year = new Date().getFullYear() : year = String(letnice).replace("#", "").substr(0,4);
8- location.hash = year;
8+ window.location.hash = year;
99
1010 const monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
1111 const dayNames = [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ]
1212
@@ -28,15 +28,18 @@
2828 }
2929
3030 function doHeader()
3131 {
32- return `<div class="header"><p class="y">${year}<a onclick="scrollYear(-1);">-</a><a onclick="scrollYear(1);">+</a></p><p class="p">${yearProgress(year) + "%"}</p></div>`;
32+ return `<div class="header"><p class="y">${year}<a onclick="scrollYear(-1);">-</a><a onclick="scrollYear(1);">+</a></p><p class="p">${yearProgress(year)}</p></div>`;
3333 }
3434
3535 function yearProgress(year)
3636 {
37- progress = new Date() - new Date(year, 0, 1, 0);
38- return ((progress/31536000000)*100).toFixed(2);
37+ diff = new Date() - new Date(year, 0, 1, 0);
38+ progress = ((diff/31536000000)*100).toFixed(2);
39+ yd = Math.abs((progress / 100).toFixed(2));
40+
41+ return progress < 0 ? yd + ` YEARS AWAY` : progress > 100 ? yd + ` YEARS AGO` : progress+"%";
3942 }
4043
4144 function doLabels()
4245 {

Built with git-ssb-web