T(-) Countdown - Version 2.3.17

Version Description

  • scripts do not load on customize.php page
  • removed now.php from js
  • fully tested with WordPress 4.8
Download this release

Release Info

Developer baden03
Plugin Icon 128x128 T(-) Countdown
Version 2.3.17
Comparing to
See all releases

Code changes from version 2.3.16 to 2.3.17

Files changed (3) hide show
  1. countdown-timer.php +5 -8
  2. js/jquery.t-countdown.js +13 -27
  3. readme.txt +9 -3
countdown-timer.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: T(-) Countdown
4
  Text Domain: jquery-t-countdown-widget
5
  Plugin URI: https://plugins.twinpictures.de/plugins/t-minus-countdown/
6
  Description: Display and configure multiple T(-) Countdown timers using a shortcode or sidebar widget.
7
- Version: 2.3.16
8
  Author: twinpictures, baden03
9
  Author URI: https://www.twinpictures.de/
10
  License: GPL2
@@ -12,7 +12,7 @@ License: GPL2
12
 
13
  class WP_TMinusCD {
14
  var $plugin_name = 'T(-) Countdown';
15
- var $version = '2.3.16';
16
  var $domain = 'tminus';
17
  var $plguin_options_page_title = 'T(-) Countdown Options';
18
  var $plugin_options_menue_title = 'T(-) Countdown';
@@ -89,10 +89,6 @@ class WP_TMinusCD {
89
  function plugin_head_inject(){
90
  // custom script
91
  echo "<script type='text/javascript'>\n";
92
- /*
93
- $plugin_url = plugins_url() .'/'. dirname( plugin_basename(__FILE__) );
94
- echo "var tminusnow = '".$plugin_url."/js/now.php';\n";
95
- */
96
  $response = array( 'now' => date( 'n/j/Y H:i:s', strtotime(current_time('mysql'))));
97
  echo "var tminusnow = '".json_encode($response)."';\n";
98
  echo "</script>";
@@ -107,7 +103,8 @@ class WP_TMinusCD {
107
 
108
  //load scripts on the widget admin page
109
  function tminus_admin_scripts($hook){
110
- if( $hook == 'widgets.php' ){
 
111
  //jquery datepicker
112
  wp_enqueue_script( 'jquery-ui-datepicker' );
113
  wp_enqueue_script( 'jquery-ui-slider' );
@@ -138,7 +135,7 @@ class WP_TMinusCD {
138
  $plugin_url = plugins_url() .'/'. dirname( plugin_basename(__FILE__) );
139
 
140
  //lwtCountdown script
141
- wp_register_script('countdown-script', $plugin_url.'/js/jquery.t-countdown.js', array ('jquery'), '1.5.9', 'true');
142
  wp_enqueue_script('countdown-script');
143
 
144
  //force load styles
4
  Text Domain: jquery-t-countdown-widget
5
  Plugin URI: https://plugins.twinpictures.de/plugins/t-minus-countdown/
6
  Description: Display and configure multiple T(-) Countdown timers using a shortcode or sidebar widget.
7
+ Version: 2.3.17
8
  Author: twinpictures, baden03
9
  Author URI: https://www.twinpictures.de/
10
  License: GPL2
12
 
13
  class WP_TMinusCD {
14
  var $plugin_name = 'T(-) Countdown';
15
+ var $version = '2.3.17';
16
  var $domain = 'tminus';
17
  var $plguin_options_page_title = 'T(-) Countdown Options';
18
  var $plugin_options_menue_title = 'T(-) Countdown';
89
  function plugin_head_inject(){
90
  // custom script
91
  echo "<script type='text/javascript'>\n";
 
 
 
 
92
  $response = array( 'now' => date( 'n/j/Y H:i:s', strtotime(current_time('mysql'))));
93
  echo "var tminusnow = '".json_encode($response)."';\n";
94
  echo "</script>";
103
 
104
  //load scripts on the widget admin page
105
  function tminus_admin_scripts($hook){
106
+ global $pagenow;
107
+ if( $hook == 'widgets.php' && $pagenow != 'customize.php'){
108
  //jquery datepicker
109
  wp_enqueue_script( 'jquery-ui-datepicker' );
110
  wp_enqueue_script( 'jquery-ui-slider' );
135
  $plugin_url = plugins_url() .'/'. dirname( plugin_basename(__FILE__) );
136
 
137
  //lwtCountdown script
138
+ wp_register_script('countdown-script', $plugin_url.'/js/jquery.t-countdown.js', array ('jquery'), '1.5.10', 'true');
139
  wp_enqueue_script('countdown-script');
140
 
141
  //force load styles
js/jquery.t-countdown.js CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- * T- Countdown v1.5.9
3
  * http://plugins.twinpictures.de/plugins/t-minus-countdown/
4
  *
5
  * Copyright 2017, Twinpictures
@@ -29,14 +29,16 @@
29
  config = {};
30
  $.extend(config, options);
31
  tminusTargetTime = this.setTminustminusTargetTime(config);
32
- //set diffSecs and launch the countdown once the ajax for now loads
33
- diffSecs = this.setTminusDiffSecs(tminusTargetTime, options.targetDate.localtime);
 
 
 
 
34
  before = new Date();
35
  $.data($(this)[0], 'before', before);
36
  $.data($(this)[0], 'status', 'play');
37
  $.data($(this)[0], 'id', config.id);
38
- style = config.style;
39
- $.data($(this)[0], 'style', config.style);
40
 
41
  if ( config.event_id ) {
42
  $.data($(this)[0], 'event_id', config.event_id);
@@ -68,6 +70,10 @@
68
  $.data($(this)[0], 'omitWeeks', config.omitWeeks);
69
  }
70
  $('#' + $(this).attr('id') + ' .' + style + '-digit').html('<div class="tc_top"></div><div class="tc_bottom"></div>');
 
 
 
 
71
  return this;
72
  };
73
 
@@ -80,26 +86,6 @@
80
  this.doTminusCountDown($(this).attr('id'),$.data(this[0], 'diffSecs'), 500);
81
  };
82
 
83
- $.fn.setTminusDiffSecs = function (tminusTargetTime, backuptime) {
84
- var diffSecs = null;
85
- $.ajax({
86
- url: tminusnow,
87
- type : "post",
88
- dataType : "json",
89
- success: $.proxy(function( data ) {
90
- //console.log(data['now']);
91
- nowTime = new Date(data['now']);
92
- diffSecs = Math.floor((tminusTargetTime.valueOf()-nowTime.valueOf())/1000);
93
- $(this).doTminusCountDown($(this).attr('id'), diffSecs, 500);
94
- }, this),
95
- error: $.proxy(function( request, status, error ) {
96
- nowTime = new Date(backuptime);
97
- diffSecs = Math.floor((tminusTargetTime.valueOf()-nowTime.valueOf())/1000);
98
- $(this).doTminusCountDown($(this).attr('id'), diffSecs, 500);
99
- }, this)
100
- });
101
- };
102
-
103
  $.fn.setTminustminusTargetTime = function (options) {
104
  var tminusTargetTime = new Date();
105
  if (options.targetDate){
@@ -137,7 +123,7 @@
137
  days = Math.floor(Math.abs(diffSecs/60/60/24)%7);
138
  weeks = Math.floor(Math.abs(diffSecs/60/60/24/7));
139
  }
140
- style = $.data($this[0], 'style');
141
  $this.dashTminusChangeTo(id, style + '-seconds_dash', secs, duration ? duration : 500);
142
  $this.dashTminusChangeTo(id, style + '-minutes_dash', mins, duration ? duration : 1000);
143
  $this.dashTminusChangeTo(id, style + '-hours_dash', hours, duration ? duration : 1000);
@@ -153,7 +139,6 @@
153
  $this.checkEvent(id, diffSecs);
154
  }
155
 
156
-
157
  if (diffSecs > 0 || $.data($this[0], 'launchtarget') == 'countup'){
158
  if($.data($this[0], 'status') == 'play'){
159
  var delta = 0;
@@ -169,6 +154,7 @@
169
  }
170
  before = new Date();
171
  $.data($this[0], 'before', before);
 
172
  t = setTimeout( function() {
173
  $this.doTminusCountDown(id, diffSecs-delta);
174
  } , 1000);
1
  /*
2
+ * T- Countdown v1.5.10
3
  * http://plugins.twinpictures.de/plugins/t-minus-countdown/
4
  *
5
  * Copyright 2017, Twinpictures
29
  config = {};
30
  $.extend(config, options);
31
  tminusTargetTime = this.setTminustminusTargetTime(config);
32
+ var nowobj = $.parseJSON( tminusnow );
33
+ nowTime = new Date(nowobj.now);
34
+
35
+ style = config.style;
36
+ $.data($(this)[0], 'style', config.style);
37
+
38
  before = new Date();
39
  $.data($(this)[0], 'before', before);
40
  $.data($(this)[0], 'status', 'play');
41
  $.data($(this)[0], 'id', config.id);
 
 
42
 
43
  if ( config.event_id ) {
44
  $.data($(this)[0], 'event_id', config.event_id);
70
  $.data($(this)[0], 'omitWeeks', config.omitWeeks);
71
  }
72
  $('#' + $(this).attr('id') + ' .' + style + '-digit').html('<div class="tc_top"></div><div class="tc_bottom"></div>');
73
+
74
+ diffSecs = Math.floor((tminusTargetTime.valueOf()-nowTime.valueOf())/1000);
75
+ $(this).doTminusCountDown($(this).attr('id'), diffSecs, 500);
76
+
77
  return this;
78
  };
79
 
86
  this.doTminusCountDown($(this).attr('id'),$.data(this[0], 'diffSecs'), 500);
87
  };
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  $.fn.setTminustminusTargetTime = function (options) {
90
  var tminusTargetTime = new Date();
91
  if (options.targetDate){
123
  days = Math.floor(Math.abs(diffSecs/60/60/24)%7);
124
  weeks = Math.floor(Math.abs(diffSecs/60/60/24/7));
125
  }
126
+ style = $.data($(this)[0], 'style');
127
  $this.dashTminusChangeTo(id, style + '-seconds_dash', secs, duration ? duration : 500);
128
  $this.dashTminusChangeTo(id, style + '-minutes_dash', mins, duration ? duration : 1000);
129
  $this.dashTminusChangeTo(id, style + '-hours_dash', hours, duration ? duration : 1000);
139
  $this.checkEvent(id, diffSecs);
140
  }
141
 
 
142
  if (diffSecs > 0 || $.data($this[0], 'launchtarget') == 'countup'){
143
  if($.data($this[0], 'status') == 'play'){
144
  var delta = 0;
154
  }
155
  before = new Date();
156
  $.data($this[0], 'before', before);
157
+ style = $.data($this[0], 'style');
158
  t = setTimeout( function() {
159
  $this.doTminusCountDown(id, diffSecs-delta);
160
  } , 1000);
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: twinpictures, baden03
4
  Donate link: https://plugins.twinpictures.de/plugins/t-minus-countdown/
5
  Tags: countdown, timer, clock, ticker, widget, event, counter, count down, twinpictures, t minus, t-minus, t(-), t(-) countdown, t-countdown, t (-) countdown, plugin-oven, pluginoven, G2, spaceBros, littlewebtings, jQuery, javascript
6
  Requires at least: 4.0
7
- Tested up to: 4.7.3
8
- Stable tag: 2.3.16
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -64,6 +64,12 @@ Ah yes! <a href='https://twitter.com/#!/twinpictures'>@Twinpictures</a> is on th
64
  1. Plugin options page with Custom CSS section
65
 
66
  == Changelog ==
 
 
 
 
 
 
67
  = 2.3.16 =
68
  * no longer requires now.php
69
  * widget now accepts only expected values
@@ -297,4 +303,4 @@ Ah yes! <a href='https://twitter.com/#!/twinpictures'>@Twinpictures</a> is on th
297
  * The plugin came to be.
298
 
299
  == Upgrade Notice ==
300
- no longer requires now.php. widget now accepts only expected values. all links now https. plugin has been fully tested with WordPress 4.7.3
4
  Donate link: https://plugins.twinpictures.de/plugins/t-minus-countdown/
5
  Tags: countdown, timer, clock, ticker, widget, event, counter, count down, twinpictures, t minus, t-minus, t(-), t(-) countdown, t-countdown, t (-) countdown, plugin-oven, pluginoven, G2, spaceBros, littlewebtings, jQuery, javascript
6
  Requires at least: 4.0
7
+ Tested up to: 4.8
8
+ Stable tag: 2.3.17
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
64
  1. Plugin options page with Custom CSS section
65
 
66
  == Changelog ==
67
+
68
+ = 2.3.17 =
69
+ * scripts do not load on customize.php page
70
+ * removed now.php from js
71
+ * fully tested with WordPress 4.8
72
+
73
  = 2.3.16 =
74
  * no longer requires now.php
75
  * widget now accepts only expected values
303
  * The plugin came to be.
304
 
305
  == Upgrade Notice ==
306
+ scripts do not load on customize.php page & removed now.php from js. fully tested with WordPress 4.8