UBB.Dev
Posted By: Lisa_P Menubar clock - 02/25/2003 9:12 PM
Mod Name / Version - Menubar Clock 1.0

Description - This modification shows the user's local time in the menu bar.

Working Under - UBB.Threads 6.2

Pre-requisites - none

Author - Lisa_P

Credits - dman for requesting

Files Altered - ubbt.inc.php, ubbt_registered.tmpl, ubbt_unregistered.tmpl

Database Altered - none

New Files - none

NOTE: Prints out a user's local date and time in the menu bar, prints out the server's local time for unregistered.

I personally don't care for the way it looks; I'd probably mess with it more to get it to look a little nicer if I wasn't supposed to be getting ready for school.

Attached File
70846-menubar_clock.txt  (50 downloads)
Posted By: JoshPet Re: Menubar clock - 02/25/2003 9:16 PM
Thank you Lisa!
Posted By: Lisa_P Re: Menubar clock - 02/25/2003 9:25 PM
Here's a pic

Attached picture 70854-menubar_clock.gif
Posted By: AllenAyres Re: Menubar clock - 02/26/2003 12:03 AM
heheh, nice
Posted By: AKD96 Re: Menubar clock - 02/26/2003 12:38 AM
Installed and working great. Thanks! Although, in the registered.tmpl I added the time after the "Mark All Read" option instead of after the $members_link.
Posted By: Lisa_P Re: Menubar clock - 02/26/2003 6:43 AM
For those who want a clock that updates itself, and shows the user's own computer time, but is in javascript and not php, try this:

In ubbt_registerednav.tmpl and ubbt_unregisterednav.tmpl, find this:

Code
<br />$members_link<br /> |<br /><a href = "$phpurl/markallread.php?Cat=$Cat" $target>{$ubbt_lang['MARKALL']}</a><br /></td><br /></tr><br />$tbclose<br />



and change it to this:

Code
<br />$members_link<br /> |<br /><a href = "$phpurl/markallread.php?Cat=$Cat" $target>{$ubbt_lang['MARKALL']}</a><br /><div id="Clock" class="menubar">&nbsp</div><br /><script><br />function tick() {<br />  var hours, minutes, seconds, ap;<br />  var intHours, intMinutes, intSeconds;<br />  var today;<br />  today = new Date();<br />  intHours = today.getHours();<br />  intMinutes = today.getMinutes();<br />  intSeconds = today.getSeconds();<br />  if (intHours == 0) {<br />     hours = "12:";<br />     ap = "A.M.";<br />  } else if (intHours < 12) { <br />     hours = intHours+":";<br />     ap = "A.M.";<br />  } else if (intHours == 12) {<br />     hours = "12:";<br />     ap = "P.M.";<br />  } else {<br />     intHours = intHours - 12<br />     hours = intHours + ":";<br />     ap = "P.M.";<br />  }<br />  if (intMinutes < 10) {<br />     minutes = "0"+intMinutes+":";<br />  } else {<br />     minutes = intMinutes+":";<br />  }<br />  if (intSeconds < 10) {<br />     seconds = "0"+intSeconds+" ";<br />  } else {<br />     seconds = intSeconds+" ";<br />  } <br />  timeString = hours+minutes+seconds+ap;<br />  Clock.innerHTML = timeString;<br />  window.setTimeout("tick();", 100);<br />}<br />window.onload = tick;<br /></script><br /></td><br /></tr><br />$tbclose<br />


that's it
Posted By: Ian_W Re: Menubar clock - 02/27/2003 2:33 PM
Nice one - thanks.
Posted By: dman_dup1 Re: Menubar clock - 03/02/2003 10:56 PM
Ok Lisa, it really works great. I have one question though. Do you know why it would work perfect on every screen except the Main Index screen? You can tell there's something supposed to be there but it's not, but it looks great everywhere else.
© UBB.Developers