diff --git a/minari/css/minari.css b/minari/css/minari.css new file mode 100644 index 0000000..1d6de5e --- /dev/null +++ b/minari/css/minari.css @@ -0,0 +1,69 @@ +.year { + font-weight: bold; + text-align: center; + font-size: 200%; + cursor: pointer; +} + +.holiday { + text-align: center; + font-size: 150%; + font-weight: bold; + margin: .5em 0; +} + +table.month { + float: left; + border: 2px solid black; + margin-right: 1em; + margin-bottom: 1em; + border-collapse: collapse; + position: relative; +} + +.clear { + float: none; + clear: both; +} + +.month-row { + margin-left: auto; + margin-right: auto; + position: relative; +} + +td { + text-align: center; + padding: .1em; + white-space: nowrap; + border: 1px solid black; +} + +.monthname td { + font-weight: bold; + border: 1px solid black; +} + +.daynames { + border-bottom: 2px solid black; +} + +.daynames td { + font-weight: bold; + border: 1px solid black; + width: 16.66%; +} + +.prevYear { + float: left; + cursor: pointer; +} + +.nextYear { + float: right; + cursor: pointer; +} + +.today { + background-color: red; +} diff --git a/minari/fonts/glyphicons-halflings-regular.eot b/minari/fonts/glyphicons-halflings-regular.eot new file mode 100644 index 0000000..b93a495 Binary files /dev/null and b/minari/fonts/glyphicons-halflings-regular.eot differ diff --git a/minari/fonts/glyphicons-halflings-regular.svg b/minari/fonts/glyphicons-halflings-regular.svg new file mode 100644 index 0000000..94fb549 --- /dev/null +++ b/minari/fonts/glyphicons-halflings-regular.svg @@ -0,0 +1,288 @@ + + + \ No newline at end of file diff --git a/minari/fonts/glyphicons-halflings-regular.ttf b/minari/fonts/glyphicons-halflings-regular.ttf new file mode 100644 index 0000000..1413fc6 Binary files /dev/null and b/minari/fonts/glyphicons-halflings-regular.ttf differ diff --git a/minari/fonts/glyphicons-halflings-regular.woff b/minari/fonts/glyphicons-halflings-regular.woff new file mode 100644 index 0000000..9e61285 Binary files /dev/null and b/minari/fonts/glyphicons-halflings-regular.woff differ diff --git a/minari/fonts/glyphicons-halflings-regular.woff2 b/minari/fonts/glyphicons-halflings-regular.woff2 new file mode 100644 index 0000000..64539b5 Binary files /dev/null and b/minari/fonts/glyphicons-halflings-regular.woff2 differ diff --git a/minari/index.html b/minari/index.html new file mode 100644 index 0000000..6747992 --- /dev/null +++ b/minari/index.html @@ -0,0 +1,118 @@ + + +
+') + .html(month_name))); + + daylist = $(' | |||||
').html(dayNames[i])); + } + + month_header.append(daylist); + month_table.append(month_header); + + month_body = $(' | |||||
')
+ .attr('id', 'day-' + month_num + '-' + real_day)
+ .attr('data-month', month_num)
+ .attr('data-day', real_day)
+ .addClass('day')
+ .html(real_day));
+ }
+
+ month_body.append(row);
+ }
+
+ month_table.append(month_body);
+ $(div).html(month_table);
+}
+
+function getPopoverContent() {
+ list = $(this).attr('id').split('-');
+ return getDayTooltip(Number(list[1]), Number(list[2]));
+}
+
+function getDayTooltip(month, day) {
+ // set dayOneDate to the first day of the correct Gregorian year)
+ var dayOneDate = new Date(year + 1873, 0, 1);
+ // …now substract 11 days to get the Gregorian date of the current Minari
+ // year’s first day. dayOneDate now points to the current Minari year’s
+ // first day (Hëdur)
+ dayOneDate.setDate(dayOneDate.getDate() - 11);
+
+ // Now let’s check if this Gregorian year is a leap year. We use the same
+ // leap year rules as the Gregorian calendar
+ var leapYear = (new Date(year + 1873, 1, 29).getDate() == 29);
+
+ // Temporary set leapMorkh to false. We will set it to true later, if needed
+ var leapMorkh = false;
+
+ // The day of year we are pointing at
+ var dayNum = 0;
+
+ if (month == 0) {
+ switch (day) {
+ case 1:
+ dayNum = 1;
+
+ break;
+
+ case 2:
+ dayNum = 92;
+
+ break;
+
+ case 3:
+ dayNum = 183;
+
+ if (leapYear) {
+ leapMorkh = true;
+ }
+
+ break;
+
+ case 4:
+ dayNum = (leapYear) ? 275 : 274;
+
+ break;
+
+ case 5:
+ dayNum = (leapYear) ? 366 : 365;
+
+ break;
+ }
+ } else {
+ // Initial value of dayNum. We will increase it soon, depending of the
+ // holidays past this year
+ dayNum = (month - 1) * 30 + day;
+
+ switch (month) {
+ case 1:
+ case 2:
+ case 3:
+ // We have only Hëdur passed, let’s add 1
+ dayNum += 1;
+
+ break;
+ case 4:
+ case 5:
+ case 6:
+ // We have Hëdur and Rideyy passed, let’s add 2
+ dayNum += 2;
+
+ break;
+ case 7:
+ case 8:
+ case 9:
+ // We have Hëdur, Rideyy and Morkh passed, let’s add 3. If this
+ // is a leap year, Morkh is two days long, so let’s add 4
+ // instead.
+ dayNum += (leapYear) ? 4 : 3;
+
+ break;
+ case 10:
+ case 11:
+ case 12:
+ // We have Hëdur, Rideyy, Morkh and Khmerd passed, let’s add 4.
+ // If this is a leap year, Morkh is two days long, so let’s add
+ // 5 instead.
+ dayNum += (leapYear) ? 5 : 4;
+
+ break;
+ }
+ }
+
+ dayOneDate.setDate(dayOneDate.getDate() + dayNum - 1);
+
+ return dayOneDate.toLocaleDateString('hu-HU') + ((leapMorkh) ? ' (Két napos ünnep)' : ''); +} + +function yearClick(e) { + e.stopPropagation(); + inputActive = true; + $('.year').html(''); + $('#yearBox').focus(); + $('#yearBox').click(function(e) { + e.stopPropagation(); + }); + + $('#yearBox').keydown(function(e) { + if (e.which == 13) { + e.preventDefault(); + + if (!isNaN($('#yearBox').val())) { + newYear = Number($('#yearBox').val()) + $('.year').html('...'); + setYear(newYear); + $('#year').click(yearClick); + } + } + + if (e.which == 27) { + inputActive = false; + $('.year').html('' + year + ''); + $('#year').click(yearClick); + } + }); +} |