[Request] Stardate on forum [Solved]

Mods etc.

Moderator: Integra Moderator

[Request] Stardate on forum [Solved]

PostAuthor: krillmeed » Fri Aug 18, 2006 9:34 am

I apologise if this is in the wrong forum :xo:
Last edited by krillmeed on Tue Aug 22, 2006 10:29 am, edited 1 time in total.

krillmeed
Sr Integra Member
Sr Integra Member
 
Posts: 301
Likes: 0 post
Liked in: 0 post
Joined: Sat May 27, 2006 12:34 am
Cash on hand: 0.00

PostAuthor: krillmeed » Fri Aug 18, 2006 10:10 am

Point of note here, I do have a JScript Script File that does this, and i have permission from the author to use it, but i upload it to the template, then as i did on my main website that is html of course, i put this in the overall header: <script></script>
<SCRIPT>TodayAsStarDate();</SCRIPT> and nothing. What am i doing wrong?
Last edited by krillmeed on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

krillmeed
Sr Integra Member
Sr Integra Member
 
Posts: 301
Likes: 0 post
Liked in: 0 post
Joined: Sat May 27, 2006 12:34 am
Cash on hand: 0.00

Re: [Request] Stardate on forum

PostAuthor: found it » Sun Aug 20, 2006 2:19 am

Hi

Where is the file Stardate.js located in your site...?

As this may not have the path correctly set up to it....with out more info it is kinda hard to see otherwise...

:mrgreen:
Last edited by found it on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
[url=http]themes.[/url]
http://www.founditforum.com :: [url=http]Joining people together[/url]

[url=http][img=left]http://www.bbful.com/bbful_banner2.png[/img][/url]
User avatar
found it
Dev Team
Dev Team
 
Posts: 792
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 3:29 am
Cash on hand: 0.00

PostAuthor: krillmeed » Sun Aug 20, 2006 3:08 am

I place the js file in the template folder, and tried to enter the code in the overall header
Last edited by krillmeed on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

krillmeed
Sr Integra Member
Sr Integra Member
 
Posts: 301
Likes: 0 post
Liked in: 0 post
Joined: Sat May 27, 2006 12:34 am
Cash on hand: 0.00

Re: [Request] Stardate on forum

PostAuthor: krillmeed » Sun Aug 20, 2006 3:12 am

