PDA

View Full Version : Forum Home Enhancements - Clock In Navbar


EnIgMa1234
02-12-2007, 10:00 PM
Dont Copy This Hack
Javascript Code By w3schools.com (http://www.w3schools.com)

Description: This Shows The Time, In Hours Minutes And Seconds, In The Navbar When The Page Is Loaded

1 New Phrase
1 Template Edit

Install:

Find In Navbar:

<if condition="$show['pmwarning']"><br /><strong><phrase 1="$vbphrase[pmpercent_nav_compiled]">$vbphrase[your_pm_box_is_x_full]</phrase></strong></if>
</div>


Add Below:


<head>
<script type="text/javascript">
function startTime()
{
var today=new Date()
var h=today.getHours()
var m=today.getMinutes()
var s=today.getSeconds()
// add a zero in front of numbers<10
m=checkTime(m)
s=checkTime(s)
document.getElementById('txt').innerHTML=h+":"+m+":"+s
t=setTimeout('startTime()',500)
}

function checkTime(i)
{
if (i<10)
{i="0" + i}
return i
}
</script>
</head>
<b>
<body onload="startTime()">
<div id="txt"><b>$vbphrase[loading_clock]</b></div>
</body></b>

Then: Import The Product

History
- V.1.0 Released

Future Developments
- Cache Template


I Will Only Give Support To Those That Click Install

Sofia
02-13-2007, 03:55 PM
Thanks a lot, Enigma.

EnIgMa1234
02-13-2007, 03:57 PM
your welcome. thanks for installing

Renada
02-13-2007, 04:49 PM
Thank you :)

TTG
02-13-2007, 06:51 PM
Nice and simple .. reminds me of my ex :)

Clicked install

EnIgMa1234
02-13-2007, 06:53 PM
haha thanks for installing :)

DannyMilner
02-13-2007, 06:56 PM
Nice and simple .. reminds me of my ex :)

lmao, :p

Nice one!

Snake
02-14-2007, 05:34 AM
Thanks!

roger.kore
02-14-2007, 08:52 AM
Thanks. as suggestion: Since when there is a lot of space, what about add the current date?
dd/mm/yy -> User should choose the format.
14/02/07 your clock GMT user

EnIgMa1234
02-14-2007, 10:37 AM
Yes I Will Add That In The Next Version

MTVSlick
02-14-2007, 11:02 PM
does this clock show 12 hr or 24 hour time?

Mark,

roger.kore
02-15-2007, 12:51 AM
24 hours

kal-L
02-17-2007, 04:24 AM
Love the clock, but that 24hrs kills me at 3am :D Hard to do -12 that late.
Thank you:up:

zhabbo
02-17-2007, 09:26 AM
Excellent, Thankyou so much! Also very kind for giving me support! =)

NaughtyStud
02-18-2007, 04:41 PM
Nice hack,thanks and clicked install. ;)

lovelypk
02-20-2007, 12:58 AM
12 hour clock will be better also date should be added in next version.

EnIgMa1234
02-20-2007, 03:36 PM
yes it will be

EnIgMa1234
02-20-2007, 03:50 PM
yes it will be

ged
02-28-2007, 03:02 PM
It doesn't work for me...

Subah
03-01-2007, 07:48 PM
Thanks...

United32
03-06-2007, 01:02 PM
Hi,

Do you know where I can find a clock liks this:

http://www.bihforum.com/

It looks awesome!

rjmjr69
04-03-2007, 08:42 PM
Thats a macro flash file.

kollam003
06-02-2007, 08:46 AM
i'm using with indian standard time where can i change that its showing now in GMT ? help plz

EnIgMa1234
06-02-2007, 09:55 AM
i'm using with indian standard time where can i change that its showing now in GMT ? help plz
it shows the time on your computer. look on the bottom right side of your moniter, it matchs the time

athlon64bit
06-05-2007, 07:01 AM
Great wee Hack. I like it. Thanks for this hack/add-on. It rocks!! :)

athlon64bit
06-05-2007, 08:24 AM
The clock gets stuck on loading time when viewing threads but works fine when viewing forum home or forum boards. Why does this happen? I am using 3.6.7 vb.
What could the problem be?

iBaker
06-12-2007, 09:28 PM
Great clock but unfortunately I won't be able to download it as I need a clock that will show UTC time and not the PC time - my web server is UTC time so if there was some way I could hook into that or some other way I could mod yours to show UTC then I would be over the moon - thanks!

