vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Forum Home Enhancements - Clock In Navbar (https://vborg.vbsupport.ru/showthread.php?t=139314)

EnIgMa1234 02-12-2007 10:00 PM

Clock In Navbar
 
Dont Copy This Hack
Javascript Code By 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:
Code:

<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:


Code:

<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

Quote:

Originally Posted by TTG (Post 1181742)
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 07:42 PM

Thats a macro flash file.

kollam003 06-02-2007 07: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 08:55 AM

Quote:

Originally Posted by kollam003 (Post 1259665)
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 06:01 AM

Great wee Hack. I like it. Thanks for this hack/add-on. It rocks!! :)

athlon64bit 06-05-2007 07: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 08: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 11:00 AM

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
Code:

<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 01:46 PM

*Installed*

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

Alibass 06-13-2007 04:19 PM

Quote:

Originally Posted by msalman (Post 1267599)
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 10:42 AM

Quote:

Originally Posted by Alibass (Post 1267793)
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
Code:

if (h > 12)
with
Code:

if (h >= 12)
Quote:

Originally Posted by Alibass;
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
Code:

<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 12: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 04: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
Code:

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

Replace (for 24 hour clock)
Code:

if (h >= 12) {
    h <= 12
    am_pm = ""
}
else {
    am_pm = ""
}


sadsack 12-10-2007 12:50 AM

Quote:

Originally Posted by Alibass (Post 1281393)
@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
Code:

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

Replace (for 24 hour clock)
Code:

if (h >= 12) {
    h <= 12
    am_pm = ""
}
else {
    am_pm = ""
}



Excellent, did the trick first time, thanks.


All times are GMT. The time now is 07:40 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01871 seconds
  • Memory Usage 1,788KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (10)bbcode_code_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (34)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete