View Full Version : Forum Home Enhancements - Automatic updating clock in navbar.
UltimateOreo!
05-11-2007, 10:00 PM
I relalized that the little clock in the footer was a little small, and it didnt update without a refresh, and I don't think anyone really uses it. Although, for me, a clock is very useful, so why not get it noticed? Thats what this hack attempts to do. This hack is NOT based off server time, only time the browser sends.
I DO realize other hacks like this were made, but this one in my opinion is placed nicer, and is cleaner.
Demo is at www.bralphasquad.com/forums
Support is only in this thread for users who click install.
wolfe
10-06-2007, 12:22 AM
nice mod m8 edit it a bit to show seconds and correctly show the am / pm.
<br /><b>Time Now:</b>
<span id="digitalclock" class="styling"></span>
<script>
<!--
var alternate=0
var standardbrowser=!document.all&&!document.getElementById
if (standardbrowser)
document.write('<form name="tick"><input type="text" name="tock" size="6/form>')
function show(){
if (!standardbrowser)
var clockobj=document.getElementById? document.getElementById("digitalclock") : document.all.digitalclock
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var dn= "AM"
var seconds=Digital.getSeconds()
if (hours==12) dn="PM"
if (hours>12){
dn="PM"
hours=hours-12
}
if (hours==0) hours=12
if (hours.toString().length==1)
hours="0"+hours
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
if (standardbrowser){
if (alternate==0)
document.tick.tock.value=hours+":"+minutes+":"+seconds+" "+dn
else
document.tick.tock.value=hours+" "+minutes+" "+seconds+" "+dn
}
else{
if (alternate==0)
clockobj.innerHTML=hours+":"+minutes+":"+seconds+" "+dn
else
clockobj.innerHTML=hours+":"+minutes+":"+seconds+" "+dn
}
alternate=(alternate==0)? 0 : 0
setTimeout("show()",1000)
}
window.onload=show
//-->
</script>
yoyoyoyo
10-06-2007, 04:23 AM
demo is not working
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.