This is what the js script looks like:
Code: Select all
 // This code was developed by Keith Scott for Adge Cutler - [url=http]http://www.lcars.org.uk//[/url] Feel free to use this code, however no warranty is provided as to the accuracy// of the coding.// If you choose to use this, please include a link back to [url=http://www.lcars.org.uk]http://www.lcars.org.uk[/url] on your site.// Thank you.   Keith Scott  07/09/2004  var DaysIntoYear = 0;var DaysInYear = 0;var Year = 0;var Month = 0;var Day = 0;var Hour = 0;var Minute = 0;var StarDate = "";var MonthDays = new Array();var Data = "";  MonthDays[1] = 31;MonthDays[2] = 28;MonthDays[3] = 31;MonthDays[4] = 30;MonthDays[5] = 31;MonthDays[6] = 30;MonthDays[7] = 31;MonthDays[8] = 31;MonthDays[9] = 30;MonthDays[10] = 31;MonthDays[11] = 30;MonthDays[12] = 31;  function Calculate() {     if ( Data == "" ) Data = document.getElementById('Data');     DaysIntoYear = 0;     Year = 0;     Month = 0;     Day = 0;     Hour = 0;     Minute = 0;     StarDate = "";     var StarDatePattern = /^-?d{4,7}.d{0,4}$/     var DatePattern = /dd/dd/dddd$/     var DateTimePattern = /dd/dd/ddddsddSdd$/     var DateValue = Data.value.substr(0,10);     var TimeValue = Data.value.substr(11,5);     if ( Data.value.match(DateTimePattern) ) {         Check_Date(DateValue);         Check_Time(TimeValue);         if ( StarDate != "Invalid!" ) CalculateStarDate();         return;     }         if ( Data.value.match(DatePattern) ) {         Check_Date(DateValue);         if ( StarDate != "Invalid!" ) CalculateStarDate();         return;     }       if ( Data.value.match(StarDatePattern) ) {         CalculateRealDate(Data.value);         return;     }       alert("Invalid date format!");}  function Check_Date(DateText){       var err = 0;     var leap = 0;     Year = DateText.substr(6,4);     Month = DateText.substr(3,2);     Day = DateText.substr(0,2);     if (Year == 0) {         err = 20;     }     if ((Month <1> 12)) {         err = 21;     }     if ((Day <1> 32)) {         err = 22;     }     if ((Year % 4 == 0) || (Year % 100 == 0) || (Year % 400 == 0)) {         leap = 1;         MonthDays[2] = 29;     }     else {         leap = 0;         MonthDays[2] = 28;     }     if ((Month == 2) && (leap == 1) && (Day > 29)) {         err = 23;     }     if ((Month == 2) && (leap != 1) && (Day > 28)) {         err = 24;     }     if ((Day > 30) && ((Month == "04") || (Month == "06") || (Month == "09") || (Month == "11"))) {         err = 26;     }     if (err == 0) {         for ( i=1;i<Month> 23 || Minute > 59 ) DateType = "";}  function CalculateStarDate() {       var FirstPart = "";     var MinutesPart = 0;     var HoursPart = 0;     var DaysPart = 0;     var InterimDate = "";     FirstPart = Year - 2323;     MinutesPart = Minute / 60;     HoursPart = ( ( Hour * 1 )+MinutesPart  ) / 24;     DaysPart = ( parseInt(DaysIntoYear) + HoursPart ) / DaysInYear;     DaysPart = DaysPart * 1000;     InterimDate = FirstPart+""+DaysPart;     StarDate = parseInt(InterimDate*10000)/10000;     document.getElementById('Result').innerHTML = "Stardate: " + StarDate;}  function CalculateRealDate(DateText) {       var DatePart = "";     var MinutesPart = 0;     var HoursPart = 0;     var DaysPart = 0;     var MonthCount = 0;     DatePart = DateText.substring(DateText.indexOf(".")-3,DateText.length+1);     YearPart = DateText.substr(0,DateText.indexOf(".")-3);     Year = 2323 + parseInt(YearPart);     if ((Year % 4 == 0) || (Year % 100 == 0) || (Year % 400 == 0)) {         MonthDays[2] = 29;         DaysInYear = 366;     }     else {         MonthDays[2] = 28;         DaysInYear = 365;     }     DatePart = DatePart/1000;     DaysIntoYear = parseInt(DatePart*DaysInYear);     Hours = parseInt(((DatePart*DaysInYear)-DaysIntoYear)*24);     Minutes = parseInt(((((DatePart*DaysInYear)-DaysIntoYear)*24)-Hours)*60);     for (i=1;i<13;i++) {         if ( DaysIntoYear < MonthDays[i] ) {             i = 13;         }         else {             DaysIntoYear = ( DaysIntoYear - MonthDays[i]);             MonthCount++;         }     }     DaysIntoYear++;     MonthCount++;     Day = "0"+DaysIntoYear;     Day = Day.substr(Day.length-2,2);     Month = "0"+MonthCount;     Month = Month.substr(Month.length-2,2);     Hour = "0"+Hours;     Hour = Hour.substr(Hour.length-2,2);     Minute = "0"+Minutes;     Minute = Minute.substr(Minute.length-2,2);     DateText = Day+"/"+Month+"/"+Year+" "+Hour+":"+Minute;     document.getElementById('Result').innerHTML = "Calendar date: " + DateText;}  function TodayAsStarDate() {       var weekDayName = new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")     var curDate = new Date();     Day = "0"+curDate.getDate();     Day = Day.substr(Day.length-2,2);     Month = "0"+(curDate.getMonth()+1);     Month = Month.substr(Month.length-2,2);     Year = curDate.getYear();     if (Year < 2000) Year += 1900; //for Netscape     Hour = "0"+curDate.getHours();     Hour = Hour.substr(Hour.length-2,2);     Minute = "0"+curDate.getMinutes();     Minute = Minute.substr(Minute.length-2,2);     var Weekday = weekDayName[curDate.getDay()];     Today = Day+"/"+Month+"/"+Year+" "+Hour+":"+Minute;     Check_Date(Today);     var FirstPart = "";     var MinutesPart = 0;     var HoursPart = 0;     var DaysPart = 0;     var InterimDate = "";     FirstPart = Year - 2323;     MinutesPart = Minute / 60;     HoursPart = ( parseInt(Hour)+MinutesPart  ) / 24;     DaysPart = ( parseInt(DaysIntoYear) + HoursPart ) / DaysInYear;     DaysPart = DaysPart * 1000;     InterimDate = FirstPart+""+DaysPart;     StarDate = parseInt(InterimDate*10000)/10000;     document.write("<font>Today is <I>" + Weekday + " " + Day+"/"+Month+"/"+Year+"</I> Time <I>"+Hour+":"+Minute + "</I><BR>Stardate: <I>" + StarDate + "</I></FONT>");}    
