T(-) Countdown - Version 2.2.4

Version Description

  • Requires WordPress 3.3 or newer
  • Added jQuery datepicker for selecting target date
  • Added new 'Count Up' feature
Download this release

Release Info

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

Code changes from version 2.2.3 to 2.2.4

countdown-timer.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: T(-) Countdown
4
  Plugin URI: http://plugins.twinpictures.de/plugins/t-minus-countdown/
5
  Description: Display and configure multiple T(-) Countdown timers using a shortcode or sidebar widget.
6
- Version: 2.2.3
7
  Author: twinpictures, baden03
8
  Author URI: http://www.twinpictures.de/
9
  License: GPL2
@@ -32,7 +32,7 @@ function countdown_scripts(){
32
  //delete the old style system
33
  delete_option( 't-minus_styles' );
34
  //add version check
35
- add_option('t-minus_version', '2.2.2');
36
  }
37
 
38
  $styles_arr = array("TIE-fighter","c-3po","c-3po-mini","carbonite","carbonlite","darth","jedi");
@@ -41,7 +41,7 @@ function countdown_scripts(){
41
  wp_enqueue_script('jquery');
42
  if (is_admin()){
43
  //jquery admin stuff
44
- wp_register_script('tminus-admin-script', $plugin_url.'/js/jquery.collapse.js', array ('jquery'), '1.0' );
45
  wp_enqueue_script('tminus-admin-script');
46
 
47
  wp_register_script('livequery-script', $plugin_url.'/js/jquery.livequery.min.js', array ('jquery'), '1.0' );
@@ -49,10 +49,15 @@ function countdown_scripts(){
49
 
50
  wp_register_style('colapse-admin-css', $plugin_url.'/admin/collapse-style.css', array (), '1.0' );
51
  wp_enqueue_style('colapse-admin-css');
 
 
 
 
 
52
  }
53
  else{
54
  //lwtCountdown script
55
- wp_register_script('countdown-script', $plugin_url.'/js/jquery.t-countdown-1.0.js', array ('jquery'), '1.0' );
56
  wp_enqueue_script('countdown-script');
57
 
58
  //register all countdown styles for enqueue-as-needed
@@ -110,6 +115,8 @@ class CountDownTimer extends WP_Widget {
110
  $day = empty($instance['day']) ? 20 : apply_filters('widget_day', $instance['day']);
111
  $month = empty($instance['month']) ? 12 : apply_filters('widget_month', $instance['month']);
112
  $year = empty($instance['year']) ? 2012 : apply_filters('widget_year', $instance['year']);
 
 
113
  $hour = empty($instance['hour']) ? 20 : apply_filters('widget_hour', $instance['hour']);
114
  $min = empty($instance['min']) ? 12 : apply_filters('widget_min', $instance['min']);
115
  $sec = empty($instance['sec']) ? 20 : apply_filters('widget_sec', $instance['sec']);
@@ -126,6 +133,7 @@ class CountDownTimer extends WP_Widget {
126
  $now = time() + ( get_option( 'gmt_offset' ) * 3600);
127
 
128
  //target
 
129
  $target = mktime(
130
  $hour,
131
  $min,
@@ -134,6 +142,9 @@ class CountDownTimer extends WP_Widget {
134
  $day,
135
  $year
136
  );
 
 
 
137
 
138
  //difference in seconds
139
  $diffSecs = $target - $now;
@@ -272,13 +283,16 @@ class CountDownTimer extends WP_Widget {
272
  else if($launchtarget == "Entire Widget"){
273
  $launchdiv = "widget";
274
  }
 
 
 
275
 
276
  if($jsplacement == "footer"){
277
  $add_my_script[$args['widget_id']] = array(
278
  'id' => $args['widget_id'],
279
- 'day' => $day,
280
- 'month' => $month,
281
- 'year' => $year,
282
  'hour' => $hour,
283
  'min' => $min,
284
  'sec' => $sec,
@@ -297,15 +311,16 @@ class CountDownTimer extends WP_Widget {
297
  jQuery(document).ready(function() {
298
  jQuery('#<?php echo $args['widget_id']; ?>-dashboard').countDown({
299
  targetDate: {
300
- 'day': <?php echo $day; ?>,
301
- 'month': <?php echo $month; ?>,
302
- 'year': <?php echo $year; ?>,
303
  'hour': <?php echo $hour; ?>,
304
  'min': <?php echo $min; ?>,
305
  'sec': <?php echo $sec; ?>,
306
  'localtime': '<?php echo $t; ?>'
307
  },
308
  style: '<?php echo $style; ?>',
 
309
  omitWeeks: <?php echo $omitweeks;
310
  if($launchhtml){
311
  echo ", onComplete: function() { jQuery('#".$args['widget_id']."-".$launchdiv."').html('".do_shortcode($launchhtml)."'); }";
@@ -326,74 +341,37 @@ class CountDownTimer extends WP_Widget {
326
  update_option('rockstar', $instance['isrockstar']);
327
  }
328
 
329
- //update the styles
330
- //$style_arr = get_option('t-minus_styles');
331
- //$style_arr[$instance['style']] = $instance['style'];
332
- //update_option('t-minus_styles', $style_arr);
333
-
334
  return array_map('mysql_real_escape_string', $instance);
335
  }
336
 
337
  /** Form */
338
  function form($instance) {
339
- $title = stripslashes($instance['title']);
340
- $day = esc_attr($instance['day']);
341
- if(!$day){
342
- $day = 20;
343
- }
344
- else if($day > 31){
345
  $day = 31;
346
  }
347
- //apply_filters('widget_day', $day);
348
-
349
- $month = esc_attr($instance['month']);
350
- if(!$month){
351
- $month = 12;
352
- }
353
- else if($month > 12){
354
  $month = 12;
355
  }
356
-
357
- $year = esc_attr($instance['year']);
358
- if(!$year){
359
- $year = 2012;
360
- }
361
-
362
- $hour = esc_attr($instance['hour']);
363
- if(!$hour){
364
- $hour = 20;
365
- }
366
- else if($hour > 23){
367
  $hour = 23;
368
  }
369
-
370
- $min = esc_attr($instance['min']);
371
- if(!$min){
372
- $min = 12;
373
- }
374
- else if($min > 59){
375
  $min = 59;
376
  }
377
-
378
- $sec = esc_attr($instance['sec']);
379
- if(!$sec){
380
- $sec = 20;
381
- }
382
- else if($sec > 59){
383
  $sec = 59;
384
  }
385
- $omitweeks = esc_attr($instance['omitweeks']);
386
- if(!$omitweeks){
387
- $omitweeks = 'false';
388
- }
389
- $style = esc_attr($instance['style']);
390
- if(!$style){
391
- $style = 'jedi';
392
- }
393
- $jsplacement = esc_attr($instance['jsplacement']);
394
- if(!$jsplacement){
395
- $jsplacement = 'footer';
396
- }
397
 
398
  $weektitle = empty($instance['weektitle']) ? 'weeks' : apply_filters('widget_weektitle', stripslashes($instance['weektitle']));
399
  $daytitle = empty($instance['daytitle']) ? 'days' : apply_filters('widget_daytitle', stripslashes($instance['daytitle']));
@@ -412,7 +390,7 @@ class CountDownTimer extends WP_Widget {
412
  }
413
  ?>
414
  <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
415
- <p><label for="<?php echo $this->get_field_id('day'); ?>"><?php _e('Target Date (DD-MM-YYYY):'); ?></label><br/><input style="width: 30px;" id="<?php echo $this->get_field_id('day'); ?>" name="<?php echo $this->get_field_name('day'); ?>" type="text" value="<?php echo $day; ?>" />-<input style="width: 30px;" id="<?php echo $this->get_field_id('month'); ?>" name="<?php echo $this->get_field_name('month'); ?>" type="text" value="<?php echo $month; ?>" />-<input style="width: 40px;" id="<?php echo $this->get_field_id('year'); ?>" name="<?php echo $this->get_field_name('year'); ?>" type="text" value="<?php echo $year; ?>" /></p>
416
  <p><label for="<?php echo $this->get_field_id('hour'); ?>"><?php _e('Target Time (HH:MM:SS):'); ?></label><br/><input style="width: 30px;" id="<?php echo $this->get_field_id('hour'); ?>" name="<?php echo $this->get_field_name('hour'); ?>" type="text" value="<?php echo $hour; ?>" />:<input style="width: 30px;" id="<?php echo $this->get_field_id('min'); ?>" name="<?php echo $this->get_field_name('min'); ?>" type="text" value="<?php echo $min; ?>" />:<input style="width: 30px;" id="<?php echo $this->get_field_id('sec'); ?>" name="<?php echo $this->get_field_name('sec'); ?>" type="text" value="<?php echo $sec; ?>" /></p>
417
  <?php
418
  //Omit Week Slector
@@ -479,7 +457,7 @@ class CountDownTimer extends WP_Widget {
479
  <p><label for="<?php echo $this->get_field_id('launchhtml'); ?>"><?php _e('Launch Event HTML:'); ?></label> <textarea id="<?php echo $this->get_field_id('launchhtml'); ?>" name="<?php echo $this->get_field_name('launchhtml'); ?>"><?php echo $launchhtml; ?></textarea></p>
480
  <p><?php _e('Launch Target:'); ?> <select name="<?php echo $this->get_field_name('launchtarget'); ?>" id="<?php echo $this->get_field_name('launchtarget'); ?>">
481
  <?php
482
- $target_arr = array('Above Countdown', 'Below Countdown', 'Entire Widget');
483
  foreach($target_arr as $target_name){
484
  $selected = "";
485
  if($launchtarget == $target_name){
@@ -547,6 +525,7 @@ function print_my_script() {
547
  'localtime': '<?php echo $script['localtime']; ?>'
548
  },
549
  style: '<?php echo $script['style']; ?>',
 
550
  omitWeeks: <?php echo $script['omitweeks'];
551
  if($script['content']){
552
  echo ", onComplete: function() {
@@ -757,6 +736,7 @@ function tminuscountdown($atts, $content=null) {
757
  'localtime': '<?php echo $t; ?>'
758
  },
759
  style: '<?php echo $style; ?>',
 
760
  omitWeeks: <?php echo $omitweeks;
761
  if($content){
762
  echo ", onComplete: function() {
3
  Plugin Name: T(-) Countdown
4
  Plugin URI: http://plugins.twinpictures.de/plugins/t-minus-countdown/
5
  Description: Display and configure multiple T(-) Countdown timers using a shortcode or sidebar widget.
6
+ Version: 2.2.4
7
  Author: twinpictures, baden03
8
  Author URI: http://www.twinpictures.de/
9
  License: GPL2
32
  //delete the old style system
33
  delete_option( 't-minus_styles' );
34
  //add version check
35
+ add_option('t-minus_version', '2.2.4');
36
  }
37
 
38
  $styles_arr = array("TIE-fighter","c-3po","c-3po-mini","carbonite","carbonlite","darth","jedi");
41
  wp_enqueue_script('jquery');
42
  if (is_admin()){
43
  //jquery admin stuff
44
+ wp_register_script('tminus-admin-script', $plugin_url.'/js/jquery.collapse.min.js', array ('jquery'), '1.1' );
45
  wp_enqueue_script('tminus-admin-script');
46
 
47
  wp_register_script('livequery-script', $plugin_url.'/js/jquery.livequery.min.js', array ('jquery'), '1.0' );
49
 
50
  wp_register_style('colapse-admin-css', $plugin_url.'/admin/collapse-style.css', array (), '1.0' );
51
  wp_enqueue_style('colapse-admin-css');
52
+
53
+ wp_enqueue_script( 'jquery-ui-datepicker' );
54
+
55
+ wp_register_style('jquery-ui-css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css', array (), '1.8.23' );
56
+ wp_enqueue_style('jquery-ui-css');
57
  }
58
  else{
59
  //lwtCountdown script
60
+ wp_register_script('countdown-script', $plugin_url.'/js/jquery.t-countdown.min.js', array ('jquery'), '1.1' );
61
  wp_enqueue_script('countdown-script');
62
 
63
  //register all countdown styles for enqueue-as-needed
115
  $day = empty($instance['day']) ? 20 : apply_filters('widget_day', $instance['day']);
116
  $month = empty($instance['month']) ? 12 : apply_filters('widget_month', $instance['month']);
117
  $year = empty($instance['year']) ? 2012 : apply_filters('widget_year', $instance['year']);
118
+
119
+ $date = empty($instance['date']) ? $year.'-'.$month.'-'.$day : apply_filters('widget_date', $instance['date']);
120
  $hour = empty($instance['hour']) ? 20 : apply_filters('widget_hour', $instance['hour']);
121
  $min = empty($instance['min']) ? 12 : apply_filters('widget_min', $instance['min']);
122
  $sec = empty($instance['sec']) ? 20 : apply_filters('widget_sec', $instance['sec']);
133
  $now = time() + ( get_option( 'gmt_offset' ) * 3600);
134
 
135
  //target
136
+ /*
137
  $target = mktime(
138
  $hour,
139
  $min,
142
  $day,
143
  $year
144
  );
145
+ */
146
+
147
+ $target = strtotime( $date.' '.$hour.':'.$min.':'.$sec );
148
 
149
  //difference in seconds
150
  $diffSecs = $target - $now;
283
  else if($launchtarget == "Entire Widget"){
284
  $launchdiv = "widget";
285
  }
286
+ else if($launchtarget == "Count Up"){
287
+ $launchdiv = "countup";
288
+ }
289
 
290
  if($jsplacement == "footer"){
291
  $add_my_script[$args['widget_id']] = array(
292
  'id' => $args['widget_id'],
293
+ 'day' => date('d', $target),
294
+ 'month' => date('m', $target),
295
+ 'year' => date('Y', $target),
296
  'hour' => $hour,
297
  'min' => $min,
298
  'sec' => $sec,
311
  jQuery(document).ready(function() {
312
  jQuery('#<?php echo $args['widget_id']; ?>-dashboard').countDown({
313
  targetDate: {
314
+ 'day': <?php echo date('d', $target); ?>,
315
+ 'month': <?php echo date('m', $target); ?>,
316
+ 'year': <?php echo date('Y', $target); ?>,
317
  'hour': <?php echo $hour; ?>,
318
  'min': <?php echo $min; ?>,
319
  'sec': <?php echo $sec; ?>,
320
  'localtime': '<?php echo $t; ?>'
321
  },
322
  style: '<?php echo $style; ?>',
323
+ launchtarget: <?php echo $launchdiv; ?>',
324
  omitWeeks: <?php echo $omitweeks;
325
  if($launchhtml){
326
  echo ", onComplete: function() { jQuery('#".$args['widget_id']."-".$launchdiv."').html('".do_shortcode($launchhtml)."'); }";
341
  update_option('rockstar', $instance['isrockstar']);
342
  }
343
 
 
 
 
 
 
344
  return array_map('mysql_real_escape_string', $instance);
345
  }
346
 
347
  /** Form */
348
  function form($instance) {
349
+ $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
350
+ $day = empty($instance['day']) ? 12 : apply_filters('widget_day', $instance['day']);
351
+ if($day > 31){
 
 
 
352
  $day = 31;
353
  }
354
+ $month = empty($instance['month']) ? 12 : apply_filters('widget_month', $instance['month']);
355
+ if($month > 12){
 
 
 
 
 
356
  $month = 12;
357
  }
358
+ $year = empty($instance['year']) ? 2012 : apply_filters('widget_year', $instance['year']);
359
+ $date = empty($instance['date']) ? $year.'-'.$month.'-'.$day : apply_filters('widget_date', $instance['date']);
360
+ $hour = empty($instance['hour']) ? 12 : apply_filters('widget_hour', $instance['hour']);
361
+ if($hour > 23){
 
 
 
 
 
 
 
362
  $hour = 23;
363
  }
364
+ $min = empty($instance['min']) ? 12 : apply_filters('widget_min', $instance['min']);
365
+ if($min > 59){
 
 
 
 
366
  $min = 59;
367
  }
368
+ $sec = empty($instance['sec']) ? 12 : apply_filters('widget_sec', $instance['sec']);
369
+ if($sec > 59){
 
 
 
 
370
  $sec = 59;
371
  }
372
+ $omitweeks = empty($instance['omitweeks']) ? 'false' : apply_filters('widget_omitweeks', $instance['omitweeks']);
373
+ $style = empty($instance['style']) ? 'jedi' : apply_filters('widget_style', $instance['style']);
374
+ $jsplacement = empty($instance['jsplacement']) ? 'footer' : apply_filters('widget_jsplacement', $instance['jsplacement']);
 
 
 
 
 
 
 
 
 
375
 
376
  $weektitle = empty($instance['weektitle']) ? 'weeks' : apply_filters('widget_weektitle', stripslashes($instance['weektitle']));
377
  $daytitle = empty($instance['daytitle']) ? 'days' : apply_filters('widget_daytitle', stripslashes($instance['daytitle']));
390
  }
391
  ?>
392
  <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
393
+ <p><label for="<?php echo $this->get_field_id('date'); ?>"><?php _e('Target Date:'); ?></label><br/><input style="width: 90px;" id="<?php echo $this->get_field_id('date'); ?>" name="<?php echo $this->get_field_name('date'); ?>" type="text" value="<?php echo $date; ?>" class="t-datepicker"/></p>
394
  <p><label for="<?php echo $this->get_field_id('hour'); ?>"><?php _e('Target Time (HH:MM:SS):'); ?></label><br/><input style="width: 30px;" id="<?php echo $this->get_field_id('hour'); ?>" name="<?php echo $this->get_field_name('hour'); ?>" type="text" value="<?php echo $hour; ?>" />:<input style="width: 30px;" id="<?php echo $this->get_field_id('min'); ?>" name="<?php echo $this->get_field_name('min'); ?>" type="text" value="<?php echo $min; ?>" />:<input style="width: 30px;" id="<?php echo $this->get_field_id('sec'); ?>" name="<?php echo $this->get_field_name('sec'); ?>" type="text" value="<?php echo $sec; ?>" /></p>
395
  <?php
396
  //Omit Week Slector
457
  <p><label for="<?php echo $this->get_field_id('launchhtml'); ?>"><?php _e('Launch Event HTML:'); ?></label> <textarea id="<?php echo $this->get_field_id('launchhtml'); ?>" name="<?php echo $this->get_field_name('launchhtml'); ?>"><?php echo $launchhtml; ?></textarea></p>
458
  <p><?php _e('Launch Target:'); ?> <select name="<?php echo $this->get_field_name('launchtarget'); ?>" id="<?php echo $this->get_field_name('launchtarget'); ?>">
459
  <?php
460
+ $target_arr = array('Above Countdown', 'Below Countdown', 'Entire Widget', 'Count Up');
461
  foreach($target_arr as $target_name){
462
  $selected = "";
463
  if($launchtarget == $target_name){
525
  'localtime': '<?php echo $script['localtime']; ?>'
526
  },
527
  style: '<?php echo $script['style']; ?>',
528
+ launchtarget: '<? echo $script['launchtarget']; ?>',
529
  omitWeeks: <?php echo $script['omitweeks'];
530
  if($script['content']){
531
  echo ", onComplete: function() {
736
  'localtime': '<?php echo $t; ?>'
737
  },
738
  style: '<?php echo $style; ?>',
739
+ launchtarget: '<?php echo $launchtarget; ?>',
740
  omitWeeks: <?php echo $omitweeks;
741
  if($content){
742
  echo ", onComplete: function() {
js/jquery.collapse.js CHANGED
@@ -2,7 +2,7 @@
2
  * jQuery Collapse-O-Matic for T-Minus v1.1
3
  * http://www.twinpictures.de/
4
  *
5
- * Copyright 2011, 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
@@ -25,6 +25,10 @@
25
  */
26
 
27
  jQuery(document).ready(function() {
 
 
 
 
28
  jQuery('.collapseomatic:not(.colomat-close)').each(function(index) {
29
  var thisid = jQuery(this).attr('id');
30
  jQuery('#target-'+thisid).css('display', 'none');
2
  * jQuery Collapse-O-Matic for T-Minus v1.1
3
  * http://www.twinpictures.de/
4
  *
5
+ * Copyright 2012, 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
25
  */
26
 
27
  jQuery(document).ready(function() {
28
+ jQuery('.t-datepicker').datepicker({
29
+ dateFormat : 'yy-mm-dd'
30
+ });
31
+
32
  jQuery('.collapseomatic:not(.colomat-close)').each(function(index) {
33
  var thisid = jQuery(this).attr('id');
34
  jQuery('#target-'+thisid).css('display', 'none');
js/jquery.collapse.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(){jQuery('.t-datepicker').datepicker({dateFormat:'yy-mm-dd'});jQuery('.collapseomatic:not(.colomat-close)').each(function(index){var thisid=jQuery(this).attr('id');jQuery('#target-'+thisid).css('display','none')});jQuery('.collapseomatic').livequery('click',function(event){jQuery(this).toggleClass('colomat-close');var id=jQuery(this).attr('id');jQuery('#target-'+id).slideToggle('fast',function(){})});jQuery('.rockstar').livequery('click',function(event){var id=jQuery(this).attr('id');var key=jQuery(this).val();jQuery('.isrockstar').each(function(){jQuery(this).val('Rockstar Features:')})})});
js/jquery.t-countdown-1.0.js CHANGED
@@ -1,5 +1,5 @@
1
  /*!
2
- * T- Countdown v1.0
3
  * http://plugins.twinpictures.de/plugins/t-minus-countdown/
4
  *
5
  * Copyright 2012, Twinpictures
@@ -34,6 +34,9 @@
34
  $.data($(this)[0], 'status', 'play');
35
  style = config.style;
36
  $.data($(this)[0], 'style', config.style);
 
 
 
37
  if (config.onComplete){
38
  $.data($(this)[0], 'callback', config.onComplete);
39
  }
@@ -78,20 +81,23 @@
78
 
79
  $.fn.doCountDown = function (id, diffSecs, duration) {
80
  $this = $('#' + id);
 
81
  if (diffSecs <= 0){
82
- diffSecs = 0;
83
- $.data($this[0], 'status', 'stop');
 
 
84
  }
85
- secs = diffSecs % 60;
86
- mins = Math.floor(diffSecs/60)%60;
87
- hours = Math.floor(diffSecs/60/60)%24;
88
  if ($.data($this[0], 'omitWeeks') == true){
89
- days = Math.floor(diffSecs/60/60/24);
90
- weeks = Math.floor(diffSecs/60/60/24/7);
91
  }
92
  else{
93
- days = Math.floor(diffSecs/60/60/24)%7;
94
- weeks = Math.floor(diffSecs/60/60/24/7);
95
  }
96
  style = $.data($this[0], 'style');
97
  $this.dashChangeTo(id, style + '-seconds_dash', secs, duration ? duration : 500);
@@ -102,12 +108,12 @@
102
  $this.dashChangeTo(id, style + '-weeks_dash', weeks, duration ? duration : 1000);
103
  $this.dashChangeTo(id, style + '-weeks_trip_dash', weeks, duration ? duration : 1000);
104
  $.data($this[0], 'diffSecs', diffSecs);
105
- if (diffSecs > 0){
106
  if($.data($this[0], 'status') == 'play'){
107
  a = 0;
108
  delay = 1000;
109
  now = new Date();
110
- befor = $.data($this[0], 'before');
111
  elapsedTime = (now.getTime() - before.getTime());
112
  if(elapsedTime >= delay + 1000){
113
  a += Math.floor(1*(elapsedTime/delay));
@@ -119,6 +125,7 @@
119
  $.data($this[0], 'before', before);
120
  e = $this;
121
  t = setTimeout(function() { e.doCountDown(id, diffSecs-a) } , 1000);
 
122
  }
123
  }
124
  else if (cb = $.data($this[0], 'callback')){
1
  /*!
2
+ * T- Countdown v1.1
3
  * http://plugins.twinpictures.de/plugins/t-minus-countdown/
4
  *
5
  * Copyright 2012, Twinpictures
34
  $.data($(this)[0], 'status', 'play');
35
  style = config.style;
36
  $.data($(this)[0], 'style', config.style);
37
+ if( config.launchtarget ) {
38
+ $.data($(this)[0], 'launchtarget', config.launchtarget);
39
+ }
40
  if (config.onComplete){
41
  $.data($(this)[0], 'callback', config.onComplete);
42
  }
81
 
82
  $.fn.doCountDown = function (id, diffSecs, duration) {
83
  $this = $('#' + id);
84
+
85
  if (diffSecs <= 0){
86
+ if( $.data($this[0], 'launchtarget') != 'countup' ){
87
+ diffSecs = 0;
88
+ $.data($this[0], 'status', 'stop');
89
+ }
90
  }
91
+ secs = Math.abs(diffSecs % 60);
92
+ mins = Math.floor(Math.abs(diffSecs/60)%60);
93
+ hours = Math.floor(Math.abs(diffSecs/60/60)%24);
94
  if ($.data($this[0], 'omitWeeks') == true){
95
+ days = Math.floor(Math.abs(diffSecs/60/60/24));
96
+ weeks = Math.floor(Math.abs(diffSecs/60/60/24/7));
97
  }
98
  else{
99
+ days = Math.floor(Math.abs(diffSecs/60/60/24)%7);
100
+ weeks = Math.floor(Math.abs(diffSecs/60/60/24/7));
101
  }
102
  style = $.data($this[0], 'style');
103
  $this.dashChangeTo(id, style + '-seconds_dash', secs, duration ? duration : 500);
108
  $this.dashChangeTo(id, style + '-weeks_dash', weeks, duration ? duration : 1000);
109
  $this.dashChangeTo(id, style + '-weeks_trip_dash', weeks, duration ? duration : 1000);
110
  $.data($this[0], 'diffSecs', diffSecs);
111
+ if (diffSecs > 0 || $.data($this[0], 'launchtarget') == 'countup'){
112
  if($.data($this[0], 'status') == 'play'){
113
  a = 0;
114
  delay = 1000;
115
  now = new Date();
116
+ before = $.data($this[0], 'before');
117
  elapsedTime = (now.getTime() - before.getTime());
118
  if(elapsedTime >= delay + 1000){
119
  a += Math.floor(1*(elapsedTime/delay));
125
  $.data($this[0], 'before', before);
126
  e = $this;
127
  t = setTimeout(function() { e.doCountDown(id, diffSecs-a) } , 1000);
128
+
129
  }
130
  }
131
  else if (cb = $.data($this[0], 'callback')){
js/jquery.t-countdown.min.js ADDED
@@ -0,0 +1 @@
 
1
+ (function($){$.fn.countDown=function(options){config={};$.extend(config,options);diffSecs=this.setCountDown(config);before=new Date();$.data($(this)[0],'before',before);$.data($(this)[0],'status','play');style=config.style;$.data($(this)[0],'style',config.style);if(config.launchtarget){$.data($(this)[0],'launchtarget',config.launchtarget)}if(config.onComplete){$.data($(this)[0],'callback',config.onComplete)}if(config.hangtime){$.data($(this)[0],'hangtime',config.hangtime)}if(config.omitWeeks){$.data($(this)[0],'omitWeeks',config.omitWeeks)}$('#'+$(this).attr('id')+' .'+style+'-digit').html('<div class="top"></div><div class="bottom"></div>');$(this).doCountDown($(this).attr('id'),diffSecs,500);return this};$.fn.stopCountDown=function(){$.data(this[0],'status','stop')};$.fn.startCountDown=function(){$.data(this[0],'status','play');this.doCountDown($(this).attr('id'),$.data(this[0],'diffSecs'),500)};$.fn.setCountDown=function(options){var targetTime=new Date();if(options.targetDate){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':''))}else if(options.targetOffset){targetTime.setFullYear(options.targetOffset.year+targetTime.getFullYear());targetTime.setMonth(options.targetOffset.month+targetTime.getMonth());targetTime.setDate(options.targetOffset.day+targetTime.getDate());targetTime.setHours(options.targetOffset.hour+targetTime.getHours());targetTime.setMinutes(options.targetOffset.min+targetTime.getMinutes());targetTime.setSeconds(options.targetOffset.sec+targetTime.getSeconds())}var nowTime=new Date(options.targetDate.localtime);diffSecs=Math.floor((targetTime.valueOf()-nowTime.valueOf())/1000);$.data(this[0],'diffSecs',diffSecs);return diffSecs};$.fn.doCountDown=function(id,diffSecs,duration){$this=$('#'+id);if(diffSecs<=0){if($.data($this[0],'launchtarget')!='countup'){diffSecs=0;$.data($this[0],'status','stop')}}secs=Math.abs(diffSecs%60);mins=Math.floor(Math.abs(diffSecs/60)%60);hours=Math.floor(Math.abs(diffSecs/60/60)%24);if($.data($this[0],'omitWeeks')==true){days=Math.floor(Math.abs(diffSecs/60/60/24));weeks=Math.floor(Math.abs(diffSecs/60/60/24/7))}else{days=Math.floor(Math.abs(diffSecs/60/60/24)%7);weeks=Math.floor(Math.abs(diffSecs/60/60/24/7))}style=$.data($this[0],'style');$this.dashChangeTo(id,style+'-seconds_dash',secs,duration?duration:500);$this.dashChangeTo(id,style+'-minutes_dash',mins,duration?duration:1000);$this.dashChangeTo(id,style+'-hours_dash',hours,duration?duration:1000);$this.dashChangeTo(id,style+'-days_dash',days,duration?duration:1000);$this.dashChangeTo(id,style+'-days_trip_dash',days,duration?duration:1000);$this.dashChangeTo(id,style+'-weeks_dash',weeks,duration?duration:1000);$this.dashChangeTo(id,style+'-weeks_trip_dash',weeks,duration?duration:1000);$.data($this[0],'diffSecs',diffSecs);if(diffSecs>0||$.data($this[0],'launchtarget')=='countup'){if($.data($this[0],'status')=='play'){a=0;delay=1000;now=new Date();before=$.data($this[0],'before');elapsedTime=(now.getTime()-before.getTime());if(elapsedTime>=delay+1000){a+=Math.floor(1*(elapsedTime/delay))}else{a=1}before=new Date();$.data($this[0],'before',before);e=$this;t=setTimeout(function(){e.doCountDown(id,diffSecs-a)},1000)}}else if(cb=$.data($this[0],'callback')){if($.data($this[0],'hangtime')){}$.data($this[0],'callback')()}};$.fn.dashChangeTo=function(id,dash,n,duration){$this=$('#'+id);style=$.data($this[0],'style');for(var i=($this.find('.'+dash+' .'+style+'-digit').length-1);i>=0;i--){var d=n%10;n=(n-d)/10;$this.digitChangeTo('#'+$this.attr('id')+' .'+dash+' .'+style+'-digit:eq('+i+')',d,duration)}};$.fn.digitChangeTo=function(digit,n,duration){if(!duration){duration=500}if($(digit+' div.top').html()!=n+''){$(digit+' div.top').css({'display':'none'});$(digit+' div.top').html((n?n:'0')).slideDown(duration);$(digit+' div.bottom').animate({'height':''},duration,function(){$(digit+' div.bottom').html($(digit+' div.top').html());$(digit+' div.bottom').css({'display':'block','height':''});$(digit+' div.top').hide().slideUp(10)})}}})(jQuery);
readme.txt CHANGED
@@ -3,9 +3,9 @@
3
  Contributors: twinpictures, baden03
4
  Donate link: http://plugins.twinpictures.de/plugins/t-minus-countdown/
5
  Tags: countdown, timer, clock, ticker, widget, event, counter, count down, t minus, t-minus, twinpictures, plguin-oven, pluginoven, G2, spaceBros, littlewebtings, jQuery, javascript
6
- Requires at least: 2.8
7
- Tested up to: 3.4.1
8
- Stable tag: 2.2.3
9
 
10
  T(-) Countdown will display a highly customizable, sweet-n-sexy flash-free countdown timer in a sidebar, page or post.
11
 
@@ -54,6 +54,11 @@ Ah yes! <a href='http://twitter.com/#!/twinpictures'>@Twinpictures</a> is on the
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
57
  = 2.2.3 =
58
  * Fixed spacing issues with some styles
59
  * Rockstar features will default to collapsed to save space
@@ -138,7 +143,11 @@ Ah yes! <a href='http://twitter.com/#!/twinpictures'>@Twinpictures</a> is on the
138
 
139
  == Upgrade Notice ==
140
 
141
- = 2.2.3a =
 
 
 
 
142
  * fixed spacing issues with some styles
143
  * rockstar features will now display collapsed by default
144
  * will discover plugin directory if wp-content is renamed
3
  Contributors: twinpictures, baden03
4
  Donate link: http://plugins.twinpictures.de/plugins/t-minus-countdown/
5
  Tags: countdown, timer, clock, ticker, widget, event, counter, count down, t minus, t-minus, twinpictures, plguin-oven, pluginoven, G2, spaceBros, littlewebtings, jQuery, javascript
6
+ Requires at least: 3.3
7
+ Tested up to: 3.4.2
8
+ Stable tag: 2.2.4
9
 
10
  T(-) Countdown will display a highly customizable, sweet-n-sexy flash-free countdown timer in a sidebar, page or post.
11
 
54
 
55
  == Changelog ==
56
 
57
+ = 2.2.4 =
58
+ * Requires WordPress 3.3 or newer
59
+ * Added jQuery datepicker for selecting target date
60
+ * Added new 'Count Up' feature
61
+
62
  = 2.2.3 =
63
  * Fixed spacing issues with some styles
64
  * Rockstar features will default to collapsed to save space
143
 
144
  == Upgrade Notice ==
145
 
146
+ = 2.2.4 =
147
+ * jQuery datepicker is now used to select date
148
+ * Added new Count Up feature
149
+
150
+ = 2.2.3 =
151
  * fixed spacing issues with some styles
152
  * rockstar features will now display collapsed by default
153
  * will discover plugin directory if wp-content is renamed