Countdown, Coming Soon – Countdown & Clock - Version 1.3.0

Version Description

  • Fixed possibility multiple timer on the same page
Download this release

Release Info

Developer adamskaat
Plugin Icon 128x128 Countdown, Coming Soon – Countdown & Clock
Version 1.3.0
Comparing to
See all releases

Code changes from version 1.2.9 to 1.3.0

assets/js/ycdTimer.js CHANGED
@@ -41,6 +41,14 @@ YcdTimer.prototype.getSettings = function() {
41
  return this.settings;
42
  };
43
 
 
 
 
 
 
 
 
 
44
  function onShortTimer() {
45
  stopTimer();
46
 
@@ -161,26 +169,27 @@ YcdTimer.prototype.renderTimer = function() {
161
  };
162
 
163
  YcdTimer.prototype.animateTime = function(remainingHours, remainingMinutes, remainingSeconds) {
 
164
  /* position */
165
- var hoursValueTarget = jQuery('#ycdHoursValue');
166
- var minutesValueTarget = jQuery('#ycdMinutesValue');
167
- var secondsValueTarget = jQuery('#ycdSecondsValue');
168
 
169
  hoursValueTarget.css('top', '0em');
170
  minutesValueTarget.css('top', '0em');
171
  secondsValueTarget.css('top', '0em');
172
 
173
- var hoursNext = jQuery('#ycdHoursNext');
174
- var minutesNext = jQuery('#ycdMinutesNext');
175
- var secondsNext = jQuery('#ycdSecondsNext');
176
 
177
  hoursNext.css('top', '0em');
178
  minutesNext.css('top', '0em');
179
  secondsNext.css('top', '0em');
180
 
181
- var oldHoursString = hoursNext.text();
182
- var oldMinutesString = minutesNext.text();
183
- var oldSecondsString = secondsNext.text();
184
 
185
  var hoursString = this.formatTime(remainingHours);
186
  var minutesString = this.formatTime(remainingMinutes);
@@ -197,17 +206,17 @@ YcdTimer.prototype.animateTime = function(remainingHours, remainingMinutes, rema
197
  /* set and animate */
198
  if(oldHoursString !== hoursString) {
199
  hoursValueTarget.animate({top: '-=1em'});
200
- jQuery('#ycdHoursNext').animate({top: '-=1em'});
201
  }
202
 
203
  if(oldMinutesString !== minutesString) {
204
  minutesValueTarget.animate({top: '-=1em'});
205
- jQuery('#ycdMinutesNext').animate({top: '-=1em'});
206
  }
207
 
208
  if(oldSecondsString !== secondsString) {
209
  secondsValueTarget.animate({top: '-=1em'});
210
- jQuery('#ycdSecondsNext').animate({top: '-=1em'});
211
  }
212
  };
213
 
@@ -399,11 +408,17 @@ YcdTimer.prototype.changeTime = function() {
399
 
400
  jQuery(document).ready(function() {
401
  window.YcdTimersInstance = [];
 
402
  jQuery('.ycd-timer-time').each(function() {
403
  var options = jQuery(this).data('options');
404
  var id = jQuery(this).data('id');
 
 
 
 
405
  var timerObj = new YcdTimer();
406
  timerObj.setSettings(options);
 
407
  timerObj.init();
408
  window.YcdTimersInstance.push(timerObj);
409
  });
41
  return this.settings;
42
  };
43
 
44
+ YcdTimer.prototype.setId = function(id) {
45
+ this.id = id;
46
+ };
47
+
48
+ YcdTimer.prototype.getId = function() {
49
+ return this.id;
50
+ };
51
+
52
  function onShortTimer() {
53
  stopTimer();
54
 
169
  };
170
 
171
  YcdTimer.prototype.animateTime = function(remainingHours, remainingMinutes, remainingSeconds) {
172
+ var id = this.getId();
173
  /* position */
174
+ var hoursValueTarget = jQuery('.ycd-hours-value-'+id);
175
+ var minutesValueTarget = jQuery('.ycd-minutes-value-'+id);
176
+ var secondsValueTarget = jQuery('.ycd-seconds-value-'+id);
177
 
178
  hoursValueTarget.css('top', '0em');
179
  minutesValueTarget.css('top', '0em');
180
  secondsValueTarget.css('top', '0em');
181
 
182
+ var hoursNext = jQuery('.ycd-hours-next-value-'+id);
183
+ var minutesNext = jQuery('.ycd-minutes-next-value-'+id);
184
+ var secondsNext = jQuery('.ycd-seconds-next-value-'+id);
185
 
186
  hoursNext.css('top', '0em');
187
  minutesNext.css('top', '0em');
188
  secondsNext.css('top', '0em');
189
 
190
+ var oldHoursString = hoursNext.first().text();
191
+ var oldMinutesString = minutesNext.first().text();
192
+ var oldSecondsString = secondsNext.first().text();
193
 
194
  var hoursString = this.formatTime(remainingHours);
195
  var minutesString = this.formatTime(remainingMinutes);
206
  /* set and animate */
207
  if(oldHoursString !== hoursString) {
208
  hoursValueTarget.animate({top: '-=1em'});
209
+ jQuery('.ycd-hours-next-value-'+id).animate({top: '-=1em'});
210
  }
211
 
212
  if(oldMinutesString !== minutesString) {
213
  minutesValueTarget.animate({top: '-=1em'});
214
+ jQuery('.ycd-miuntes-next-value-'+id).animate({top: '-=1em'});
215
  }
216
 
217
  if(oldSecondsString !== secondsString) {
218
  secondsValueTarget.animate({top: '-=1em'});
219
+ jQuery('.ycd-seconds-next-value-'+id).animate({top: '-=1em'});
220
  }
221
  };
222
 
408
 
409
  jQuery(document).ready(function() {
410
  window.YcdTimersInstance = [];
411
+ var renderIds = [];
412
  jQuery('.ycd-timer-time').each(function() {
413
  var options = jQuery(this).data('options');
414
  var id = jQuery(this).data('id');
415
+ if (renderIds.indexOf(id) != '-1') {
416
+ return true;
417
+ }
418
+ renderIds.push(id);
419
  var timerObj = new YcdTimer();
420
  timerObj.setSettings(options);
421
+ timerObj.setId(id);
422
  timerObj.init();
423
  window.YcdTimersInstance.push(timerObj);
424
  });
assets/views/preview/index.php ADDED
File without changes
assets/views/settings.php CHANGED
@@ -2,7 +2,8 @@
2
  use ycd\AdminHelper;
3
  use ycd\HelperFunctions;
4
  $defaultData = AdminHelper::defaultData();
5
- $userSavedRoles = '';
 
6
  ?>
7
  <div class="ycd-bootstrap-wrapper ycd-settings-wrapper">
8
  <div class="row">
2
  use ycd\AdminHelper;
3
  use ycd\HelperFunctions;
4
  $defaultData = AdminHelper::defaultData();
5
+ $userSavedRoles = get_option('ycd-user-roles');
6
+ $dontDeleteData = (get_option('ycd-delete-data') ? 'checked': '');
7
  ?>
8
  <div class="ycd-bootstrap-wrapper ycd-settings-wrapper">
9
  <div class="row">
classes/countdown/TimerCountdown.php CHANGED
@@ -117,10 +117,10 @@ class TimerCountdown extends Countdown {
117
  <div class="ycd-countdown-wrapper ycd-timer-content-wrapper-<?php echo esc_attr($id); ?>">
118
  <div class="ycd-timer-time ycd-timer-container ycd-timer-wrapper-<?php echo esc_attr($id); ?>" data-options='<?php echo $options; ?>' data-id="<?php echo esc_attr($id); ?>">
119
  <div class="timer-time-set ycd-timer-box" id="currentTime">
120
- <span id="ycdHoursValue">00</span><span>:</span><span id="ycdMinutesValue">00</span><span>:</span><span id="ycdSecondsValue">00</span>
121
  </div>
122
  <div class="timer-time-set ycd-timer-box" id="nextTime">
123
- <span id="ycdHoursNext">00</span><span>:</span><span id="ycdMinutesNext">00</span><span>:</span><span id="ycdSecondsNext">00</span>
124
  </div>
125
  </div>
126
  <?php echo $this->renderSubscriptionForm(); ?>
117
  <div class="ycd-countdown-wrapper ycd-timer-content-wrapper-<?php echo esc_attr($id); ?>">
118
  <div class="ycd-timer-time ycd-timer-container ycd-timer-wrapper-<?php echo esc_attr($id); ?>" data-options='<?php echo $options; ?>' data-id="<?php echo esc_attr($id); ?>">
119
  <div class="timer-time-set ycd-timer-box" id="currentTime">
120
+ <span id="ycdHoursValue" class="ycd-hours-value-<?php echo esc_attr($id); ?>">00</span><span>:</span><span id="ycdMinutesValue" class="ycd-minutes-value-<?php echo esc_attr($id); ?>">00</span><span>:</span><span id="ycdSecondsValue" class="ycd-seconds-value-<?php echo esc_attr($id); ?>">00</span>
121
  </div>
122
  <div class="timer-time-set ycd-timer-box" id="nextTime">
123
+ <span id="ycdHoursNext"class="ycd-hours-next-value-<?php echo esc_attr($id); ?>">00</span><span>:</span><span id="ycdMinutesNext" class="ycd-minutes-next-value-<?php echo esc_attr($id); ?>">00</span><span>:</span><span id="ycdSecondsNext" class="ycd-seconds-next-value-<?php echo esc_attr($id); ?>">00</span>
124
  </div>
125
  </div>
126
  <?php echo $this->renderSubscriptionForm(); ?>
config/config.php CHANGED
@@ -45,7 +45,7 @@ class YcdCountdownConfig {
45
  self::addDefine('YCD_CRON_REPEAT_INTERVAL', 1);
46
  self::addDefine('YCD_TABLE_LIMIT', 15);
47
  self::addDefine('YCD_VERSION', 1.3);
48
- self::addDefine('YCD_VERSION_PRO', 1.17);
49
  self::addDefine('YCD_FREE_VERSION', 1);
50
  self::addDefine('YCD_SILVER_VERSION', 2);
51
  self::addDefine('YCD_GOLD_VERSION', 3);
45
  self::addDefine('YCD_CRON_REPEAT_INTERVAL', 1);
46
  self::addDefine('YCD_TABLE_LIMIT', 15);
47
  self::addDefine('YCD_VERSION', 1.3);
48
+ self::addDefine('YCD_VERSION_PRO', 1.18);
49
  self::addDefine('YCD_FREE_VERSION', 1);
50
  self::addDefine('YCD_SILVER_VERSION', 2);
51
  self::addDefine('YCD_GOLD_VERSION', 3);
countdown-builder.php CHANGED
@@ -2,9 +2,9 @@
2
  /**
3
  * Plugin Name: Countdown builder
4
  * Description: The best countdown plugin
5
- * Version: 1.2.9
6
  * Author: Adam Skaat
7
- * Author URI: https://edmonsoft.com/countdown/
8
  * License: GPLv2
9
  */
10
 
2
  /**
3
  * Plugin Name: Countdown builder
4
  * Description: The best countdown plugin
5
+ * Version: 1.3.0
6
  * Author: Adam Skaat
7
+ * Author URI: https://edmonsoft.com/countdown
8
  * License: GPLv2
9
  */
10
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: adamskaat
3
  Tags: countdown, timer, countdown timer
4
  Requires at least: 3.8
5
- Tested up to: 4.9.8
6
- Stable tag: 1.2.9
7
  Requires PHP: 5.3
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -33,6 +33,9 @@ Coming soon
33
 
34
  == Changelog ==
35
 
 
 
 
36
  = 1.2.9 =
37
  * Newsletter (new)
38
  * Countdown number Font Size (new)
2
  Contributors: adamskaat
3
  Tags: countdown, timer, countdown timer
4
  Requires at least: 3.8
5
+ Tested up to: 5.0
6
+ Stable tag: 1.3.0
7
  Requires PHP: 5.3
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
33
 
34
  == Changelog ==
35
 
36
+ = 1.3.0 =
37
+ * Fixed possibility multiple timer on the same page
38
+
39
  = 1.2.9 =
40
  * Newsletter (new)
41
  * Countdown number Font Size (new)