Add Moon phase display to Minari calendar
@ -67,3 +67,7 @@ td {
|
|||||||
.today {
|
.today {
|
||||||
background-color: red;
|
background-color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.date-popover {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
BIN
minari/images/0.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
minari/images/1.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
minari/images/10.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
minari/images/11.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
minari/images/12.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
minari/images/13.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
minari/images/14.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
minari/images/15.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
minari/images/16.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
minari/images/17.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
minari/images/18.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
minari/images/19.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
minari/images/2.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
minari/images/20.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
minari/images/21.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
minari/images/22.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
minari/images/23.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
minari/images/24.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
minari/images/25.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
minari/images/26.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
minari/images/27.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
minari/images/3.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
minari/images/4.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
minari/images/5.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
minari/images/6.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
minari/images/7.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
minari/images/8.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
minari/images/9.png
Normal file
After Width: | Height: | Size: 16 KiB |
@ -12,6 +12,9 @@
|
|||||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
|
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
|
||||||
<script type="text/javascript" src="js/minari.js"></script>
|
<script type="text/javascript" src="js/minari.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var year;
|
||||||
|
var inputActive = false;
|
||||||
|
|
||||||
var today = new Date();
|
var today = new Date();
|
||||||
today.setDate(today.getDate() + 11);
|
today.setDate(today.getDate() + 11);
|
||||||
var year, thisYear;
|
var year, thisYear;
|
||||||
@ -20,11 +23,7 @@
|
|||||||
var base_title = document.title;
|
var base_title = document.title;
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
setYear(year);
|
setYear();
|
||||||
|
|
||||||
var inputActive = false;
|
|
||||||
|
|
||||||
$('#year').click(yearClick);
|
|
||||||
|
|
||||||
$(document).click(function() {
|
$(document).click(function() {
|
||||||
if (inputActive) {
|
if (inputActive) {
|
||||||
@ -110,6 +109,8 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
$('#year').click(yearClick);
|
||||||
|
|
||||||
$('div.month').each(function() {
|
$('div.month').each(function() {
|
||||||
genMonthTable(this);
|
genMonthTable(this);
|
||||||
});
|
});
|
||||||
|
@ -22,6 +22,12 @@ var monthNames = new Array(
|
|||||||
'Rodom'
|
'Rodom'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var newMoonBaseDate = new Date(2005, 4, 8, 3, 48);
|
||||||
|
|
||||||
|
Date.prototype.getJulian = function() {
|
||||||
|
return Math.floor((this / 86400000) - (this.getTimezoneOffset()/1440) + 2440587.5);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add the getDOY() method to Date; it returns the day of year.
|
* Add the getDOY() method to Date; it returns the day of year.
|
||||||
*/
|
*/
|
||||||
@ -148,6 +154,13 @@ Date.prototype.getMinariDate = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setYear(newYear) {
|
function setYear(newYear) {
|
||||||
|
// If newYear is not set, go to current year
|
||||||
|
if (newYear == undefined) {
|
||||||
|
var today = new Date();
|
||||||
|
today.setDate(today.getDate() + 11);
|
||||||
|
newYear = Number(today.getFullYear() - 1873);
|
||||||
|
}
|
||||||
|
|
||||||
year = newYear;
|
year = newYear;
|
||||||
|
|
||||||
document.title = year + ' – ' + base_title;
|
document.title = year + ' – ' + base_title;
|
||||||
@ -381,7 +394,13 @@ function getDayTooltip(month, day) {
|
|||||||
|
|
||||||
dayOneDate.setDate(dayOneDate.getDate() + dayNum - 1);
|
dayOneDate.setDate(dayOneDate.getDate() + dayNum - 1);
|
||||||
|
|
||||||
return dayOneDate.toLocaleDateString('hu-HU') + ((leapMorkh) ? '<br>(Két napos ünnep)' : '');
|
toolTip = $('<div>').addClass('date-popover').html(dayOneDate.toLocaleDateString('hu-HU') + ((leapMorkh) ? '<br>(Két napos ünnep)' : ''));
|
||||||
|
|
||||||
|
moonPhasePic = getMoonPhase(dayOneDate);
|
||||||
|
img = $('<img>').attr('src', 'images/' + moonPhasePic + '.png');
|
||||||
|
toolTip.append($('<br>')).append(img);
|
||||||
|
|
||||||
|
return toolTip;
|
||||||
}
|
}
|
||||||
|
|
||||||
function yearClick(e) {
|
function yearClick(e) {
|
||||||
@ -412,3 +431,20 @@ function yearClick(e) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMoonPhase(date) {
|
||||||
|
synodic = 29.53058867;
|
||||||
|
phasePercent = ((date.getJulian() - newMoonBaseDate.getJulian()) % synodic) / synodic;
|
||||||
|
|
||||||
|
if (phasePercent < 0) {
|
||||||
|
phasePercent += 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
phase = Math.floor(28 * phasePercent);
|
||||||
|
|
||||||
|
if (phase == 28) {
|
||||||
|
phase = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return phase;
|
||||||
|
}
|
||||||
|