git ssb

0+

Rômulo Alves / dat-letnice



Commit f9f124743c6d2ed1345bc16c37379f5fe5e01f47

hash nav

nomand committed on 6/6/2018, 5:04:21 AM
Parent: 2b6dbab4cf1db85518e47f39c06ea9560e89c2ab

Files changed

css/style.csschanged
index.htmlchanged
js/letnice.jschanged
css/style.cssView
@@ -25,10 +25,12 @@
2525 .month { width:100px; margin: 10px; display: inline-block;}
2626 .header { margin-bottom: 40px; }
2727
2828 p { margin: 0px; }
29-.m { font-size: 21px; font-weight: bold; margin-bottom: 5px; text-align: left; }
30-.y { font-size: 40px; font-weight: bold; text-align: middle;}
29+.m { font-size: 20px; font-weight: bold; margin-bottom: 5px; text-align: left; }
30+.y { font-size: 40px; font-weight: bold; }
31+.y a { font-size: 20px; cursor: pointer; width: 24px; height: 24px; }
32+.y a:hover {color: #ffffff; background-color: #000000;}
3133 .p { font-size: 20px; text-align: left; color: #8b8b8b}
3234
3335 svg.graph { color:white; width: 100%; }
3436 svg.graph text {font-family: 'input_mono_regular'; stroke:none; fill:#8b8b8b; font-size:14px; text-anchor: middle; }
index.htmlView
@@ -10,8 +10,8 @@
1010 <body>
1111 <section id="center">
1212 </section>
1313 <script>
14- let letnice = new Year(window.location.hash);
14+ let letnice = new Year(location.hash);
1515 </script>
1616 </body>
1717 </html>
js/letnice.jsView
@@ -1,17 +1,21 @@
1-const monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
2-const dayNames = [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ]
3-
4-function Year(y)
1+function Year(letnice)
52 {
63 let base = document.getElementById("center");
4+ base.innerHTML = "";
5+ let year;
76
8- let year = String(y).replace("#", "");
7+ isNaN(letnice) ? year = new Date().getFullYear() : year = String(letnice).replace("#", "").substr(0,4);
98
9+ location.hash = year;
10+
11+ const monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
12+ const dayNames = [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ]
13+
1014 let month = 0;
11- let today = new Date(year, new Date().getMonth(), new Date().getDate()-1, 0);
15+ let today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()-1, 0);
1216 let style = "";
13-
17+
1418 while(month < 12)
1519 {
1620 base.innerHTML += `<div class="month">
1721 ${month==0?doHeader():""}
@@ -24,9 +28,9 @@
2428 }
2529
2630 function doHeader()
2731 {
28- 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>`;
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>`;
2933 }
3034
3135 function yearProgress(year)
3236 {
@@ -63,9 +67,9 @@
6367 while(week < 7 && date != monthLength)
6468 {
6569 y = week * 14 + 2;
6670 let day = new Date(year, month, date, 0);
67-
71+
6872 if(day.getDay() != week)
6973 {
7074 style = "null";
7175 date--
@@ -94,9 +98,9 @@
9498 return html;
9599 }
96100 }
97101
98-function changeHash(i)
102+function scrollYear(i)
99103 {
100104 location.hash = parseInt(location.hash.replace('#','')) + parseInt(i);
101105 }
102106

Built with git-ssb-web