git ssb

0+

Rômulo Alves / dat-letnice



Commit 4cb7497b9a595aeaa9018b4ebff615193e4fc77f

pagination test

nomand committed on 6/6/2018, 2:46:09 AM
Parent: 92b6ea22d3063d3c4ba129b9b83fb81efddf48d2

Files changed

index.htmlchanged
js/letnice.jschanged
index.htmlView
@@ -10,8 +10,8 @@
1010 <body>
1111 <section id="center">
1212 </section>
1313 <script>
14- var letnice = new Year();
14+ let letnice = new Year(new Date().getFullYear());
1515 </script>
1616 </body>
1717 </html>
js/letnice.jsView
@@ -1,12 +1,14 @@
1-function Year()
1+function Year(y)
22 {
33 let base = document.getElementById("center");
4-
4+
55 const monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
66 const dayNames = [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ]
77
8- let year = new Date().getFullYear();
8+ let year = y;//new Date().getFullYear();
9+ window.location.hash = year;
10+
911 let month = 0;
1012 let today = new Date(year, new Date().getMonth(), new Date().getDate()-1, 0);
1113 let style = "day";
1214
@@ -23,9 +25,9 @@
2325 }
2426
2527 function doHeader()
2628 {
27- return `<div class="header"><p class="y">${year}</p><p class="p">${yearProgress(year) + "%"}</p></div>`;
29+ return `<div class="header"><p class="y">${year}<a onclick="changeHash(1);">+</a><a onclick="changeHash(-1);">-</a></p><p class="p">${yearProgress(year) + "%"}</p></div>`;
2830 }
2931
3032 function yearProgress(year)
3133 {
@@ -91,5 +93,18 @@
9193 }
9294 }
9395 return html;
9496 }
97+}
98+
99+function changeHash(i)
100+{
101+ location.hash = parseInt(location.hash.replace('#','')) + parseInt(i);
102+}
103+
104+window.onhashchange = function()
105+{
106+ if (location.hash.length > 0)
107+ {
108+ Year(parseInt(location.hash.replace('#','')));
109+ }
95110 }

Built with git-ssb-web