Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons

Reply
 
Thread Tools
Clock In Navbar Details »»
Clock In Navbar
Version: 1.00, by EnIgMa1234 EnIgMa1234 is offline
Developer Last Online: May 2011 Show Printable Version Email this Page

Category: Forum Home Enhancements - Version: 3.6.4 Rating:
Released: 02-12-2007 Last Update: Never Installs: 62
Uses Plugins Template Edits
 
No support by the author.

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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #32  
Old 06-14-2007, 11:42 AM
msalman msalman is offline
 
Join Date: Jun 2007
Location: islamic-life.com
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Alibass View Post
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>
Reply With Quote
  #33  
Old 06-14-2007, 01:11 PM
Alibass's Avatar
Alibass Alibass is offline
 
Join Date: Mar 2007
Posts: 615
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@msalman

Thanks m8 for the new code. This seemed to have fixed the Clock Loading..... error also while viewing a thread.
Reply With Quote
  #34  
Old 07-02-2007, 05:14 PM
Alibass's Avatar
Alibass Alibass is offline
 
Join Date: Mar 2007
Posts: 615
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@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 = ""
}
Reply With Quote
  #35  
Old 12-10-2007, 12:50 AM
sadsack sadsack is offline
 
Join Date: Mar 2007
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Alibass View Post
@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.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:22 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04117 seconds
  • Memory Usage 2,250KB
  • Queries Executed 19 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (9)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (4)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete