Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=3641)
Live clock in header
This modification helps to show a dynamic clock in the header of your forum, instead of static clock which comes with SMF.
All mod settings are available under
Admin center -> Configuration -> Live Clock Admin
Mod comes with an admin panel which provides following features:
?action=admin;area=liveclock;
- General Features
1. Enable/Disable the mod
2. Choose whether you want to show the timezone drop down or not
3. Use 24/12 hr format clock
4. Show date with time
- Timezone features
1. You can edit the timezone configurations from the following link
action=admin;area=liveclock;sa=displaytimezones
Note - If any of the 2 coloumns is left blank, the mod neglects the value of other column, i.e if you have entered value for 'Timezone Name' only but 'Timezone Difference' hasn't been filled. In that case mod neglects both values.
If you made any error while editing default timezone you can reset all the timezones to default values(which comes with the mod), by clicking 'Reset all timezones' from
Admin center -> Configuration -> Live Clock Admin
Change Log
Version 1.3
- Loading scripts in specific order with specific jquery version
- overhauling of JS with revealing modular pattern
- XHTML fixes
- checks refined with usage of typeof, generic function to check null or undefined
- var scoping in JS
- params init only once
- code optimisation
- Obsolete comment removed
- Using anonymous function concept to invoke the clock class
Version 1.2
- Mod not parsed correctly. Fixed.
- Duplicate entries while populating DB on mod installation. Fixed.
Version 1.1.1
- Mod was unable to carry "Western Europe Time, London, Lisbon, Casablanca" as timezone. Fixed.
- Mod timezone bar unable to load due to jQuery conflict. Fixed.
- Github repo moved back to https://github.com/Joker-SMF/SMF-LiveClockInHeader
Version 1.1
- Option added to show timezone dropdown
- Show date with time
- Bug fixes, JS optimisations and improvements
- Github Repo moved to https://github.com/Joker-SMF/SMF-Mods
GitHub Link (https://github.com/Joker-SMF/SMF-LiveClockInHeader)
License
* This SMF Modification is subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this SMF modification except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
Great idea!!!
Finally, Great!
Thanks :).
Nice modification but does not work in all themes (themes are all suitable for SMF version 2.0.4),error messages during test setup (except for the default theme), see screenshot.
(http://i.imgur.com/zT0vQJx.png)
Try to install the mod manually by parsing (http://custom.simplemachines.org/mods/index.php?action=parse;mod=3641;attach=217790;smf_version=2.0.4) it.
Note - Make backup of files before editing them
When I activate this mod date is off.. Like that:
Before mod: 21.march.2013-18:55
After mod: 18:55 (live)
I want it to show with date. Thanks
Quote from: akbora on March 22, 2013, 02:57:28 PM
When I activate this mod date is off.. Like that:
Before mod: 21.march.2013-18:55
After mod: 18:55 (live)
I want it to show with date. Thanks
Ohh yeshh.... We canz do it in nextss versionss :D. Addedzz (https://github.com/Joker-SMF/SMF-LiveClockInHeader/issues/2).
Lol, a bit happy today :).
Joker I am getting an error.
246:
247: if (!empty($modSettings['lc_mod_enable'])) {
248: if(function_exists('LC_mainIndex')) {
249: LC_mainIndex();
250: }
251: echo '
==>252: <li id="live_clock">', $txt['LC_loading'],'</li>
253: <select id="live_clock_timezone_options" onChange="liveClock.onTimezoneChange(this.value)"></select>';
254: echo '
255: </ul>';
256: } else {
257: echo '
258: <li>', $context['current_time'], '</li>
Also is there a way I can have the font slightly larger?
Quote from: Old Fossil on April 10, 2013, 08:50:51 PM
Also is there a way I can have the font slightly larger?
Do you try to add a class/id to it?
like this:<li class="current_time">', $context['current_time'], '</li>
.current_time {
font-size: a size;
}
Thanks for the suggestion Mr Pedram but there was no change.
:(
Fossil, attach index template here :P.
Quote from: Joker™ on April 13, 2013, 03:27:31 AM
Fossil, attach index template here :P.
There ya go ya rascal.
The reason I can see for the error is that there is no <ul> tag for the block, as it happens to be in the default theme.
Try the attached file.
Sorted thanks bud.
Now hows about adding the date to it? ;)
Shows an hour slow for me but that I guess is the server.
Quote from: Old Fossil on April 14, 2013, 11:12:27 AM
Shows an hour slow for me but that I guess is the server.
Time on your site is showing correct for me. Did you forget to roll it forward an hour? (British summertime and all that) Profile > Look and layout. (but you already know that) lol..
Have disabled it temporarily still had an error.
Beggars can't be choosers lol.
By they way Lurky there's a post waiting for ya elsewhere.
:P O:)
Quote from: Old Fossil on April 14, 2013, 11:12:27 AM
Sorted thanks bud.
Now hows about adding the date to it? ;)
Shows an hour slow for me but that I guess is the server.
There can be only 2 reasons for it
- You computer/notebook/mobile/xyz device clock is incorrect
- You have enabled the timezone option in the mod, and as suggested your timezone in site is incorrect
Will give it another go Joker.
Er while ya here.
/me chains Joker to forum.
Is there a way of making the clock larger?
Or a move to below the unread replies?
Forum link :P
In me sig ya lazy lump,
:P
www.miltonkeynescommforum.info
/me looks for fatman I mean batman
Hey fatty, send me a test account too, so that i can look at hot clock in live action :P
247: if (!empty($modSettings['lc_mod_enable'])) {
248: if(function_exists('LC_mainIndex')) {
249: LC_mainIndex();
250: }
251: echo '
==>252: <li id="live_clock">', $txt['LC_loading'],'</li>
253: <select id="live_clock_timezone_options" onChange="liveClock.onTimezoneChange(this.value)"></select>';
254: echo '
255: </ul>';
256: } else {
257: echo '
258: <li>', $context['current_time'], '</li>
259: </ul>';
260: }
This is the section of code in the error.
Time is correct now though :)
QuoteHey fatty,
OI I wasn't calling you fat ya nana. :)
Will send ya a test account via pm.
Few issues:
1. Ok the clock is not running for me.
2. Clock is showing incorrect time for me.
3. I saw a JS error in console saying
QuoteGET tapatalkdetect.js
couldn't be loaded.
Also, try the attached file, the clock should be beneath the unread replies block.
Good mod, Joker.
Should be such clock by default in smf.
One question: how can I remove drop down menu with time zones on header? I think this is not such necessary for me, unless it's correcting from profiles.
Thnaks.
Quote from: GZ06 on May 18, 2013, 01:21:56 AM
Good mod, Joker.
Should be such clock by default in smf.
One question: how can I remove drop down menu with time zones on header? I think this is not such necessary for me, unless it's correcting from profiles.
Thnaks.
The dropdown was causiing errors in my forum.
I managed to solve it by using the original code in the Tips and tricks board.
Let me know if you want it and I'll post it here.
(Joker's scared of my fryingpan).
:D
Quote from: Old Fossil on May 18, 2013, 01:24:51 AM
Quote from: GZ06 on May 18, 2013, 01:21:56 AM
Good mod, Joker.
Should be such clock by default in smf.
One question: how can I remove drop down menu with time zones on header? I think this is not such necessary for me, unless it's correcting from profiles.
Thnaks.
The dropdown was causiing errors in my forum.
I managed to solve it by using the original code in the Tips and tricks board.
Let me know if you want it and I'll post it here.
(Joker's scared of my fryingpan).
:D
yes, sure. it's interesting.
open themes\default\index.template.php
Find:
echo '
<li>', $context['current_time'], '</li>
</ul>';
Replace with:
echo '
<li>',timeformat(time(),'%B, %d, %Y'), '
<li id="clock">Loading...</li>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
function refrClock()
{
var d=new Date();
var s=d.getSeconds();
var m=d.getMinutes();
var h=d.getHours();
var am_pm;
if (s<10) {s="0" + s}
if (m<10) {m="0" + m}
if (h>12) {h-=12;am_pm = "pm"}
else {am_pm="am"}
if (h<10) {h="0" + h}
document.getElementById("clock").innerHTML=h + ":" + m + ":" + s + am_pm;
setTimeout("refrClock()",1000);
}
refrClock();
// ]]></script>
</li></ul>';
Thanks.
code has been replaced but same drop down with time zones menu is presenting on page.
Have any idea how to remove such menu?
Thanks again.
Quote from: Old Fossil on May 18, 2013, 01:24:51 AM
Quote from: GZ06 on May 18, 2013, 01:21:56 AM
Good mod, Joker.
Should be such clock by default in smf.
One question: how can I remove drop down menu with time zones on header? I think this is not such necessary for me, unless it's correcting from profiles.
Thnaks.
The dropdown was causiing errors in my forum.
I managed to solve it by using the original code in the Tips and tricks board.
Let me know if you want it and I'll post it here.
(Joker's scared of my fryingpan).
:D
I'll be trying my best to figure out the issue with the dropdown and making it an admin choice dropdown.
Moreover can you guys point out the exact issue with the dropdown and suggestion about how we can make this mod more efficient ;).
would be good if we will have option in admin panel to remove drop down menu from page. Really excess, at least for me. To choose time zone in profile is enough. Overload the view of page with drop down causes some dissonance in design of appearance
Checkout the new version ;)
By this time I would like to set my language is normally the first day after month after year. But here the day after the first month of the year after the correction setting is there also that month, another language?
After using the system tray clock live
May 26, 2013, 21:37:05
before using
26 Mayıs, 2013 21:37:05
Can you fix it? thanks
In our country We use time format is Date/Month/years. Your format is Month/date/years. How can we change it? Thanks
I'll try to update the mod with a feature through which admins can change the date string as they like :).
Quote from: Joker™ on May 26, 2013, 05:59:29 AM
Checkout the new version ;)
OK, but looks small bug appear. If no "Drop down menu" clock
not works. Just as usual by default in smf. If "Drop down menu" presenting on page -clock also work.
======
Just updating info: after several turning On/Off "Show Timezone dropdown", it's started to work.
Well I can only fix those bugs, which I can replicate.
It'd be more helpful that if you guys come across certain bug, post a link to your forum and provide a test account :).
Quote from: Joker™ on May 29, 2013, 09:28:20 AM
It'd be more helpful that if you guys come across certain bug, post a link to your forum and provide a test account :).
This mod installed without any errors on two SMF 2.0.4 forums with different results:
. the first forum has only a few mods installed and the clock works perfectly. :)
. the second forum has lots of mods installed and the clock doesn't work at all (the time does not update and the drop-down list is empty). :(
Login details for test account on second forum:
Forum: http://australiancx.asn.au/forum5
Login: SMFTest
Password: 09-June-2013
TIA
Update #1: If I disable the timezone list drop-down the time starts updating. ???
Update #2: If I use the code from here (http://www.simplemachines.org/community/index.php?topic=398860.msg2771031#msg2771031) I get a clock that updates the time and a drop down list that isn't empty. :)
Just installed live clock, and its showing fine, works on all time zones i choose.
but it reverts back to "Brussels, Copenhagen, Madrid, Paris"
when ever i choose "Western Europe Time, London, Lisbon, Casablanca"
any ideas please,
Quote from: GL700Wing on June 08, 2013, 08:29:51 PM
Quote from: Joker™ on May 29, 2013, 09:28:20 AM
It'd be more helpful that if you guys come across certain bug, post a link to your forum and provide a test account :).
This mod installed without any errors on two SMF 2.0.4 forums with different results:
. the first forum has only a few mods installed and the clock works perfectly. :)
. the second forum has lots of mods installed and the clock doesn't work at all (the time does not update and the drop-down list is empty). :(
Login details for test account on second forum:
Forum: http://australiancx.asn.au/forum5
Login: SMFTest
Password: 09-June-2013
TIA
Update #1: If I disable the timezone list drop-down the time starts updating. ???
Update #2: If I use the code from here (http://www.simplemachines.org/community/index.php?topic=398860.msg2771031#msg2771031) I get a clock that updates the time and a drop down list that isn't empty. :)
QuoteForbidden
You don't have permission to access /forum5 on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Quote from: pickwizard on June 09, 2013, 07:22:24 AM
Just installed live clock, and its showing fine, works on all time zones i choose.
but it reverts back to "Brussels, Copenhagen, Madrid, Paris"
when ever i choose "Western Europe Time, London, Lisbon, Casablanca"
any ideas please,
I'd say an awesome catch. Got the issue and fixed it on github. I'll be releasing an new issue as soon as I can trim down the issue 'GL700Wing' is facing :).
Quote from: Joker™ on June 09, 2013, 10:27:51 AM
Forbidden
You don't have permission to access /forum5 on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Should be OK now (access problem caused by combination of using .htaccess to block IPs of known spammers/hackers and your IP address being in a blocked IP range in India).
As an aside I also get lots of
'8: Undefined index: lc_ajax_in_progress' messages in the error log but this message doesn't get generated every time I load the main page - probably only about half the time. The workaround for this is to either add the text string for 'lc_ajax_in_progress' to the relevant 'index' language file (eg, index.english.php) or to load the 'LiveClock' language file in index.template.php (I've gone for the second option).
Well this problem is getting curiouser and curiouser ...
I've just discovered that the clock works properly (ie, the time updates and the drop-down list is populated) when I'm viewing my profile, personal messages or a topic.
However it doesn't work (ie, the time does not update and the drop-down list is empty) the rest of the time.
Well the issue is simple, jQuery is getting loaded after LiveClock.js is loaded.
LiveClock.js make usage of jQuery and as jQuery instance is not there, hence LiveClock.js falls into error.
Also it seems like some other mod is also loading jquery which is even further delaying the load of jQuery. Will try to fix the issue and roll out a new version. Lets hope your issue will be solved in the upcoming version :).
To GL700Wing,
Go to Sources folder and make backup of LiveClock.php.
After making the backup, place the attached file "LiveClock.php" in Sources(replace :P) and see if it resolves the issue.
Quote from: Joker™ on June 12, 2013, 09:59:14 AM
.. place the attached file "LiveClock.php" in Sources and see if it resolves the issue.
Done and no change ... :(
Quote from: GL700Wing on June 12, 2013, 06:04:57 PM
Done and no change ... :(
After searching through all the './Sources/' files for 'jQuery' calls and uninstalling the relevant packages I finally found the mod that's breaking Live Clock - it's BBC User Info V2 (http://custom.simplemachines.org/mods/index.php?mod=3611). After uninstalling that mod the Live Clock started working perfectly (ie, the time updates and the timezone drop-down list is populated). Weird thing is I didn't think that mod would come into play until a message in which that BB code has been used is displayed or one of the message/PM editors is open (showing my complete Java scripting ignorance here).
I still get lots of
'8: Undefined index: lc_ajax_in_progress' messages in the error log if the language file isn't explicitly loaded in the index.template.php file so I've let that fix in place.
Quote from: GL700Wing on June 15, 2013, 08:03:37 AM
Quote from: GL700Wing on June 12, 2013, 06:04:57 PM
Done and no change ... :(
After searching through all the './Sources/' files for 'jQuery' calls and uninstalling the relevant packages I finally found the mod that's breaking Live Clock - it's BBC User Info V2 (http://custom.simplemachines.org/mods/index.php?mod=3611). After uninstalling that mod the Live Clock started working perfectly (ie, the time updates and the timezone drop-down list is populated). Weird thing is I didn't think that mod would come into play until a message in which that BB code has been used is displayed or one of the message/PM editors is open (showing my complete Java scripting ignorance here).
I still get lots of '8: Undefined index: lc_ajax_in_progress' messages in the error log if the language file isn't explicitly loaded in the index.template.php file so I've let that fix in place.
Wow. Joker claps for 'GL700Wing' for such a great debugging.
First of all I really want to thank you, for trimming down the issue for me as most of the times its just a single handed battle for mod authors.
I'll be installing the mod you have mentioned and will try to replicate the issue. Also very soon I'll be rolling out an upgrade having various fixes.
Thanks once again :).
I hope this version resolved our issues :).
Quote from: Joker™ on June 18, 2013, 09:59:10 AM
Wow. Joker claps for 'GL700Wing' for such a great debugging.
First of all I really want to thank you, for trimming down the issue for me as most of the times its just a single handed battle for mod authors.
I'll be installing the mod you have mentioned and will try to replicate the issue. Also very soon I'll be rolling out an upgrade having various fixes.
Thanks once again :).
You're welcome - I'm a Unix sys admin and I kinda enjoy troubleshooting and bug fixing.
Quote from: Joker™ on June 18, 2013, 10:32:32 AM
I hope this version resolved our issues :).
A few issues ... :(
1. There is a problem with the new package file you created that prevents the package from being uploaded or parsed (it contains a folder with a different name to the mod - after extracting/zipping it to the correct name I was able to upload and install the new version);
2. After uninstalling the previous version and installing the new version the list of 'Different TimeZones' is duplicated and you have to select the 'Reset Timezones' option to remove the duplicates; and
3. Using 'Reset Timezones' removes the option for 'Western Europe Time, London, Lisbon, Casablanca' (which has an offset of 0) from the list (see LC_TZ-Default.jpg). My workaround for this is to prefix each list option with the UTC offset (see LC_TZ-Fixed.jpg).
On the upside I don't get any language file related errors since installing the update. :)
Quote from: GL700Wing on June 19, 2013, 06:04:24 AM
1. There is a problem with the new package file you created that prevents the package from being uploaded or parsed (it contains a folder with a different name to the mod - after extracting/zipping it to the correct name I was able to upload and install the new version);
2. After uninstalling the previous version and installing the new version the list of 'Different TimeZones' is duplicated and you have to select the 'Reset Timezones' option to remove the duplicates; and
3. Using 'Reset Timezones' removes the option for 'Western Europe Time, London, Lisbon, Casablanca' (which has an offset of 0) from the list (see LC_TZ-Default.jpg). My workaround for this is to prefix each list option with the UTC offset (see LC_TZ-Fixed.jpg).
On the upside I don't get any language file related errors since installing the update. :)
1st issue known and fixed.
2nd issue fixed.
Unable to replicate 3rd. Can you tell me exact STR for 3rd issue so that I can roll out the new version.
Thanks for the debugging once again :).
QuoteUnable to replicate 3rd.
Hmm - definitely saw this problem with the previous release and thought it was also happening with most recent release but now I can't reproduce it ...
Hehehe, Jokerzz placed his spell on the code :P.
Great mod, Joker, but for some reason it doesn't work on my forum for non-logged-on users (eg. a guest browsing)
Quote from: cap269 on July 14, 2013, 04:23:58 AM
Great mod, Joker, but for some reason it doesn't work on my forum for non-logged-on users (eg. a guest browsing)
It'd be more helpful if you can provide me the site link :). Also you must be having a custom theme, if so please provide the theme name also.
Thanks for your quick reply; I apologize for leaving out those details. The site is using the Blackstorm theme from HostX. Other mods installed are: SimplePortal, EmailValidator, GamerIDs, and Mibbit Ajax IRC Chat Mod. I PM'd the site link to you, as the site isn't public yet.
Quote from: cap269 on July 14, 2013, 06:25:06 PM
Thanks for your quick reply; I apologize for leaving out those details. The site is using the Blackstorm theme from HostX. Other mods installed are: SimplePortal, EmailValidator, GamerIDs, and Mibbit Ajax IRC Chat Mod. I PM'd the site link to you, as the site isn't public yet.
Just loaded your forum and these were the following errors
- No images for me :(
- Opened chrome's debugger and saw this error
Uncaught ReferenceError: $ is not defined
Issue is you are trying to activate 'noConflict' mode of jQuery even before it is loaded. Try to move it inside on document.ready or something of your liking.
Ok, that code was in a misbehaving block. I have de-activated the offender for now, please try again.
The theme you are using, has 2 separate blocks of code to show clock to user:
1. For logged in user,
2. For guests.
Make sure you have edited both of the instances in index.template.php
<li>', $context['current_time'],'</li>
</form>', $context['current_time'],'<br />';
Hello Joker,
I have been in and out of the hospital and many more visits for the future but had time to look at my site and seen you had this now with a mod. Installed it and everything works fine except when I try to view the page with IE8 upgraded from IE6. It just gets stuck on Loading and a blank pull down menu. When I load it in Chrome or Firefox all runs well. Nice Mod. One small other thing. If in US, wish we had some time zones for our silly Daylight savings time besides for Hawaii and Arizona. Those 2 states do not participate in Daylight savings time.
Any help to get it working with IE8 would be great.
William
Thanks again Joker!
Quote from: revwill on July 30, 2013, 01:19:06 AM
Hello Joker,
I have been in and out of the hospital and many more visits for the future but had time to look at my site and seen you had this now with a mod. Installed it and everything works fine except when I try to view the page with IE8 upgraded from IE6. It just gets stuck on Loading and a blank pull down menu. When I load it in Chrome or Firefox all runs well. Nice Mod. One small other thing. If in US, wish we had some time zones for our silly Daylight savings time besides for Hawaii and Arizona. Those 2 states do not participate in Daylight savings time.
Any help to get it working with IE8 would be great.
William
Thanks again Joker!
First of all, I hope you get well real soon.
Coming back to the things you pointed out, personally I hate IE more than anything on web, but I'll try to get my head around it. I don't have a real IE(mac), so I'll be trying to emulate safari to user-agent of IE.
For daylight savings, can you provide me the timezone and names of those 2 states.
Hey,
Thank you Joker!
I believe the 2 states you dont have to worry about is Indiana and Hawaii. Otherwise, we could add four more spots, for example Idaho is Mountain Time. When not in Daylight savings time it is -7 hours. During Daylight savings time it is -6.
So Pacific time is -8
Pacific Time DST is -7
Mountain Time is -7
Mountain DST is -6
Central Time is -6
Central DST is -5
Eastern Time is -5
Eastern DST is -4
And like I said Indiana and Hawaii do not participate so there is no change for them.
Its really Odd when its past 10 pm at night and it is just getting dark outside. But it seems to work for most of our states. There is no need for Hawaii to change their time because it stays light out on average the same throughout the year. Indiana does not participate because they border a time zone and it makes things less efficient for them. The whole idea is to have more daylight time during manufacturing working hours.
Hello
Show unread posts since last visit.
Show new replies to your posts.
Loading...
[ ] <- empty pull down box.
The above is a simple example of what happens.
I wouldn't ask about this, but there are quite a few XP folks out there that cant run anything else unless they use firefox or chrome. Infact I have an older computer set up for all I need it to do and it cant upgrade beyond XP. I am so glad it didn't like Vista, but puts a hamper on things moving onward.
Thank you again Joker and have a terrific day..
William
I'll try my best to wrap my head around these 2 things.
Mod updated with major javascript enhancements
Version 1.3
- Loading scripts in specific order with specific jquery version
- overhauling of JS with revealing modular pattern
- XHTML fixes
- checks refined with usage of typeof, generic function to check null or undefined
- var scoping in JS
- params init only once
- code optimisation
- Obsolete comment removed
- Using anonymous function concept to invoke the clock class
this mod fills up my error log with COPIOUS errors continually that say:
Unable to load the 'LikePosts.english' language file.
fixed. i had to create LikePosts.english.php from https://github.com/siddhartha-gupta/SMF-Likes/blob/master/Themes/default/languages/LikePosts.english.php#L1
Quote from: aegersz on October 11, 2016, 07:55:15 PM
fixed. i had to create LikePosts.english.php from https://github.com/siddhartha-gupta/SMF-Likes/blob/master/Themes/default/languages/LikePosts.english.php#L1
As this is the
Live Clock mod and *not* the
Like Posts mod the correct solution is as follows:
In the file ./Sources/LiveClock.php
Find
loadlanguage('LikePosts');
Replace with
loadlanguage('LiveClock');
Thanks for that ^^^ ... in the end i disabled this mod as i was getting complaints about the PM "To" field auto-complete not working when Live Clock was active.