msalman
06-13-2007, 12:00 PM
thanks for the hack!! i've slightly modify it to add more stuff e.g. am/pm and full date, here's the modified version of it

Java script

<head>
<script type="text/javascript">
function startTime()
{
var today = new Date()
var h = today.getHours()
var m = today.getMinutes()
var s = today.getSeconds()
var day = today.getDay()
var date = today.getDate()
var month = today.getMonth()
var year = today.getFullYear()
var days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var months = new Array(" January"," February"," March"," April"," May"," June"," July"," August"," September"," October"," November"," December")
var am_pm

if (h > 12) {
h -= 12
am_pm = "P.M."
}
else {
am_pm ="A.M."
}

// add a zero in front of numbers<10
m = checkTime(m)
s = checkTime(s)
h = checkTime(h)
document.getElementById('txt').innerHTML = days[day] + " " + date + months[month] + " " + year + ", " + h + ":" + m + ":" + s + " " + am_pm
t = setTimeout('startTime()', 500)
}

function checkTime(i)
{
if (i < 10)
{i = "0" + i}
return i
}
</script>
</head>
<b>
<body onload="startTime()">
<div id="txt"><b>$vbphrase[loading_clock]</b></div>
</body></b>

Alibass
06-13-2007, 02:46 PM
*Installed*

Works good on 3.6.7PL1, but when viewing thread the clock constantly shows Loading Clock.....

Alibass
06-13-2007, 05:19 PM
thanks for the hack!! i've slightly modify it to add more stuff e.g. am/pm and full date, here's the modified version of it


I have tried your modified version and it looks great. Did notice from 12pm to 1pm the clock showed AM and switch to PM when the clock rolled to 1pm. Any suggestions?

msalman
06-14-2007, 11:42 AM
I have tried your modified version and it looks great. Did notice from 12pm to 1pm the clock showed AM and switch to PM when the clock rolled to 1pm. Any suggestions?
there's small silly mistake, you just need to make a small change

Replace the following line
if (h > 12)
with
if (h >= 12)

Works good on 3.6.7PL1, but when viewing thread the clock constantly shows Loading Clock.....
Here's the fixed version of it

replace what you have before with this
<b><div id="txt"><b>$vbphrase[loading_clock]</b></div></b>

<script type="text/javascript">
function startTime()
{
var today = new Date()
var h = today.getHours()
var m = today.getMinutes()
var s = today.getSeconds()
var day = today.getDay()
var date = today.getDate()
var month = today.getMonth()
var year = today.getFullYear()
var days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var months = new Array(" January"," February"," March"," April"," May"," June"," July"," August"," September"," October"," November"," December")
var am_pm

if (h >= 12) {
h -= 12
am_pm = "P.M."
}
else {
am_pm ="A.M."
}

// add a zero in front of numbers<10
m = checkTime(m)
s = checkTime(s)
h = checkTime(h)
document.getElementById('txt').innerHTML = days[day] + " " + date + months[month] + " " + year + ", " + h + ":" + m + ":" + s + " " + am_pm
setTimeout("startTime()", 1000)
}

function checkTime(i)
{
if (i < 10)
{i = "0" + i}
return i
}
startTime()
</script>

Alibass
06-14-2007, 01:11 PM
@msalman

Thanks m8 for the new code. This seemed to have fixed the Clock Loading..... error also while viewing a thread. :)

Alibass
07-02-2007, 05:14 PM
@msalman

Actually your code is for a 24 hour clock and works best that way. If you try and use it as a 12 hour clock then midnight is shown as 00:00:00 AM instead on 12:00:00 AM and noon is shown 00:00:00 PM instead of 12:00:00 PM

Find
if (h >= 12) {
h -= 12
am_pm = "P.M."
}
else {
am_pm = "A.M."
}Replace (for 24 hour clock)
if (h >= 12) {
h <= 12
am_pm = ""
}
else {
am_pm = ""
}

sadsack
12-10-2007, 12:50 AM
@msalman

Actually your code is for a 24 hour clock and works best that way. If you try and use it as a 12 hour clock then midnight is shown as 00:00:00 AM instead on 12:00:00 AM and noon is shown 00:00:00 PM instead of 12:00:00 PM

Find
if (h >= 12) {
h -= 12
am_pm = "P.M."
}
else {
am_pm = "A.M."
}Replace (for 24 hour clock)
if (h >= 12) {
h <= 12
am_pm = ""
}
else {
am_pm = ""
}


Excellent, did the trick first time, thanks.