add one year row input

This commit is contained in:
ivan 2022-07-09 11:04:41 +03:00
parent fc21899896
commit 561fd8e6dc
1 changed files with 35 additions and 5 deletions

View File

@ -186,7 +186,7 @@
<input type="button" onclick="document.getElementById('soltable').innerHTML = makeTable(10, 'UTC+10');" value="UTC+10"/> <input type="button" onclick="document.getElementById('soltable').innerHTML = makeTable(10, 'UTC+10');" value="UTC+10"/>
<input type="button" onclick="document.getElementById('soltable').innerHTML = makeTable(11, 'UTC+11');" value="UTC+11"/></p> <input type="button" onclick="document.getElementById('soltable').innerHTML = makeTable(11, 'UTC+11');" value="UTC+11"/></p>
<div align = "center" id="soltable"></div> <div align = "center" id="soltable"></div><br><div align = "center" id="oneyearrow"></div>
<script type="text/javascript"> <script type="text/javascript">
@ -199,10 +199,32 @@ function formatedDate(datein, timeoutput, UTC) {
return dateout; return dateout;
} }
function tableRow(cy, timeoutput, UTC) { function oneyearChange(value) {
if (timeout == "erisian") outyear = value - 1166;
else outyear = value;
document.getElementById("oneyearrow").innerHTML = makeOneYearRow();
}
function makeOneYearRow() {
var fullrow = "<table><tr>";
fullrow += tableRow(outyear, timeout, utcoff, true);
fullrow += "</tr></table>";
return fullrow;
}
function tableRow(cy, timeoutput, UTC, oneyearinp = false) {
var stringout = "<td>"; var stringout = "<td>";
if (timeoutput == 'erisian') stringout += dtime(ve[cy], 'yold'); if (oneyearinp) {
else stringout += cy; if (timeoutput == 'erisian') {
cury = cy + 1166; miny = 1583 + 1166; maxy = 2999 + 1583;
} else {
cury = cy; miny = 1583; maxy = 2999;
}
stringout += '<input type="number" name="oneyearinput" value="' + cury + '" min="' + miny + '" max="' + maxy + '" step="1" size="5" onchange="oneyearChange(this.value)">';
} else {
if (timeoutput == 'erisian') stringout += cy + 1166;
else stringout += cy;
}
var Imbolc = new Date(ss[cy-1].getTime() + ((ve[cy].getTime() - ss[cy-1].getTime()) / 2)); var Imbolc = new Date(ss[cy-1].getTime() + ((ve[cy].getTime() - ss[cy-1].getTime()) / 2));
stringout += '<td class = "even">' + formatedDate(Imbolc, timeoutput, UTC) + "</td>"; stringout += '<td class = "even">' + formatedDate(Imbolc, timeoutput, UTC) + "</td>";
stringout += '<td>' + formatedDate(ve[cy], timeoutput, UTC) + "</td>"; stringout += '<td>' + formatedDate(ve[cy], timeoutput, UTC) + "</td>";
@ -220,6 +242,7 @@ function tableRow(cy, timeoutput, UTC) {
function makeTable(UTC, timeoutput) { function makeTable(UTC, timeoutput) {
utcoff = UTC; timeout = timeoutput;
var fulltable = "<table><caption>"; var fulltable = "<table><caption>";
now = new Date(); now = new Date();
fulltable += 'Accurate (according to <a href="https://www.imcce.fr">IMCCE</a>) astronomical <a href="https://en.wikipedia.org/wiki/Wheel_of_the_Year">Wheel of the Year</a> - '; fulltable += 'Accurate (according to <a href="https://www.imcce.fr">IMCCE</a>) astronomical <a href="https://en.wikipedia.org/wiki/Wheel_of_the_Year">Wheel of the Year</a> - ';
@ -247,13 +270,20 @@ function makeTable(UTC, timeoutput) {
} }
fulltable += "</table>"; fulltable += "</table>";
document.getElementById("oneyearrow").innerHTML = makeOneYearRow();
return fulltable; return fulltable;
} }
// var currentdate = new Date(); // var currentdate = new Date();
// var utcoffmin = -(currentdate.getTimezoneOffset()/60); // var utcoffmin = -(currentdate.getTimezoneOffset()/60);
var defaultTable = makeTable(0, "erisian"); var utcoff = 0;
var timeout = "erisian";
var outyear = ((new Date()).getFullYear() - 100);
var defaultTable = makeTable(utcoff, timeout);
document.getElementById("soltable").innerHTML = defaultTable; document.getElementById("soltable").innerHTML = defaultTable;
</script> </script>