Last edited by krillmeed on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

krillmeed
Sr Integra Member
Sr Integra Member
 
Posts: 301
Likes: 0 post
Liked in: 0 post
Joined: Sat May 27, 2006 12:34 am
Cash on hand: 0.00

Re: [Request] Stardate on forum

PostAuthor: found it » Sun Aug 20, 2006 3:53 am

hi

If you have placed the js file in your template folder you need to edit the code in your overall_header.tpl file so it follows the correct path...

change

Code: Select all
<script></script><SCRIPT>TodayAsStarDate();</SCRIPT>


to

Code: Select all
<script></script><SCRIPT>TodayAsStarDate();</SCRIPT>


let me know...

:mrgreen:
Last edited by found it on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
[url=http]themes.[/url]
http://www.founditforum.com :: [url=http]Joining people together[/url]

[url=http][img=left]http://www.bbful.com/bbful_banner2.png[/img][/url]
User avatar
found it
Dev Team
Dev Team
 
Posts: 792
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 3:29 am
Cash on hand: 0.00

PostAuthor: krillmeed » Sun Aug 20, 2006 4:00 am

Thanks i will give it ago, my forum is down at the moment because the yahoo database server is down. It has been over 24 hours since i emailed them last, they are useless. I will let you know how this works. Thanks for your help <img>
Last edited by krillmeed on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

krillmeed
Sr Integra Member
Sr Integra Member
 
Posts: 301
Likes: 0 post
Liked in: 0 post
Joined: Sat May 27, 2006 12:34 am
Cash on hand: 0.00

PostAuthor: krillmeed » Tue Aug 22, 2006 10:29 am

Sir you are a star, works like a dream, i have added it into the index body of each template, apart from the stardate, we also have GMT time which comes in handy for our weekly chat sessions, now no one has to convert. By the way if anyone want this little addon feel free to email me. Looks rather good <img>
Last edited by krillmeed on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

krillmeed
Sr Integra Member
Sr Integra Member
 
Posts: 301
Likes: 0 post
Liked in: 0 post
Joined: Sat May 27, 2006 12:34 am
Cash on hand: 0.00

Re: [Request] Stardate on forum [Solved]

PostAuthor: found it » Tue Aug 22, 2006 11:57 am

no problem happy to help...

:mrgreen:
Last edited by found it on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
[url=http]themes.[/url]
http://www.founditforum.com :: [url=http]Joining people together[/url]

[url=http][img=left]http://www.bbful.com/bbful_banner2.png[/img][/url]
User avatar
found it
Dev Team
Dev Team
 
Posts: 792
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 3:29 am
Cash on hand: 0.00


Return to IntegraMOD Modifications

Who is online

Registered users: Bing [Bot], Majestic-12 [Bot]