To: first one who gets this script to work on a webpage
Code: Select all
<script>
/*
TREESIAN DATE SCRIPT
by Sander Dieleman
*/
// Init date
DateObj = new Date;
Day=DateObj.getDate();
Year=DateObj.getYear();
Month=DateObj.getMonth()+1;
var TreMonth, TreYear;
// Days Passed In the Current Year
DaysPassedCurrentYear = Day;
if (Month>11)
{DaysPassedCurrentYear = DaysPassedCurrentYear + 30;}
if (Month>10)
{DaysPassedCurrentYear = DaysPassedCurrentYear + 31;}
if (Month>9)
{DaysPassedCurrentYear = DaysPassedCurrentYear + 30;}
if (Month>8)
{DaysPassedCurrentYear = DaysPassedCurrentYear + 31;}
if (Month>7)
{DaysPassedCurrentYear = DaysPassedCurrentYear + 31;}
if (Month>6)
{DaysPassedCurrentYear = DaysPassedCurrentYear + 30;}
if (Month>5)
{DaysPassedCurrentYear = DaysPassedCurrentYear + 31;}
if (Month>4)
{DaysPassedCurrentYear = DaysPassedCurrentYear + 30;}
if (Month>3)
{DaysPassedCurrentYear = DaysPassedCurrentYear + 31;}
if (Month>2)
{DaysPassedCurrentYear = DaysPassedCurrentYear + 28;}
if (Month>1)
{DaysPassedCurrentYear = DaysPassedCurrentYear + 31;}
// Calculating the Treesian Month and the days passed in that month
TreYear=(Year%100)-2
if (DaysPassedCurrentYear > 17)
{
if (DaysPassedCurrentYear > 47)
{
if (DaysPassedCurrentYear > 77)
{
if (DaysPassedCurrentYear > 107)
{
if (DaysPassedCurrentYear > 137)
{
if (DaysPassedCurrentYear > 167)
{
if (DaysPassedCurrentYear > 197)
{
if (DaysPassedCurrentYear > 227)
{
if (DaysPassedCurrentYear > 257)
{
if (DaysPassedCurrentYear > 287)
{
if (DaysPassedCurrentYear > 292)
{
TreYear=Year-2001;
if (DaysPassedCurrentYear > 322)
{
if (DaysPassedCurrentYear > 352)
{TreMonth = 3;
DaysPassedCurrentTreMonth = DaysPassedCurrentYear - 352;}
else
{TreMonth = 2;
DaysPassedCurrentTreMonth = DaysPassedCurrentYear - 322;}
}
else
{TreMonth = 1;
DaysPassedCurrentTreMonth = DaysPassedCurrentYear - 292;
}
}
else
{TreMonth = 13;
DaysPassedCurrentTreMonth = DaysPassedCurrentYear - 287;}
}
else
{TreMonth = 12;
DaysPassedCurrentTreMonth = DaysPassedCurrentYear - 257;}
}
else
{TreMonth = 11;
DaysPassedCurrentTreMonth = DaysPassedCurrentYear - 227;}
}
else
{TreMonth = 10;
DaysPassedCurrentTreMonth = DaysPassedCurrentYear - 197;}
}
else
{TreMonth = 9;
DaysPassedCurrentTreMonth = DaysPassedCurrentYear - 167;}
}
else
{TreMonth = 8;
DaysPassedCurrentTreMonth = DaysPassedCurrentYear - 137;}
}
else
{TreMonth = 7;
DaysPassedCurrentTreMonth = DaysPassedCurrentYear - 107;}
}
else
{TreMonth = 6;
DaysPassedCurrentTreMonth = DaysPassedCurrentYear - 77;}
}
else
{TreMonth = 5;
DaysPassedCurrentTreMonth = DaysPassedCurrentYear - 47;}
}
else
{TreMonth = 4;
DaysPassedCurrentTreMonth = DaysPassedCurrentYear - 17;}
}
else
{TreMonth = 3;
DaysPassedCurrentTreMonth = DaysPassedCurrentYear+13;}
// Outputting the date in the correct way of writing
TreMonthLong=new Array;
TreMonthLong[1]="Silnua";
TreMonthLong[2]="Cuspor";
TreMonthLong[3]="Gevracoon";
TreMonthLong[4]="Gevraderr";
TreMonthLong[5]="Filladin";
TreMonthLong[6]="Fasmas";
TreMonthLong[7]="Nomedsiocc";
TreMonthLong[8]="Laemil";
TreMonthLong[9]="Rocpinn";
TreMonthLong[10]="Uiscasla";
TreMonthLong[11]="Oscaltec";
TreMonthLong[12]="Mulantog";
TreMonthLong[13]="Chinnam";
// number ending stuff
DaysPassedCurrentTreMonthString = DaysPassedCurrentTreMonth.toString();
NumberLength = DaysPassedCurrentTreMonthString.length;
LastPartOfNumber = DaysPassedCurrentTreMonthString.charAt(NumberLength-1); //gettin the last part of the number
DaysPassedEnding="th";
if (LastPartOfNumber == 1)
{DaysPassedEnding="st";}
if (LastPartOfNumber == 2)
{DaysPassedEnding="nd";}
if (LastPartOfNumber == 3)
{DaysPassedEnding="rd";}
if (DaysPassedCurrentTreMonth == 11)
{DaysPassedEnding="th";}
if (DaysPassedCurrentTreMonth == 12)
{DaysPassedEnding="th";}
if (DaysPassedCurrentTreMonth == 13)
{DaysPassedEnding="th";}
// Special descriptions on Feastdays
var SpecialDesc="";
if (TreMonth==1)
{
if (DaysPassedCurrentTreMonth==14)
{SpecialDesc="Tadding P�l's Eve";}
if (DaysPassedCurrentTreMonth==15)
{SpecialDesc="Tadding P�l Day";}
if (DaysPassedCurrentTreMonth==16)
{SpecialDesc="Festival of the Three";}
if (DaysPassedCurrentTreMonth==17)
{SpecialDesc="Festival of the Three";}
if (DaysPassedCurrentTreMonth==18)
{SpecialDesc="Festival of the Three";}
if (DaysPassedCurrentTreMonth==12)
{SpecialDesc="Ulcharam";}
if (DaysPassedCurrentTreMonth==30)
{SpecialDesc="Amariaa";}
}
if (TreMonth==2)
{
if (DaysPassedCurrentTreMonth==19)
{SpecialDesc="Sun";}
if (DaysPassedCurrentTreMonth==23)
{SpecialDesc="Seicha";}
}
if (TreMonth==3)
{
if (DaysPassedCurrentTreMonth==6)
{SpecialDesc="Utas";}
if (DaysPassedCurrentTreMonth==11)
{SpecialDesc="Salio";}
if (DaysPassedCurrentTreMonth==28)
{SpecialDesc="Runda";}
if (DaysPassedCurrentTreMonth==29)
{SpecialDesc="Mordic";}
}
if (TreMonth==5)
{
if (DaysPassedCurrentTreMonth==14)
{SpecialDesc="Caranna";}
if (DaysPassedCurrentTreMonth==29)
{SpecialDesc="Aincoim";}
}
if (TreMonth==6)
{
if (DaysPassedCurrentTreMonth==1)
{SpecialDesc="Lest & Elwynn";}
if (DaysPassedCurrentTreMonth==12)
{SpecialDesc="Uisceor";}
if (DaysPassedCurrentTreMonth==30)
{SpecialDesc="Paragon";}
}
if (TreMonth==7)
{
if (DaysPassedCurrentTreMonth==1)
{SpecialDesc="Dobharcufile";}
if (DaysPassedCurrentTreMonth==17)
{SpecialDesc="Ardescit";}
if (DaysPassedCurrentTreMonth==25)
{SpecialDesc="Folcador";}
if (DaysPassedCurrentTreMonth==26)
{SpecialDesc="Lochrinn";}
}
if (TreMonth==8)
{
if (DaysPassedCurrentTreMonth==22)
{SpecialDesc="Dlithail";}
}
if (TreMonth==9)
{
if (DaysPassedCurrentTreMonth==6)
{SpecialDesc="Laguna";}
if (DaysPassedCurrentTreMonth==17)
{SpecialDesc="Crandoigh";}
}
if (TreMonth==10)
{
if (DaysPassedCurrentTreMonth==16)
{SpecialDesc="Tineon";}
if (DaysPassedCurrentTreMonth==24)
{SpecialDesc="Maladaticc";}
}
if (TreMonth==11)
{
if (DaysPassedCurrentTreMonth==5)
{SpecialDesc="Mandorallen";}
if (DaysPassedCurrentTreMonth==22)
{SpecialDesc="Yetal";}
if (DaysPassedCurrentTreMonth==24)
{SpecialDesc="Bladhm";}
if (DaysPassedCurrentTreMonth==27)
{SpecialDesc="Ilass";}
}
if (TreMonth==12)
{
if (DaysPassedCurrentTreMonth==5)
{SpecialDesc="Leaigh";}
if (DaysPassedCurrentTreMonth==9)
{SpecialDesc="Rianna";}
if (DaysPassedCurrentTreMonth==16)
{SpecialDesc="Aeon";}
if (DaysPassedCurrentTreMonth==24)
{SpecialDesc="Carding";}
}
if (TreMonth==13)
{
if (DaysPassedCurrentTreMonth==1)
{SpecialDesc="Mourn for nations past";}
if
(DaysPassedCurrentTreMonth==2)
{SpecialDesc="Hope that past friends fare well in the future";}
if
(DaysPassedCurrentTreMonth==3)
{SpecialDesc="Celebrate that which is dear and gone";}
if
(DaysPassedCurrentTreMonth==4)
{SpecialDesc="Remember that destruction is a part of life";}
if
(DaysPassedCurrentTreMonth==5)
{SpecialDesc="Make provision for the future, learn from past mistakes";}
}
if (SpecialDesc!="")
{SpecialDesc = " - "+SpecialDesc}
//ok here it goes...
DateString=DaysPassedCurrentTreMonth+DaysPassedEnding+" "+TreMonthLong[TreMonth]+", "+TreYear+"DA"+SpecialDesc;
document.write(" <b>"+DateString+"</b> ");
</script>