Jump to content
Sign in to follow this  
Totoka

jQuery plug-in => Event Timer

Recommended Posts

** dependencies: jQuery & later.js

<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/later/1.2.0/later.min.js'></script>

 

source + example:

* html template was done with bootstrap.css

https://jsfiddle.net/Totoka/pm30r9c6/

 

Scroll down the javascript page, there is an small object documented

 

here a minified version

<script type="text/javascript" src="http://yourjavascript.com/321130410682/event-timer-min.js"></script>

 

@Update  2016-10-17 03:18

+ support for custom map states, based in an ordered list by duration in seconds

+ added default time format HH:MM:SS

+ Object @Settings re-structured

 

@Update 2016-10-20 13:20

+ time diff fixes

Edited by Totoka
@Update 2016-10-17 03:18 UTC
  • Like 9

Discord: andresc

Share this post


Link to post
Share on other sites

Some time based maps examples:

 

        {
          name: 'Chaos Argent',
          time: [ '0 14/6 * * *' ],//-- each 6 hours starting from 14h00m
          states: [
            { upto: 30 * 60, value:'<span class="label label-success">OPEN</span>' },
            { upto: 45 * 60, value:'<span class="label label-warning">ACTIVE</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
      	{
          name: 'Icicle Mirage',
          time: [ '0 13/6 * * *' ],//-- each 6 hours starting from 13h00m/day
          states: [
            { upto:  4 * 60 * 60, value:'<span class="label label-success">OPEN</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
      	{
          name: 'Shaitan Mirage',
          time: [ '0 13/6 * * *' ],//-- each 6 hours starting from 13h00m/day
          states: [
            { upto:  4 * 60 * 60, value:'<span class="label label-success">OPEN</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
      	{
          name: 'Thundoria Mirage',
          time: [ '0 13/6 * * *' ],//-- each 6 hours starting from 13h00m/day
          states: [
            { upto:  4 * 60 * 60, value:'<span class="label label-success">OPEN</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
      	{
          name: 'Forsaken City',
          time: [ '0 0/3 * * *' ],//-- each 3 hours starting from 00h00m
          states: [
            { upto: 1 * 60 * 60, value:'<span class="label label-success">OPEN</span>' },
            { upto: 2 * 60 * 60, value:'<span class="label label-warning">ACTIVE</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
      	{
          name: 'Forsaken City 2',
          time: [ '0 0/3 * * *' ],//-- each 3 hours starting from 00h00m
          states: [
            { upto: 1 * 40 * 60, value:'<span class="label label-success">OPEN</span>' },
            { upto: 2 * 60 * 60, value:'<span class="label label-warning">ACTIVE</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
      	{
          name: 'Forsaken City 3',
          time: [ '0 0/3 * * *' ],//-- each 3 hours starting from 00h00m
          states: [
            { upto: 1 * 80 * 60, value:'<span class="label label-success">OPEN</span>' },
            { upto: 2 * 60 * 60, value:'<span class="label label-warning">ACTIVE</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
      	{
          name: 'Dark Swamp',
          time: [ '0 0/3 * * *' ],//-- each 3 hours starting from 00h00m
          states: [
            { upto: 1 * 60 * 60, value:'<span class="label label-success">OPEN</span>' },
            { upto: 2 * 60 * 60, value:'<span class="label label-warning">ACTIVE</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
      	{
          name: 'Demonic World',
          time: [ '0 0/3 * * *' ],//-- each 3 hours starting from 00h00m
          states: [
            { upto: 1 * 40 * 60, value:'<span class="label label-success">OPEN</span>' },
            { upto: 2 * 60 * 60, value:'<span class="label label-warning">ACTIVE</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
      	{
          name: 'Demonic World 2',
          time: [ '0 0/3 * * *' ],//-- each 3 hours starting from 00h00m
          states: [
            { upto: 1 * 80 * 60, value:'<span class="label label-success">OPEN</span>' },
            { upto: 2 * 60 * 60, value:'<span class="label label-warning">ACTIVE</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
      	{
          name: 'Abaddon 1',
          time: [ '0 21 * * *' ],//-- each 1 day starting from 21h00m
          states: [
            { upto: 1 * 60 * 60, value:'<span class="label label-success">OPEN</span>' },
            { upto: 6 * 60 * 60, value:'<span class="label label-warning">ACTIVE</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
      	{
          name: 'Abaddon 2',
          time: [ '30 21 * * *' ],//-- each 1 day starting from 21h30m
          states: [
            { upto: 1 * 30 * 60, value:'<span class="label label-success">OPEN</span>' },
            { upto: ((5 * 60)+30) * 60, value:'<span class="label label-warning">ACTIVE</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
      	{
          name: 'Abaddon 3',
          time: [ '0 22 * * *' ],//-- each 1 day starting from 22h00m
          states: [
            { upto: 1 * 30 * 60, value:'<span class="label label-success">OPEN</span>' },
            { upto: 5 * 60 * 60, value:'<span class="label label-warning">ACTIVE</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
      	{
          name: 'Abaddon 4',
          time: [ '0 0 * * *' ],//-- each 1 day starting from 00h00m
          states: [
            { upto: 1 * 60 * 60, value:'<span class="label label-success">OPEN</span>' },
            { upto: 3 * 60 * 60, value:'<span class="label label-warning">ACTIVE</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
      	{
          name: 'Abaddon 5',
          time: [ '30 0 * * *' ],//-- each 1 day starting from 00h30m
          states: [
            { upto: 2 * 60 * 60, value:'<span class="label label-success">OPEN</span>' },
            { upto: ((2 * 60)+30) * 60, value:'<span class="label label-warning">ACTIVE</span>' },
            { value: '<span class="label label-danger">CLOSED</span>' },
          ]
        },
Edited by Totoka
  • Like 3

Discord: andresc

Share this post


Link to post
Share on other sites

@Totoka will test this out sometime when im free =)

  • Like 1

logo-big.png   logo.png

                                   Sunny Go! Online                                                                    pko.host                                                 

Share this post


Link to post
Share on other sites

@Update 2016-10-20 13:20

+ time diff fixes

 

Should be stable now

 

*There will be another update soon, and probably the last one; I'm gonna try to reduce the complexity within the settings object, by adding some modifier functions.

  • Like 1

Discord: andresc

Share this post


Link to post
Share on other sites

Hello @Totoka! Could you post a pack with the .HTML for the map timer? It will save a lot of time for anyone trying the script :)

 


logo-big.png   logo.png

                                   Sunny Go! Online                                                                    pko.host                                                 

Share this post


Link to post
Share on other sites

Since you're now talking about JavaScript,anybody has an idea how to run JavaScript into PHP? Me and my cousin are struggling to find it, still nothing found.

Share this post


Link to post
Share on other sites
19 minutes ago, Vasil said:

Since you're now talking about JavaScript,anybody has an idea how to run JavaScript into PHP? Me and my cousin are struggling to find it, still nothing found.

 

You can put script tags and execute the Javascript inside the tags.

 

<script language="javascript" type="text/javascript"> alert("Hello Vasil!"); </script>

Share this post


Link to post
Share on other sites
1 час назад, Vasil сказал:

Since you're now talking about JavaScript,anybody has an idea how to run JavaScript into PHP? Me and my cousin are struggling to find it, still nothing found.

 

echo '<script language="javascript" type="text/javascript"> alert("Hello Vasil!"); </script>';

 

But I think it is better to separate PHP code from HTML/CSS/JS.

  • Like 1

Share this post


Link to post
Share on other sites
57 minutes ago, V3ct0r said:

 


echo '<script language="javascript" type="text/javascript"> alert("Hello Vasil!"); </script>';

 

But I think it is better to separate PHP code from HTML/CSS/JS.

 

Quite depends, if it's a big source of JS he should actually make a JS file for it, just the direct access would be an option if it was one or two lines JS codes. Or the echo in PHP also.

Share this post


Link to post
Share on other sites

Hey @Vasil

 

3 hours ago, Vasil said:

Since you're now talking about JavaScript,anybody has an idea how to run JavaScript into PHP? Me and my cousin are struggling to find it, still nothing found.

There is a V8 extension for php:

http://php.net/manual/en/v8js.executestring.php xD

 

Btw, why you want to run JS Into PHP ? O.o
You can run a parallel nodejs server for such purpose, That way you'll have a less complex & messy code


Discord: andresc

Share this post


Link to post
Share on other sites
В 20.10.2016 в 16:58, Totoka сказал:

@Update 2016-10-20 13:20

+ time diff fixes

 

Should be stable now

 

*There will be another update soon, and probably the last one; I'm gonna try to reduce the complexity within the settings object, by adding some modifier functions.

 

Hello, good job, it would be good to make the counter not ticking if the map is open is constant and does not show the time until the next open if the map is open.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...