Version Description
- The time calculation for NOW is done via ajax, so now caching plugins may be used
Download this release
Release Info
Developer | baden03 |
Plugin | T(-) Countdown |
Version | 2.2.19 |
Comparing to | |
See all releases |
Code changes from version 2.2.18 to 2.2.19
- countdown-timer.php +21 -10
- js/jquery.t-countdown.js +25 -12
- js/now.php +4 -0
- readme.txt +6 -3
countdown-timer.php
CHANGED
@@ -5,7 +5,7 @@ Text Domain: tminus
|
|
5 |
Domain Path: /languages
|
6 |
Plugin URI: http://plugins.twinpictures.de/plugins/t-minus-countdown/
|
7 |
Description: Display and configure multiple T(-) Countdown timers using a shortcode or sidebar widget.
|
8 |
-
Version: 2.2.
|
9 |
Author: twinpictures, baden03
|
10 |
Author URI: http://www.twinpictures.de/
|
11 |
License: GPL2
|
@@ -14,7 +14,7 @@ License: GPL2
|
|
14 |
//plugin init scripts
|
15 |
add_action( 'init', 'countdown_init_scripts' );
|
16 |
function countdown_init_scripts(){
|
17 |
-
$current_version = '2.2.
|
18 |
$installed_version = get_option('t-minus_version');
|
19 |
|
20 |
if($current_version != $installed_version){
|
@@ -30,6 +30,15 @@ function countdown_init_scripts(){
|
|
30 |
}
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
//load scripts on the widget admin page
|
34 |
add_action( 'admin_enqueue_scripts', 'admin_scripts');
|
35 |
function admin_scripts($hook){
|
@@ -56,7 +65,7 @@ function countdown_scripts(){
|
|
56 |
$plugin_url = plugins_url() .'/'. dirname( plugin_basename(__FILE__) );
|
57 |
|
58 |
//lwtCountdown script
|
59 |
-
wp_register_script('countdown-script', $plugin_url.'/js/jquery.t-countdown.js', array ('jquery'), '1.5.
|
60 |
wp_enqueue_script('countdown-script');
|
61 |
|
62 |
//register all countdown styles for enqueue-as-needed
|
@@ -283,7 +292,7 @@ class CountDownTimer extends WP_Widget {
|
|
283 |
'hour' => $hour,
|
284 |
'min' => $min,
|
285 |
'sec' => $sec,
|
286 |
-
'localtime' => $t
|
287 |
'style' => $style,
|
288 |
'omitweeks' => $omitweeks,
|
289 |
'content' => trim($launchhtml),
|
@@ -303,9 +312,11 @@ class CountDownTimer extends WP_Widget {
|
|
303 |
'year': <?php echo date('Y', $target); ?>,
|
304 |
'hour': <?php echo $hour; ?>,
|
305 |
'min': <?php echo $min; ?>,
|
306 |
-
'sec': <?php echo $sec;
|
|
|
307 |
'localtime': '<?php echo $t; ?>',
|
308 |
'mysqltime': '<?php echo current_time('mysql'); ?>'
|
|
|
309 |
},
|
310 |
style: '<?php echo $style; ?>',
|
311 |
launchtarget: '<?php echo $launchdiv; ?>',
|
@@ -511,9 +522,11 @@ function print_my_script() {
|
|
511 |
'year': <?php echo $script['year']; ?>,
|
512 |
'hour': <?php echo $script['hour']; ?>,
|
513 |
'min': <?php echo $script['min']; ?>,
|
514 |
-
'sec': <?php echo $script['sec'];
|
|
|
515 |
'localtime': '<?php echo $script['localtime']; ?>',
|
516 |
'mysqltime': '<?php echo current_time('mysql'); ?>'
|
|
|
517 |
},
|
518 |
style: '<?php echo $script['style']; ?>',
|
519 |
launchtarget: '<?php echo $script['launchtarget']; ?>',
|
@@ -707,7 +720,7 @@ function tminuscountdown($atts, $content=null) {
|
|
707 |
'hour' => $hour,
|
708 |
'min' => $min,
|
709 |
'sec' => $sec,
|
710 |
-
'localtime' => $t
|
711 |
'style' => $style,
|
712 |
'omitweeks' => $omitweeks,
|
713 |
'content' => $content,
|
@@ -726,9 +739,7 @@ function tminuscountdown($atts, $content=null) {
|
|
726 |
'year': ".$year.",
|
727 |
'hour': ".$hour.",
|
728 |
'min': ".$min.",
|
729 |
-
'sec': ".$sec."
|
730 |
-
'localtime': '".$t."',
|
731 |
-
'mysqltime': '".current_time('mysql')."'
|
732 |
},
|
733 |
style: '".$style."',
|
734 |
launchtarget: '".$launchtarget."',
|
5 |
Domain Path: /languages
|
6 |
Plugin URI: http://plugins.twinpictures.de/plugins/t-minus-countdown/
|
7 |
Description: Display and configure multiple T(-) Countdown timers using a shortcode or sidebar widget.
|
8 |
+
Version: 2.2.19
|
9 |
Author: twinpictures, baden03
|
10 |
Author URI: http://www.twinpictures.de/
|
11 |
License: GPL2
|
14 |
//plugin init scripts
|
15 |
add_action( 'init', 'countdown_init_scripts' );
|
16 |
function countdown_init_scripts(){
|
17 |
+
$current_version = '2.2.19';
|
18 |
$installed_version = get_option('t-minus_version');
|
19 |
|
20 |
if($current_version != $installed_version){
|
30 |
}
|
31 |
}
|
32 |
|
33 |
+
//set global vars
|
34 |
+
add_action( 'wp_head', 'tminus_js_vars' );
|
35 |
+
function tminus_js_vars(){
|
36 |
+
echo "<script type='text/javascript'>\n";
|
37 |
+
$plugin_url = plugins_url() .'/'. dirname( plugin_basename(__FILE__) );
|
38 |
+
echo "var tminusnow = '".$plugin_url."/js/now.php';\n";
|
39 |
+
echo "</script>";
|
40 |
+
}
|
41 |
+
|
42 |
//load scripts on the widget admin page
|
43 |
add_action( 'admin_enqueue_scripts', 'admin_scripts');
|
44 |
function admin_scripts($hook){
|
65 |
$plugin_url = plugins_url() .'/'. dirname( plugin_basename(__FILE__) );
|
66 |
|
67 |
//lwtCountdown script
|
68 |
+
wp_register_script('countdown-script', $plugin_url.'/js/jquery.t-countdown.js', array ('jquery'), '1.5.3' );
|
69 |
wp_enqueue_script('countdown-script');
|
70 |
|
71 |
//register all countdown styles for enqueue-as-needed
|
292 |
'hour' => $hour,
|
293 |
'min' => $min,
|
294 |
'sec' => $sec,
|
295 |
+
/*'localtime' => $t,*/
|
296 |
'style' => $style,
|
297 |
'omitweeks' => $omitweeks,
|
298 |
'content' => trim($launchhtml),
|
312 |
'year': <?php echo date('Y', $target); ?>,
|
313 |
'hour': <?php echo $hour; ?>,
|
314 |
'min': <?php echo $min; ?>,
|
315 |
+
'sec': <?php echo $sec; ?>
|
316 |
+
/*
|
317 |
'localtime': '<?php echo $t; ?>',
|
318 |
'mysqltime': '<?php echo current_time('mysql'); ?>'
|
319 |
+
*/
|
320 |
},
|
321 |
style: '<?php echo $style; ?>',
|
322 |
launchtarget: '<?php echo $launchdiv; ?>',
|
522 |
'year': <?php echo $script['year']; ?>,
|
523 |
'hour': <?php echo $script['hour']; ?>,
|
524 |
'min': <?php echo $script['min']; ?>,
|
525 |
+
'sec': <?php echo $script['sec']; ?>
|
526 |
+
/*
|
527 |
'localtime': '<?php echo $script['localtime']; ?>',
|
528 |
'mysqltime': '<?php echo current_time('mysql'); ?>'
|
529 |
+
*/
|
530 |
},
|
531 |
style: '<?php echo $script['style']; ?>',
|
532 |
launchtarget: '<?php echo $script['launchtarget']; ?>',
|
720 |
'hour' => $hour,
|
721 |
'min' => $min,
|
722 |
'sec' => $sec,
|
723 |
+
/*'localtime' => $t,*/
|
724 |
'style' => $style,
|
725 |
'omitweeks' => $omitweeks,
|
726 |
'content' => $content,
|
739 |
'year': ".$year.",
|
740 |
'hour': ".$hour.",
|
741 |
'min': ".$min.",
|
742 |
+
'sec': ".$sec."
|
|
|
|
|
743 |
},
|
744 |
style: '".$style."',
|
745 |
launchtarget: '".$launchtarget."',
|
js/jquery.t-countdown.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
|
2 |
-
* T- Countdown v1.5.
|
3 |
* http://plugins.twinpictures.de/plugins/t-minus-countdown/
|
4 |
*
|
5 |
-
* Copyright
|
6 |
*
|
7 |
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
8 |
* of this software and associated documentation files (the "Software"), to deal
|
@@ -28,7 +28,10 @@
|
|
28 |
$.fn.countDown = function (options) {
|
29 |
config = {};
|
30 |
$.extend(config, options);
|
31 |
-
|
|
|
|
|
|
|
32 |
before = new Date();
|
33 |
$.data($(this)[0], 'before', before);
|
34 |
$.data($(this)[0], 'status', 'play');
|
@@ -47,10 +50,9 @@
|
|
47 |
$.data($(this)[0], 'omitWeeks', config.omitWeeks);
|
48 |
}
|
49 |
$('#' + $(this).attr('id') + ' .' + style + '-digit').html('<div class="top"></div><div class="bottom"></div>');
|
50 |
-
$(this).doCountDown($(this).attr('id'), diffSecs, 500);
|
51 |
return this;
|
52 |
};
|
53 |
-
|
54 |
$.fn.stopCountDown = function () {
|
55 |
$.data(this[0], 'status', 'stop');
|
56 |
};
|
@@ -60,7 +62,21 @@
|
|
60 |
this.doCountDown($(this).attr('id'),$.data(this[0], 'diffSecs'), 500);
|
61 |
};
|
62 |
|
63 |
-
$.fn.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
var targetTime = new Date();
|
65 |
if (options.targetDate){
|
66 |
targetTime = new Date(options.targetDate.month + '/' + options.targetDate.day + '/' + options.targetDate.year + ' ' + options.targetDate.hour + ':' + options.targetDate.min + ':' + options.targetDate.sec + (options.targetDate.utc ? ' UTC' : ''));
|
@@ -73,14 +89,11 @@
|
|
73 |
targetTime.setMinutes(options.targetOffset.min + targetTime.getMinutes());
|
74 |
targetTime.setSeconds(options.targetOffset.sec + targetTime.getSeconds());
|
75 |
}
|
76 |
-
|
77 |
-
|
78 |
-
$.data(this[0], 'diffSecs', diffSecs);
|
79 |
-
return diffSecs;
|
80 |
};
|
81 |
|
82 |
$.fn.doCountDown = function (id, diffSecs, duration) {
|
83 |
-
//alert(diffSecs);
|
84 |
$this = $('#' + id);
|
85 |
|
86 |
if (diffSecs <= 0){
|
1 |
+
/*
|
2 |
+
* T- Countdown v1.5.3
|
3 |
* http://plugins.twinpictures.de/plugins/t-minus-countdown/
|
4 |
*
|
5 |
+
* Copyright 2015, Twinpictures
|
6 |
*
|
7 |
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
8 |
* of this software and associated documentation files (the "Software"), to deal
|
28 |
$.fn.countDown = function (options) {
|
29 |
config = {};
|
30 |
$.extend(config, options);
|
31 |
+
targetTime = this.setTargetTime(config);
|
32 |
+
//set diffSecs and launch the countdown once the ajax for now loads
|
33 |
+
//console.log(config.targetDate.localtime); //this did not support caching plugins
|
34 |
+
diffSecs = this.setDiffSecs(targetTime);
|
35 |
before = new Date();
|
36 |
$.data($(this)[0], 'before', before);
|
37 |
$.data($(this)[0], 'status', 'play');
|
50 |
$.data($(this)[0], 'omitWeeks', config.omitWeeks);
|
51 |
}
|
52 |
$('#' + $(this).attr('id') + ' .' + style + '-digit').html('<div class="top"></div><div class="bottom"></div>');
|
|
|
53 |
return this;
|
54 |
};
|
55 |
+
|
56 |
$.fn.stopCountDown = function () {
|
57 |
$.data(this[0], 'status', 'stop');
|
58 |
};
|
62 |
this.doCountDown($(this).attr('id'),$.data(this[0], 'diffSecs'), 500);
|
63 |
};
|
64 |
|
65 |
+
$.fn.setDiffSecs = function (targetTime) {
|
66 |
+
var diffSecs = null;
|
67 |
+
$.ajax({
|
68 |
+
url: tminusnow,
|
69 |
+
cache: false,
|
70 |
+
success: $.proxy(function( data ) {
|
71 |
+
//console.log(data);
|
72 |
+
nowTime = new Date(data);
|
73 |
+
diffSecs = Math.floor((targetTime.valueOf()-nowTime.valueOf())/1000);
|
74 |
+
$(this).doCountDown($(this).attr('id'), diffSecs, 500);
|
75 |
+
}, this)
|
76 |
+
});
|
77 |
+
};
|
78 |
+
|
79 |
+
$.fn.setTargetTime = function (options) {
|
80 |
var targetTime = new Date();
|
81 |
if (options.targetDate){
|
82 |
targetTime = new Date(options.targetDate.month + '/' + options.targetDate.day + '/' + options.targetDate.year + ' ' + options.targetDate.hour + ':' + options.targetDate.min + ':' + options.targetDate.sec + (options.targetDate.utc ? ' UTC' : ''));
|
89 |
targetTime.setMinutes(options.targetOffset.min + targetTime.getMinutes());
|
90 |
targetTime.setSeconds(options.targetOffset.sec + targetTime.getSeconds());
|
91 |
}
|
92 |
+
|
93 |
+
return targetTime;
|
|
|
|
|
94 |
};
|
95 |
|
96 |
$.fn.doCountDown = function (id, diffSecs, duration) {
|
|
|
97 |
$this = $('#' + id);
|
98 |
|
99 |
if (diffSecs <= 0){
|
js/now.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once("../../../../wp-load.php");
|
3 |
+
echo date( 'n/j/Y H:i:s', strtotime(current_time('mysql')) );
|
4 |
+
?>
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Donate link: http://plugins.twinpictures.de/plugins/t-minus-countdown/
|
|
5 |
Tags: countdown, timer, clock, ticker, widget, event, counter, count down, twinpictures, t minus, t-minus, plugin-oven, pluginoven, G2, spaceBros, littlewebtings, jQuery, javascript
|
6 |
Requires at least: 3.9
|
7 |
Tested up to: 4.2
|
8 |
-
Stable tag: 2.2.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -50,8 +50,8 @@ Yes, yes... <a href='http://www.facebook.com/twinpictures'>Twinpictures is on Fa
|
|
50 |
= Does Twinpictures do the Twitter? =
|
51 |
Ah yes! <a href='http://twitter.com/#!/twinpictures'>@Twinpictures</a> is on the Twitter.
|
52 |
|
53 |
-
= Where may one view
|
54 |
-
|
55 |
|
56 |
== Screenshots ==
|
57 |
|
@@ -63,6 +63,9 @@ The Daily Show with John Stewart
|
|
63 |
|
64 |
== Changelog ==
|
65 |
|
|
|
|
|
|
|
66 |
= 2.2.18 =
|
67 |
* countdown script moved in loading priority to after jQuery, when loaded in the footer
|
68 |
|
5 |
Tags: countdown, timer, clock, ticker, widget, event, counter, count down, twinpictures, t minus, t-minus, plugin-oven, pluginoven, G2, spaceBros, littlewebtings, jQuery, javascript
|
6 |
Requires at least: 3.9
|
7 |
Tested up to: 4.2
|
8 |
+
Stable tag: 2.2.19
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
50 |
= Does Twinpictures do the Twitter? =
|
51 |
Ah yes! <a href='http://twitter.com/#!/twinpictures'>@Twinpictures</a> is on the Twitter.
|
52 |
|
53 |
+
= Where may one view the week in review that gives giggle? =
|
54 |
+
Last Week Tonight With John Oliver
|
55 |
|
56 |
== Screenshots ==
|
57 |
|
63 |
|
64 |
== Changelog ==
|
65 |
|
66 |
+
= 2.2.19 =
|
67 |
+
* The time calculation for NOW is done via ajax, so now caching plugins may be used
|
68 |
+
|
69 |
= 2.2.18 =
|
70 |
* countdown script moved in loading priority to after jQuery, when loaded in the footer
|
71 |
|