[DEV] Live time clock

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Scam Warning
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
all4phone
Registered User
Posts: 593
Joined: Fri Mar 18, 2011 11:56 am
Location: Poland
Name: Piotr

[DEV] Live time clock

Post by all4phone »

Extension name: Live Time Clock
Author: all4phone

Description: This extension allows full configuration of format the day, date, year, and clock on index page and replaces static clock with live time clock. 24 or 12 hr format clock dependent on UCP settings ("My date format:" - except Custom...)

Credit: Special thanks goes to dmzx and Sniper_E.

IMPORTANT
This extension is't validated, so as always do not install on a live board!

Version: 0.1.7

Installation:
  1. Copy the entire contents of the repository to ext/all4phone/ltc/
  2. Navigate in the ACP to Customise -> Extension Management -> Extensions.
  3. Click Enable.
screens:
Image
Image

Demo: demo
Download: download
Last edited by all4phone on Thu Aug 18, 2016 5:18 pm, edited 17 times in total.
User avatar
dmzx
Registered User
Posts: 853
Joined: Fri Sep 05, 2014 6:48 am
Location: The Netherlands

Re: [RC] Live time clock

Post by dmzx »

Your download has 3 extensions in is this correct?

Image
Contact me on dmzx-web.net
Buy me a beer Donate and try binance.com or try CentOS Web Panel
User avatar
all4phone
Registered User
Posts: 593
Joined: Fri Mar 18, 2011 11:56 am
Location: Poland
Name: Piotr

Re: [RC] Live time clock

Post by all4phone »

Of course not :)
Thanks for reporting.
Mistake has been corrected ;)
User avatar
dmzx
Registered User
Posts: 853
Joined: Fri Sep 05, 2014 6:48 am
Location: The Netherlands

Re: [RC] Live time clock

Post by dmzx »

If I look at your service.yml I see a class controller where is it in the files?
Also event listener is comment out some code.
And overall_header_head_append.html uses ../

Is this [RC] ?
Contact me on dmzx-web.net
Buy me a beer Donate and try binance.com or try CentOS Web Panel
User avatar
all4phone
Registered User
Posts: 593
Joined: Fri Mar 18, 2011 11:56 am
Location: Poland
Name: Piotr

Re: [RC] Live time clock

Post by all4phone »

Thanks again dmzx, mentioned files corrected.
dmzx wrote:And overall_header_head_append.html uses ../
At the moment I have no other idea.
travel
Registered User
Posts: 131
Joined: Sun Jan 11, 2015 7:21 pm

Re: [RC] Live time clock

Post by travel »

Well done. Thanks.
I have checked on my live board.
I think, the "It is currently:" is not necessary. 8-)
User avatar
dmzx
Registered User
Posts: 853
Joined: Fri Sep 05, 2014 6:48 am
Location: The Netherlands

Re: [RC] Live time clock

Post by dmzx »

js in footer overall_footer_after.html like

Code: Select all

<!-- INCLUDEJS @all4phone_ltc/js/en/ltc_short_days_short_month.js -->
<!-- INCLUDEJS @all4phone_ltc/js/en/ltc_clock_12.js -->
And css in overall_header_head_append.html like:

Code: Select all

<!-- INCLUDECSS @all4phone_ltc/ltc.css -->
Contact me on dmzx-web.net
Buy me a beer Donate and try binance.com or try CentOS Web Panel
User avatar
all4phone
Registered User
Posts: 593
Joined: Fri Mar 18, 2011 11:56 am
Location: Poland
Name: Piotr

Re: [RC] Live time clock

Post by all4phone »

@travel, thanks.
travel wrote:I have checked on my live board.
This can be dangerous, be careful!
all4phone wrote:IMPORTANT
This extension is't validated, so as always do not install on a live board!
travel wrote:I think, the "It is currently:" is not necessary. 8-)
I decided to leave it, becouse it exists also when the extension is disabled ;)

@dmzx, you are master, works perfectly, your help is greatly appreciated :)
ThePowersThatBe
Registered User
Posts: 7
Joined: Sat Nov 23, 2013 10:08 pm

Re: [RC] Live time clock

Post by ThePowersThatBe »

Is it possible to edit this extension to use the server time instead of using the time from the user's computer? I have a forum where users post auctions with a set end time and the time stamp on posts is used to determine whether or not a bid is valid. They would like to have a live clock available to time their bidding/posting, but it would have to use server time instead of their individual computer time to be in sync with the time stamps on posts.
User avatar
all4phone
Registered User
Posts: 593
Joined: Fri Mar 18, 2011 11:56 am
Location: Poland
Name: Piotr

Re: [RC] Live time clock

Post by all4phone »

Sorry, so late.
Yes, it's possible. If you're still interested, check out this clock please: clock
For me works well.
User avatar
zardos
Registered User
Posts: 130
Joined: Mon Feb 29, 2016 12:23 pm
Location: England, uk

Re: [RC] Live time clock

Post by zardos »

Nice work, thankyou
ThePowersThatBe
Registered User
Posts: 7
Joined: Sat Nov 23, 2013 10:08 pm

Re: [RC] Live time clock

Post by ThePowersThatBe »

all4phone wrote:Sorry, so late.
Yes, it's possible. If you're still interested, check out this clock please: clock
For me works well.
Yes, that would be great! What do I change in the extension files to use server time?

Thanks!
User avatar
all4phone
Registered User
Posts: 593
Joined: Fri Mar 18, 2011 11:56 am
Location: Poland
Name: Piotr

Re: [RC] Live time clock

Post by all4phone »

You should change js code of clock. I'll give you some when I'll be back home. Wait few hours please.
User avatar
all4phone
Registered User
Posts: 593
Joined: Fri Mar 18, 2011 11:56 am
Location: Poland
Name: Piotr

Re: [DEV] Live time clock

Post by all4phone »

@ThePowersThatBe, create a new file (ie. clock.php) in the root/ directory:

Code: Select all

<script type="text/javascript">
var offset = Math.round(new Date().getTime() / 1000);

function GetClock(){
	var d=new Date();
	d.setSeconds(d.getSeconds() + <?php echo time(); ?> - offset);
	var hour=d.getHours(),min=d.getMinutes(),sec=d.getSeconds();
		if(min<=9) min="0"+min;
		if(sec<=9) sec="0"+sec;
	document.getElementById('clock').innerHTML=""+hour+":"+min+":"+sec+"";
}
	window.onload=function(){
	GetClock();
	setInterval(GetClock,1000);
}
</script>
Then open ext/all4phone/ltc/styles/prosilver/template/js/en/ltc_clock_12.js file and replace all of the code on:

Code: Select all

$.ajax({
        type: "POST",
        data:"",
        url: "clock.php",
        success: function(result){
                $("#clock").html(result);
            }
        });
Check it out please, should work.

Please remember that my extension doesn't work like that and I will not continue it that way.
Last edited by all4phone on Thu Jun 16, 2016 6:26 am, edited 1 time in total.
User avatar
all4phone
Registered User
Posts: 593
Joined: Fri Mar 18, 2011 11:56 am
Location: Poland
Name: Piotr

Re: [DEV] Live time clock

Post by all4phone »

dmzx wrote: Is this [RC] ?
That's right, better change to DEV. I will develop this extension. I'll add a few more options soon.

Now available v 0.1.0:
- ACP added
- possibility change color of day, date and clock
- two options of clock (12/24)

Return to “Extensions in Development”