T(-) Countdown - Version 2.0

Version Description

  • Multiple instance sidebar widgets.
  • Advanced above and below HTML areas.
  • Advanced 'on-launch' event that will display custom HTML in a target area when the countdown reaches 00:00:00.
  • Added shortcode to include mulitple countdowns in post and pages.
Download this release

Release Info

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

Code changes from version 1.7 to 2.0

admin/collapse-style.css ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .collapseomatic {
2
+ background-image:url(images/arrow-down.png) !important;
3
+ background-repeat:no-repeat;
4
+ padding: 0 0 10px 16px;
5
+ cursor: pointer;
6
+ }
7
+ .close {
8
+ background-image:url(images/arrow-up.png) !important;
9
+ }
10
+ .collapseomatic_content {
11
+ display: none;
12
+ margin-top: 3px;
13
+ margin-left: 16px;
14
+ }
admin/images/arrow-down.png ADDED
Binary file
admin/images/arrow-up.png ADDED
Binary file
countdown-timer.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
- Plugin Name: jQuery T Minus Countdown Widget
4
- Plugin URI: http://www.twinpictures.de/t-minus-countdown-widget/
5
- Description: Display and configure a jQuery countdown timer as a sidebar widget.
6
- Version: 1.7
7
  Author: Twinpictures
8
  Author URI: http://www.twinpictures.de
9
  License: GPL2
@@ -24,127 +24,122 @@ License: GPL2
24
  along with this program; if not, write to the Free Software
25
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
-
28
- //replace jQuery google's jQuery (faster load times, take advangage of probable caching)
29
- /* disabled - the google jQuery library seems to disable the visual Visual Editor...instead use the "Use Google Libraries" Plugin
30
- function my_jQuery_init_method() {
31
- wp_deregister_script( 'jquery' );
32
- wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
33
- }
34
- add_action('init', 'my_jQuery_init_method');
35
- */
36
-
37
  wp_enqueue_script('jquery');
38
 
39
  //widgit scripts
40
- function countdown_script(){
41
  $plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
42
- if (!is_admin()){
43
- //lwtCountdown script
44
- wp_register_script('countdown-script', $plugin_url.'/js/jquery.lwtCountdown-1.0.js', array ('jquery'), '1.1' );
45
- wp_enqueue_script('countdown-script');
 
 
 
 
 
 
46
  }
 
 
 
 
 
47
  }
 
48
 
49
  //folder array
50
  function folder_array($path, $exclude = ".|..") {
51
- if(is_dir($path)){
52
- $dh = opendir($path);
53
- $exclude_array = explode("|", $exclude);
54
- $result = array();
55
- while(false !==($file = readdir($dh))) {
56
- if( !in_array(strtolower($file), $exclude_array)){
57
- $result[] = $file;
58
- }
59
- }
60
- closedir($dh);
61
- return $result;
62
- }
63
  }
64
 
 
 
 
 
 
 
 
 
 
 
65
 
66
- // Inserts scripts into header
67
- add_action( 'wp_print_scripts', 'countdown_script' );
68
 
69
- //the widget
70
- function widget_countdown_timer_init() {
71
-
72
- if ( !function_exists('register_sidebar_widget') )
73
- return;
74
-
75
- function sanitizer($name) {
76
- $name = strtolower($name); // all lowercase
77
- $name = preg_replace('/[^a-z0-9 ]/','', $name); // nothing but a-z 0-9 and spaces
78
- $name = preg_replace('/\s+/','-', $name); // spaces become hyphens
79
- return $name;
80
- }
81
-
82
- //widget css
83
- function countdown_style($args){
84
- $plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
85
- if (!is_admin()){
86
- //css
87
- $options = get_option('widget_countdown');
88
- //migrate from the old style system
89
- if($options['style'] == 'light'){ $options['style'] = 'jedi'; }
90
- if($options['style'] == 'dark'){ $options['style'] = 'darth'; }
91
- //new style system
92
- wp_register_style( 'countdown-css', $plugin_url.'/css/'.$options['style'].'/style.css', array (), '1.0' );
93
- wp_enqueue_style( 'countdown-css' );
94
- }
95
- }
96
-
97
- //insert some style into your life
98
- add_action( 'wp_print_styles', 'countdown_style' );
99
-
100
- // Options and default values for this widget
101
- function widget_countdown_options() {
102
- return array(
103
- 'title' => 'Countdown',
104
- 'description' => '',
105
- 'url' => '',
106
- 'urltarget' => '_blank',
107
- 'urltext' => '',
108
- 'urlpos' => 'bottom',
109
- 'day' => 11,
110
- 'month' => 11,
111
- 'year' => 2011,
112
- 'hour' => 11,
113
- 'min' => 11,
114
- 'sec' => 11,
115
- 'weektitle' => 'weeks',
116
- 'daytitle' => 'days',
117
- 'hourtitle' => 'hours',
118
- 'mintitle' => 'minutes',
119
- 'sectitle' => 'seconds',
120
- 'omitweeks' => 'false',
121
- 'style' => 'jedi'
122
- );
123
- }
124
-
125
- function widget_countdown($args) {
126
- extract($args);
127
- $options = array_merge(widget_countdown_options(), get_option('widget_countdown'));
128
- unset($options[0]); //returned by get_option(), but we don't need it
129
 
130
- //calc the inital difference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  $now = time() + ( get_option( 'gmt_offset' ) * 3600);
 
 
132
  $target = mktime(
133
- $options['hour'],
134
- $options['min'],
135
- $options['sec'],
136
- $options['month'],
137
- $options['day'],
138
- $options['year']
139
  );
140
-
 
141
  $diffSecs = $target - $now;
142
-
 
143
  $date = array();
144
  $date['secs'] = $diffSecs % 60;
145
  $date['mins'] = floor($diffSecs/60)%60;
146
  $date['hours'] = floor($diffSecs/60/60)%24;
147
- if($options['omitweeks'] == 'false'){
148
  $date['days'] = floor($diffSecs/60/60/24)%7;
149
  }
150
  else{
@@ -153,7 +148,6 @@ function widget_countdown_timer_init() {
153
  $date['weeks'] = floor($diffSecs/60/60/24/7);
154
 
155
  foreach ($date as $i => $d) {
156
- //echo $d.'<br/>';
157
  $d1 = $d%10;
158
  //53 = 3
159
  //153 = 3
@@ -175,7 +169,8 @@ function widget_countdown_timer_init() {
175
  //345 = 40 / 10 = 4
176
  $d3 = $dm / 100;
177
  }
178
- //here is where the 1000's come to play.
 
179
  //now assign all the digits to the array
180
  $date[$i] = array(
181
  (int)$d3,
@@ -184,233 +179,479 @@ function widget_countdown_timer_init() {
184
  (int)$d
185
  );
186
  }
187
-
188
- echo $before_widget;
189
- if($options['title']){
190
- echo $before_title . $options['title'] . $after_title;
191
- }
192
- if($options['description']){
193
- echo '<p>'. $options['description'] .'</p>';
194
- }
195
- if($options['url'] && $options['urlpos'] == 'top'){
196
- echo '<a href="'. $options['url'] .'" target="'. $options['urltarget'] .'">'. $options['urltext'] .'</a>';
197
- }
198
-
199
- //open the dashboard
200
- echo '<div id="countdown_dashboard">';
201
 
202
- if($options['omitweeks'] == 'false'){
203
- //set up correct style class for double or triple digit love
204
- $wclass = "dash weeks_dash";
205
- if($date['weeks'][0] > 0){
206
- $wclass = "tripdash weeks_trip_dash";
207
- }
208
-
209
- echo '<div class="'.$wclass.'">
210
- <span class="dash_title">'.$options['weektitle'].'</span>';
211
- //show third week digit if the number of weeks is greater than 99
212
- if($date['weeks'][0] > 0){
213
- echo '<div class="digit">'.$date['weeks'][0].'</div>';
214
- }
215
- echo '<div class="digit">'.$date['weeks'][1].'</div>
216
- <div class="digit">'.$date['weeks'][2].'</div>
217
- </div>';
218
- }
219
-
220
- //set up correct style class for double or triple digit love
221
- $dclass = "dash days_dash";
222
- if($options['omitweeks'] == 'true' && $date['days'][3] > 99){
223
- $dclass = "tripdash days_trip_dash";
224
- }
225
-
226
- echo '<div class="'.$dclass.'">
227
- <span class="dash_title">'.$options['daytitle'].'</span>';
228
- //show thrid day digit if there are NO weeks and the number of days is greater that 99
229
- if($options['omitweeks'] == 'true' && $date['days'][3] > 99){
230
- echo '<div class="digit">'.$date['days'][0].'</div>';
231
- }
232
- echo '<div class="digit">'.$date['days'][1].'</div>
233
- <div class="digit">'.$date['days'][2].'</div>
234
- </div>
235
-
236
- <div class="dash hours_dash">
237
- <span class="dash_title">'.$options['hourtitle'].'</span>
238
- <div class="digit">'.$date['hours'][1].'</div>
239
- <div class="digit">'.$date['hours'][2].'</div>
240
- </div>
241
-
242
- <div class="dash minutes_dash">
243
- <span class="dash_title">'.$options['mintitle'].'</span>
244
- <div class="digit">'.$date['mins'][1].'</div>
245
- <div class="digit">'.$date['mins'][2].'</div>
246
- </div>
247
-
248
- <div class="dash seconds_dash">
249
- <span class="dash_title">'.$options['sectitle'].'</span>
250
- <div class="digit">'.$date['secs'][1].'</div>
251
- <div class="digit">'.$date['secs'][2].'</div>
252
- </div>
253
- </div>'; //close the dashboard
254
 
255
- if($options['url'] && $options['urlpos'] == 'bottom'){
256
- echo '<a href="'. $options['url'] .'" target="'. $options['urltarget'] .'">'. $options['urltext'] .'</a>';
257
- }
258
- //echo '<p>Phones riggin dude!</p>';
259
- echo $after_widget;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
  }
261
-
262
- //add the script to the footer
263
- function jquery_countdown_js($args){
264
- $options = get_option('widget_countdown');
265
  $t = date( 'n/j/Y H:i:s', time() + ( get_option( 'gmt_offset' ) * 3600));
266
- ?>
267
- <script language="javascript" type="text/javascript">
 
 
 
 
 
 
 
 
 
 
 
 
268
  jQuery(document).ready(function() {
269
- //alert('Phones Ringin, Dude.');
270
- //only trigger the countdown if one actually exists.
271
- if(jQuery('#countdown_dashboard').length){
272
- //alert('Clocks Tickin, Dude.');
273
-
274
- jQuery('#countdown_dashboard').countDown({
275
- targetDate: {
276
- 'day': <?php echo $options['day']; ?>,
277
- 'month': <?php echo $options['month']; ?>,
278
- 'year': <?php echo $options['year']; ?>,
279
- 'hour': <?php echo $options['hour']; ?>,
280
- 'min': <?php echo $options['min']; ?>,
281
- 'sec': <?php echo $options['sec']; ?>,
282
- 'localtime': '<?php echo $t; ?>'
283
- },
284
- omitWeeks: <?php echo $options['omitweeks']; ?>
285
- });
286
- }
 
 
 
287
  });
288
  </script>
289
- <?php
290
- }
291
-
292
- add_action('wp_head','jquery_countdown_js');
293
-
294
-
295
- //add the widget control form
296
- function widget_countdown_control() {
297
- if(($options = get_option('widget_countdown')) === FALSE) $options = array();
298
- $options = array_merge(widget_countdown_options(), $options);
299
- unset($options[0]); //returned by get_option(), but we don't need it
300
 
301
- // If user is submitting custom option values for this widget
302
- if ( $_POST['countdown-submit'] ) {
303
- // Remember to sanitize and format use input appropriately.
304
- foreach($options as $key => $value){
305
- $options[$key] = strip_tags(stripslashes($_POST['countdown-'.sanitizer($key)]));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  }
307
-
308
- // Save changes
309
- update_option('widget_countdown', $options);
 
 
 
 
 
 
 
 
 
310
  }
311
-
312
- // title option
313
- echo '<p style="text-align:left"><label for="countdown-title">Title: <input style="width: 200px;" id="countdown-title" name="countdown-title" type="text" value="'.$options['title'].'" /></label></p>';
314
-
315
- //description
316
- echo '<p style="text-align:left"><label for="countdown-description">Description: <input style="width: 200px;" id="countdown-description" name="countdown-description" type="text" value="'.$options['description'].'" /></label></p>';
317
-
318
- //url
319
- echo '<p style="text-align:left"><label for="countdown-url">URL: <input style="width: 200px;" id="countdown-url" name="countdown-url" type="text" value="'.$options['url'].'" /></label></p>';
320
-
321
- //url target
322
- echo '<p style="text-align:left"><label for="countdown-urltarget">Link Target: <input style="width: 200px;" id="countdown-urltarget" name="countdown-urltarget" type="text" value="'.$options['urltarget'].'" /></label></p>';
323
-
324
- //url text
325
- echo '<p style="text-align:left"><label for="countdown-urltext">Link Text: <input style="width: 200px;" id="countdown-urltext" name="countdown-urltext" type="text" value="'.$options['urltext'].'" /></label></p>';
326
-
327
- //url position Slector
328
- $dom = '';
329
- $sub = '';
330
- if($options['urlpos'] == 'top'){
331
- $dom = 'CHECKED';
332
- }
333
- else{
334
- $sub = 'CHECKED';
335
- }
336
-
337
- //Is the link a top or a bottom?
338
- echo '<p style="text-align:left"><label for="countdown-urlpos">Link Position: <br/><input id="countdown-urlpos" name="countdown-urlpos" type="radio" '.$dom.' value="top" /> Above Counter </label><input id="countdown-urlpos" name="countdown-urlpos" type="radio" '.$sub.' value="bottom" /> Below Counter </label> </p>';
339
-
340
- //Target Date
341
- echo '<p style="text-align:left"><label for="countdown-day">Target Date (DD-MM-YYYY):<br/><input style="width: 30px;" id="countdown-day" name="countdown-day" type="text" value="'.$options['day'].'" /></label>-<input style="width: 30px;" id="countdown-month" name="countdown-month" type="text" value="'.$options['month'].'" />-<input style="width: 40px;" id="countdown-year" name="countdown-year" type="text" value="'.$options['year'].'" /></p>';
342
-
343
- //Target Time
344
- echo '<p style="text-align:left"><label for="countdown-hour">Target Time (HH:MM:SS):<br/><input style="width: 30px;" id="countdown-hour" name="countdown-hour" type="text" value="'.$options['hour'].'" /></label>:<input style="width: 30px;" id="countdown-min" name="countdown-min" type="text" value="'.$options['min'].'" />:<input style="width: 30px;" id="countdown-sec" name="countdown-sec" type="text" value="'.$options['sec'].'" /></p>';
345
-
346
- //weeks text
347
- echo '<p style="text-align:left"><label for="countdown-weektitle">How do you spell "weeks"?: <input style="width: 200px;" id="countdown-weektitle" name="countdown-weektitle" type="text" value="'.$options['weektitle'].'" /></label></p>';
348
-
349
- //days text
350
- echo '<p style="text-align:left"><label for="countdown-urltext">How do you spell "days"?: <input style="width: 200px;" id="countdown-daytitle" name="countdown-daytitle" type="text" value="'.$options['daytitle'].'" /></label></p>';
351
-
352
- //hours text
353
- echo '<p style="text-align:left"><label for="countdown-hourtitle">How do you spell "hours"?: <input style="width: 200px;" id="countdown-hourtitle" name="countdown-hourtitle" type="text" value="'.$options['hourtitle'].'" /></label></p>';
354
-
355
- //minutes text
356
- echo '<p style="text-align:left"><label for="countdown-mintitle">How do you spell "minutes"?: <input style="width: 200px;" id="countdown-mintitle" name="countdown-mintitle" type="text" value="'.$options['mintitle'].'" /></label></p>';
357
-
358
- //seconds text
359
- echo '<p style="text-align:left"><label for="countdown-sectitle">And "seconds" are spelled how?: <input style="width: 200px;" id="countdown-sectitle" name="countdown-sectitle" type="text" value="'.$options['sectitle'].'" /></label></p>';
360
-
361
-
362
- //Omit Week Slector
363
- $negative = '';
364
- $positive = '';
365
- if($options['omitweeks'] == 'false'){
366
- $negative = 'CHECKED';
367
- }
368
- else{
369
- $positive = 'CHECKED';
370
- }
371
-
372
- //Omit Weeks
373
- echo '<p style="text-align:left"><label for="countdown-omitweeks">Omit Weeks:<input id="countdown-omitweeks" name="countdown-omitweeks" type="radio" '.$negative.' value="false" /> No </label><input id="countdown-omitweeks" name="countdown-omitweeks" type="radio" '.$positive.' value="true" /> Yes </label> </p>';
374
-
375
- //style Slector
376
- //grab all folder names from the css directory
377
- /*$light = '';
378
- $dark = '';
379
- if($options['style'] == 'jedi'){
380
- $light = 'CHECKED';
381
- }
382
- else{
383
- $dark = 'CHECKED';
384
- }*/
385
-
386
- //Light or Dark Style? You choose!
387
- //echo '<p style="text-align:left"><label for="countdown-style">What side of the Force are you on?: <br/><input id="countdown-style" name="countdown-style" type="radio" '.$light.' value="jedi" /> Jedi </label><input id="countdown-style" name="countdown-style" type="radio" '.$dark.' value="darth" /> Darth </label> </p>';
388
-
389
- echo '<p style="text-align:left"><label for="countdown-style">Select your style: <br/>';
390
- echo '<select name="countdown-style" id="countdown-style">';
391
- $styles_arr = folder_array('../'.PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) ).'/css');
392
- foreach($styles_arr as $style){
393
- $selected = "";
394
- if($options['style'] == $style){
395
- $selected = 'SELECTED';
396
- }
397
- echo '<option value="'.$style.'" '.$selected.'>'.$style.'</option>';
 
 
 
 
 
 
 
 
 
 
398
  }
399
- echo '</select>';
400
-
401
- // Submit
402
- echo '<input type="hidden" id="countdown-submit" name="countdown-submit" value="1" />';
403
- }
404
- // This registers our widget so it appears with the other available
405
- // widgets and can be dragged and dropped into any active sidebars.
406
- //register_sidebar_widget('jQuery T Minus CountDown', 'widget_countdown');
407
- wp_register_sidebar_widget( 'jquery-countdown', 'jQuery T Minus CountDown', 'widget_countdown');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
 
409
- // This registers our optional widget control form.
410
- wp_register_widget_control('jquery-countdown', 'jQuery T Minus CountDown', 'widget_countdown_control');
411
- }
 
 
412
 
413
- // Run code later in case this loads prior to any required plugins.
414
- add_action('plugins_loaded', 'widget_countdown_timer_init');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
415
 
416
  ?>
1
  <?php
2
  /*
3
+ Plugin Name: jQuery T(-) Countdown - v2.0
4
+ Plugin URI: http://www.twinpictures.de/jquery-t-minus-2-0/
5
+ Description: Display and configure multiple jQuery countdown timers using a shortcode or as a sidebar widget.
6
+ Version: 2.0
7
  Author: Twinpictures
8
  Author URI: http://www.twinpictures.de
9
  License: GPL2
24
  along with this program; if not, write to the Free Software
25
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
+ add_option('t-minus_styles', '');
 
 
 
 
 
 
 
 
 
28
  wp_enqueue_script('jquery');
29
 
30
  //widgit scripts
31
+ function countdown_scripts(){
32
  $plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
33
+ if (is_admin()){
34
+ //jquery admin stuff
35
+ wp_register_script('tminus-admin-script', $plugin_url.'/js/jquery.collapse.js', array ('jquery'), '1.0' );
36
+ wp_enqueue_script('tminus-admin-script');
37
+
38
+ wp_register_script('livequery-script', $plugin_url.'/js/jquery.livequery.min.js', array ('jquery'), '1.0' );
39
+ wp_enqueue_script('livequery-script');
40
+
41
+ wp_register_style('colapse-admin-css', $plugin_url.'/admin/collapse-style.css', array (), '1.0' );
42
+ wp_enqueue_style('colapse-admin-css');
43
  }
44
+ else{
45
+ //lwtCountdown script
46
+ wp_register_script('countdown-script', $plugin_url.'/js/jquery.lwtCountdown-1.1.js', array ('jquery'), '1.1' );
47
+ wp_enqueue_script('countdown-script');
48
+ }
49
  }
50
+ add_action( 'init', 'countdown_scripts' );
51
 
52
  //folder array
53
  function folder_array($path, $exclude = ".|..") {
54
+ if(is_dir($path)){
55
+ $dh = opendir($path);
56
+ $exclude_array = explode("|", $exclude);
57
+ $result = array();
58
+ while(false !==($file = readdir($dh))) {
59
+ if( !in_array(strtolower($file), $exclude_array)){
60
+ $result[] = $file;
61
+ }
62
+ }
63
+ closedir($dh);
64
+ return $result;
65
+ }
66
  }
67
 
68
+ //styles
69
+ function countdown_style(){
70
+ //$styleizer = array('carbonite','darth','jedi');
71
+ $styleizer = get_option('t-minus_styles');
72
+ $plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
73
+ foreach($styleizer as $style){
74
+ wp_register_style( 'countdown-'.$style.'-css', $plugin_url.'/css/'.$style.'/style.css', array (), '1.1' );
75
+ wp_enqueue_style( 'countdown-'.$style.'-css' );
76
+ }
77
+ }
78
 
79
+ add_action( 'wp_print_styles', 'countdown_style');
80
+ add_option('rockstar', '');
81
 
82
+ /**
83
+ * CountDownTimer Class
84
+ */
85
+ class CountDownTimer extends WP_Widget {
86
+ /** constructor */
87
+ function CountDownTimer() {
88
+ //parent::WP_Widget(false, $name = 'CountDownTimer');
89
+ $widget_ops = array('classname' => 'CountDownTimer', 'description' => __('A smart and sexy jQuery countdown timer by Twinpictures') );
90
+ $this->WP_Widget('CountDownTimer', 'jQuery T(-) CountDown', $widget_ops);
91
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
+ /** Widget */
94
+ function widget($args, $instance) {
95
+ extract( $args );
96
+
97
+ //insert some style into your life
98
+ $style = empty($instance['style']) ? 'jedi' : apply_filters('widget_style', $instance['style']);
99
+ //$styleizer[$style] = $style;
100
+
101
+ $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
102
+ $tophtml = empty($instance['tophtml']) ? ' ' : apply_filters('widget_tophtml', $instance['tophtml']);
103
+ $bothtml = empty($instance['bothtml']) ? ' ' : apply_filters('widget_bothtml', $instance['bothtml']);
104
+ $launchhtml = empty($instance['launchhtml']) ? ' ' : apply_filters('widget_launchhtml', $instance['launchhtml']);
105
+ $launchtarget = empty($instance['launchtarget']) ? 'After Countdown' : apply_filters('widget_launchtarget', $instance['launchtarget']);
106
+
107
+ $day = empty($instance['day']) ? 11 : apply_filters('widget_day', $instance['day']);
108
+ $month = empty($instance['month']) ? 11 : apply_filters('widget_month', $instance['month']);
109
+ $year = empty($instance['year']) ? 2011 : apply_filters('widget_year', $instance['year']);
110
+ $hour = empty($instance['hour']) ? 11 : apply_filters('widget_hour', $instance['hour']);
111
+ $min = empty($instance['min']) ? 11 : apply_filters('widget_min', $instance['min']);
112
+ $sec = empty($instance['sec']) ? 11 : apply_filters('widget_sec', $instance['sec']);
113
+
114
+ $weektitle = empty($instance['weektitle']) ? 'weeks' : apply_filters('widget_weektitle', $instance['weektitle']);
115
+ $daytitle = empty($instance['daytitle']) ? 'days' : apply_filters('widget_daytitle', $instance['daytitle']);
116
+ $hourtitle = empty($instance['hourtitle']) ? 'hours' : apply_filters('widget_hourtitle', $instance['hourtitle']);
117
+ $mintitle = empty($instance['mintitle']) ? 'minutes' : apply_filters('widget_mintitle', $instance['mintitle']);
118
+ $sectitle = empty($instance['sectitle']) ? 'seconds' : apply_filters('widget_sectitle', $instance['sectitle']);
119
+ $omitweeks = empty($instance['omitweeks']) ? 'false' : apply_filters('widget_omitweeks', $instance['omitweeks']);
120
+
121
+ //now
122
  $now = time() + ( get_option( 'gmt_offset' ) * 3600);
123
+
124
+ //target
125
  $target = mktime(
126
+ $hour,
127
+ $min,
128
+ $sec,
129
+ $month,
130
+ $day,
131
+ $year
132
  );
133
+
134
+ //difference in seconds
135
  $diffSecs = $target - $now;
136
+
137
+ //countdown digits
138
  $date = array();
139
  $date['secs'] = $diffSecs % 60;
140
  $date['mins'] = floor($diffSecs/60)%60;
141
  $date['hours'] = floor($diffSecs/60/60)%24;
142
+ if($omitweeks == 'false'){
143
  $date['days'] = floor($diffSecs/60/60/24)%7;
144
  }
145
  else{
148
  $date['weeks'] = floor($diffSecs/60/60/24/7);
149
 
150
  foreach ($date as $i => $d) {
 
151
  $d1 = $d%10;
152
  //53 = 3
153
  //153 = 3
169
  //345 = 40 / 10 = 4
170
  $d3 = $dm / 100;
171
  }
172
+ /* here is where the 1000's support will go... someday. */
173
+
174
  //now assign all the digits to the array
175
  $date[$i] = array(
176
  (int)$d3,
179
  (int)$d
180
  );
181
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
 
184
+ echo $before_widget;
185
+ if ( $title ){
186
+ echo $before_title . $title . $after_title;
187
+ }
188
+ echo '<div id="'.$args['widget_id'].'-widget">';
189
+ echo '<div id="'.$args['widget_id'].'-tophtml" class="'.$style.'-tophtml">';
190
+ if($tophtml){
191
+ echo $tophtml;
192
+ }
193
+ echo '</div>';
194
+
195
+ //drop in the dashboard
196
+ echo '<div id="'.$args['widget_id'].'-dashboard" class="'.$style.'-dashboard">';
197
+
198
+ if($omitweeks == 'false'){
199
+ //set up correct style class for double or triple digit love
200
+ $wclass = $style.'-dash '.$style.'-weeks_dash';
201
+ if($date['weeks'][0] > 0){
202
+ $wclass = $style.'-tripdash '.$style.'-weeks_trip_dash';
203
+ }
204
+
205
+ echo '<div class="'.$wclass.'">
206
+ <span class="'.$style.'-dash_title">'.$weektitle.'</span>';
207
+ //show third week digit if the number of weeks is greater than 99
208
+ if($date['weeks'][0] > 0){
209
+ echo '<div class="'.$style.'-digit">'.$date['weeks'][0].'</div>';
210
+ }
211
+ echo '<div class="'.$style.'-digit">'.$date['weeks'][1].'</div>
212
+ <div class="'.$style.'-digit">'.$date['weeks'][2].'</div>
213
+ </div>';
214
+ }
215
+
216
+ //set up correct style class for double or triple digit love
217
+ $dclass = $style.'-dash '.$style.'-days_dash';
218
+ if($omitweeks == 'true' && $date['days'][3] > 99){
219
+ $dclass = $style.'-tripdash '.$style.'-days_trip_dash';
220
+ }
221
+
222
+ echo '<div class="'.$dclass.'">
223
+ <span class="'.$style.'-dash_title">'.$daytitle.'</span>';
224
+ //show thrid day digit if there are NO weeks and the number of days is greater that 99
225
+ if($omitweeks == 'true' && $date['days'][3] > 99){
226
+ echo '<div class="'.$style.'-digit">'.$date['days'][0].'</div>';
227
+ }
228
+ echo '<div class="'.$style.'-digit">'.$date['days'][1].'</div>
229
+ <div class="'.$style.'-digit">'.$date['days'][2].'</div>
230
+ </div>
231
+
232
+ <div class="'.$style.'-dash '.$style.'-hours_dash">
233
+ <span class="'.$style.'-dash_title">'.$hourtitle.'</span>
234
+ <div class="'.$style.'-digit">'.$date['hours'][1].'</div>
235
+ <div class="'.$style.'-digit">'.$date['hours'][2].'</div>
236
+ </div>
237
+
238
+ <div class="'.$style.'-dash '.$style.'-minutes_dash">
239
+ <span class="'.$style.'-dash_title">'.$mintitle.'</span>
240
+ <div class="'.$style.'-digit">'.$date['mins'][1].'</div>
241
+ <div class="'.$style.'-digit">'.$date['mins'][2].'</div>
242
+ </div>
243
+
244
+ <div class="'.$style.'-dash '.$style.'-seconds_dash">
245
+ <span class="'.$style.'-dash_title">'.$sectitle.'</span>
246
+ <div class="'.$style.'-digit">'.$date['secs'][1].'</div>
247
+ <div class="'.$style.'-digit">'.$date['secs'][2].'</div>
248
+ </div>
249
+ </div>'; //close the dashboard
250
+
251
+ echo '<div id="'.$args['widget_id'].'-bothtml" class="'.$style.'-bothtml">';
252
+ if($bothtml){
253
+ echo $bothtml;
254
  }
255
+ echo '</div>';
256
+ echo '</div>';
257
+ echo $after_widget;
 
258
  $t = date( 'n/j/Y H:i:s', time() + ( get_option( 'gmt_offset' ) * 3600));
259
+
260
+ //launch div
261
+ $launchdiv = "";
262
+ if($launchtarget == "Above Countdown"){
263
+ $launchdiv = "tophtml";
264
+ }
265
+ else if($launchtarget == "Below Countdown"){
266
+ $launchdiv = "bothtml";
267
+ }
268
+ else if($launchtarget == "Entire Widget"){
269
+ $launchdiv = "widget";
270
+ }
271
+ ?>
272
+ <script language="javascript" type="text/javascript">
273
  jQuery(document).ready(function() {
274
+ //only trigger the countdown if one actually exists.
275
+ if(jQuery('#<?php echo $args['widget_id']; ?>-dashboard').length){
276
+ //alert('Clock <?php echo $args['widget_id']; ?>-dashboard is Tickin, Dude.');
277
+ jQuery('#<?php echo $args['widget_id']; ?>-dashboard').countDown({
278
+ targetDate: {
279
+ 'day': <?php echo $day; ?>,
280
+ 'month': <?php echo $month; ?>,
281
+ 'year': <?php echo $year; ?>,
282
+ 'hour': <?php echo $hour; ?>,
283
+ 'min': <?php echo $min; ?>,
284
+ 'sec': <?php echo $sec; ?>,
285
+ 'localtime': '<?php echo $t; ?>',
286
+ },
287
+ style: '<?php echo $style; ?>',
288
+ omitWeeks: <?php echo $omitweeks;
289
+ if($launchhtml){
290
+ echo ", onComplete: function() { jQuery('#".$args['widget_id']."-".$launchdiv."').html('".do_shortcode($launchhtml)."'); }";
291
+ }
292
+ ?>
293
+ });
294
+ }
295
  });
296
  </script>
297
+ <?php
298
+ }
 
 
 
 
 
 
 
 
 
299
 
300
+ /** Update */
301
+ function update($new_instance, $old_instance) {
302
+ $instance = array_merge($old_instance, $new_instance);
303
+ //return array_map('strip_tags', $instance);
304
+ if(isset($instance['isrockstar']) && $instance['isrockstar']){
305
+ update_option('rockstar', $instance['isrockstar']);
306
+ }
307
+
308
+ //update the styles
309
+ $style_arr = get_option('t-minus_styles');
310
+ $style_arr[$instance['style']] = $instance['style'];
311
+ update_option('t-minus_styles', $style_arr);
312
+
313
+ return array_map('mysql_real_escape_string', $instance);
314
+ }
315
+
316
+ /** Form */
317
+ function form($instance) {
318
+ $title = stripslashes($instance['title']);
319
+ $day = esc_attr($instance['day']);
320
+ if(!$day){
321
+ $day = 11;
322
+ }
323
+ else if($day > 31){
324
+ $day = 31;
325
+ }
326
+ //apply_filters('widget_day', $day);
327
+
328
+ $month = esc_attr($instance['month']);
329
+ if(!$month){
330
+ $month = 11;
331
+ }
332
+ else if($month > 12){
333
+ $month = 12;
334
+ }
335
+
336
+ $year = esc_attr($instance['year']);
337
+ if(!$year){
338
+ $year = 2011;
339
+ }
340
+
341
+ $hour = esc_attr($instance['hour']);
342
+ if(!$hour){
343
+ $hour = 11;
344
+ }
345
+ else if($hour > 23){
346
+ $hour = 23;
347
+ }
348
+
349
+ $min = esc_attr($instance['min']);
350
+ if(!$min){
351
+ $min = 11;
352
+ }
353
+ else if($min > 59){
354
+ $min = 59;
355
+ }
356
+
357
+ $sec = esc_attr($instance['sec']);
358
+ if(!$sec){
359
+ $sec = 11;
360
+ }
361
+ else if($sec > 59){
362
+ $sec = 59;
363
+ }
364
+ $omitweeks = esc_attr($instance['omitweeks']);
365
+ if(!$omitweeks){
366
+ $omitweeks = 'false';
367
+ }
368
+ $style = esc_attr($instance['style']);
369
+ if(!$style){
370
+ $style = 'jedi';
371
+ }
372
+
373
+ $isrockstar = get_option('rockstar');
374
+
375
+ if($isrockstar){
376
+ //rockstar features
377
+ $tophtml = empty($instance['tophtml']) ? ' ' : apply_filters('widget_tophtml', stripslashes($instance['tophtml']));
378
+ $bothtml = empty($instance['bothtml']) ? ' ' : apply_filters('widget_bothtml', stripslashes($instance['bothtml']));
379
+ $launchhtml = empty($instance['launchhtml']) ? ' ' : apply_filters('widget_launchhtml', stripslashes($instance['launchhtml']));
380
+ $launchtarget = empty($instance['launchtarget']) ? 'After Counter' : apply_filters('widget_launchtarget', $instance['launchtarget']);
381
+ $weektitle = empty($instance['weektitle']) ? 'weeks' : apply_filters('widget_weektitle', stripslashes($instance['weektitle']));
382
+ $daytitle = empty($instance['daytitle']) ? 'days' : apply_filters('widget_daytitle', stripslashes($instance['daytitle']));
383
+ $hourtitle = empty($instance['hourtitle']) ? 'hours' : apply_filters('widget_hourtitle', stripslashes($instance['hourtitle']));
384
+ $mintitle = empty($instance['mintitle']) ? 'minutes' : apply_filters('widget_mintitle', stripslashes($instance['mintitle']));
385
+ $sectitle = empty($instance['sectitle']) ? 'seconds' : apply_filters('widget_sectitle', stripslashes($instance['sectitle']));
386
+ }
387
+ ?>
388
+ <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>
389
+ <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>
390
+ <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>
391
+ <?php
392
+ //Omit Week Slector
393
+ $negative = '';
394
+ $positive = '';
395
+ if($omitweeks == 'false'){
396
+ $negative = 'CHECKED';
397
+ }else{
398
+ $positive = 'CHECKED';
399
+ }
400
+ ?>
401
+ <p><?php _e('Omit Weeks:'); ?> <input id="<?php echo $this->get_field_id('omitweeks'); ?>-no" name="<?php echo $this->get_field_name('omitweeks'); ?>" type="radio" <?php echo $negative; ?> value="false" /><label for="<?php echo $this->get_field_id('omitweeks'); ?>-no"> <?php _e('No'); ?> </label> <input id="<?php echo $this->get_field_id('omitweeks'); ?>-yes" name="<?php echo $this->get_field_name('omitweeks'); ?>" type="radio" <?php echo $positive; ?> value="true" /> <label for="<?php echo $this->get_field_id('omitweeks'); ?>-yes"> <?php _e('Yes'); ?></label></p>
402
+ <p><?php _e('Style:'); ?> <select name="<?php echo $this->get_field_name('style'); ?>" id="<?php echo $this->get_field_name('style'); ?>">
403
+ <?php
404
+ $styles_arr = folder_array('../'.PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) ).'/css');
405
+ foreach($styles_arr as $style_name){
406
+ $selected = "";
407
+ if($style == $style_name){
408
+ $selected = 'SELECTED';
409
+ }
410
+ echo '<option value="'.$style_name.'" '.$selected.'>'.$style_name.'</option>';
411
  }
412
+ ?>
413
+ </select></p>
414
+ <input class="isrockstar" id="<?php echo $this->get_field_id('isrockstar'); ?>" name="<?php echo $this->get_field_name('isrockstar'); ?>" type="hidden" value="<?php echo $isrockstar; ?>" />
415
+ <?php
416
+ if($isrockstar){
417
+ echo __($isrockstar).'<br/>';
418
+ }
419
+ else{
420
+ ?>
421
+ <p id="header-<?php echo $this->get_field_id('unlock'); ?>"><input class="rockstar" id="<?php echo $this->get_field_id('unlock'); ?>" name="<?php echo $this->get_field_name('unlock'); ?>" type="checkbox" value="" /> <label for="<?php echo $this->get_field_id('unlock'); ?>"><?php _e('This is totally worth 3 bucks.'); ?></label></p>
422
+ <div id="target-<?php echo $this->get_field_id('unlock'); ?>" class="collapseomatic_content">
423
+ <?php
424
  }
425
+ ?>
426
+ <a class="collapseomatic" id="tophtml<?php echo $this->get_field_id('tophtml'); ?>"><?php _e('Above Countdown'); ?></a>
427
+ <div id="target-tophtml<?php echo $this->get_field_id('tophtml'); ?>" class="collapseomatic_content">
428
+ <p><label for="<?php echo $this->get_field_id('tophtml'); ?>"><?php _e('Top HTML:'); ?></label> <textarea id="<?php echo $this->get_field_id('tophtml'); ?>" name="<?php echo $this->get_field_name('tophtml'); ?>"><?php echo $tophtml; ?></textarea></p>
429
+ </div>
430
+ <br/>
431
+ <a class="collapseomatic" id="bothtml<?php echo $this->get_field_id('bothtml'); ?>"><?php _e('Below Countdown'); ?></a>
432
+ <div id="target-bothtml<?php echo $this->get_field_id('bothtml'); ?>" class="collapseomatic_content">
433
+ <p><label for="<?php echo $this->get_field_id('bothtml'); ?>"><?php _e('Bottom HTML:'); ?></label> <textarea id="<?php echo $this->get_field_id('bothtml'); ?>" name="<?php echo $this->get_field_name('bothtml'); ?>"><?php echo $bothtml; ?></textarea></p>
434
+ </div>
435
+ <br/>
436
+ <a class="collapseomatic" id="launchhtml<?php echo $this->get_field_id('launchhtml'); ?>"><?php _e('When Countdown Reaches Zero'); ?></a>
437
+ <div id="target-launchhtml<?php echo $this->get_field_id('launchhtml'); ?>" class="collapseomatic_content">
438
+ <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>
439
+ <p><?php _e('Launch Target:'); ?> <select name="<?php echo $this->get_field_name('launchtarget'); ?>" id="<?php echo $this->get_field_name('launchtarget'); ?>">
440
+ <?php
441
+ $target_arr = array('Above Countdown', 'Below Countdown', 'Entire Widget');
442
+ foreach($target_arr as $target_name){
443
+ $selected = "";
444
+ if($launchtarget == $target_name){
445
+ $selected = 'SELECTED';
446
+ }
447
+ echo '<option value="'.$target_name.'" '.$selected.'>'.__($target_name).'</option>';
448
+ }
449
+ ?>
450
+ </select></p>
451
+ </div>
452
+ <br/>
453
+ <a class="collapseomatic" id="titles<?php echo $this->get_field_id('weektitle'); ?>"><?php _e('Digit Titles'); ?></a>
454
+ <div id="target-titles<?php echo $this->get_field_id('weektitle'); ?>" class="collapseomatic_content">
455
+ <p><label for="<?php echo $this->get_field_id('weektitle'); ?>"><?php _e('How do you spell "weeks"?:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('weektitle'); ?>" name="<?php echo $this->get_field_name('weektitle'); ?>" type="text" value="<?php echo $weektitle; ?>" /></label></p>
456
+ <p><label for="<?php echo $this->get_field_id('daytitle'); ?>"><?php _e('How do you spell "days"?:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('daytitle'); ?>" name="<?php echo $this->get_field_name('daytitle'); ?>" type="text" value="<?php echo $daytitle; ?>" /></label></p>
457
+ <p><label for="<?php echo $this->get_field_id('hourtitle'); ?>"><?php _e('How do you spell "hours"?:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('hourtitle'); ?>" name="<?php echo $this->get_field_name('hourtitle'); ?>" type="text" value="<?php echo $hourtitle; ?>" /></label></p>
458
+ <p><label for="<?php echo $this->get_field_id('mintitle'); ?>"><?php _e('How do you spell "minutes"?:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('mintitle'); ?>" name="<?php echo $this->get_field_name('mintitle'); ?>" type="text" value="<?php echo $mintitle; ?>" /></label></p>
459
+ <p><label for="<?php echo $this->get_field_id('sectitle'); ?>"><?php _e('And "seconds" are spelled:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('sectitle'); ?>" name="<?php echo $this->get_field_name('sectitle'); ?>" type="text" value="<?php echo $sectitle; ?>" /></label></p>
460
+ </div>
461
+
462
+ <?php
463
+ if(!$isrockstar){
464
+ echo '</div>';
465
+ }
466
+ }
467
+ } // class CountDownTimer
468
+
469
+ // register CountDownTimer widget
470
+ add_action('widgets_init', create_function('', 'return register_widget("CountDownTimer");'));
471
+
472
+ //the short code
473
+ function tminuscountdown($atts, $content=null) {
474
+ //find a random number, incase there is no id assigned
475
+ $ran = rand(1, 10000);
476
+
477
+ extract(shortcode_atts(array(
478
+ 'id' => $ran,
479
+ 't' => '11-11-2011 11:11:11',
480
+ 'weeks' => 'weeks',
481
+ 'days' => 'days',
482
+ 'hours' => 'hours',
483
+ 'minutes' => 'minutes',
484
+ 'seconds' => 'seconds',
485
+ 'omitweeks' => 'false',
486
+ 'style' => 'jedi',
487
+ 'before' => '',
488
+ 'after' => '',
489
+ 'width' => 'auto',
490
+ 'height' => 'auto',
491
+ 'launchwidth' => 'auto',
492
+ 'launchheight' => 'auto',
493
+ 'launchtarget' => 'countdown',
494
+ ), $atts));
495
+
496
+ //update the styles
497
+ $style_arr = get_option('t-minus_styles');
498
+ $style_arr[$style] = $style;
499
+ update_option('t-minus_styles', $style_arr);
500
+
501
+ $now = time() + ( get_option( 'gmt_offset' ) * 3600);
502
+ $target = strtotime($t, $now);
503
+
504
+ //difference in seconds
505
+ $diffSecs = $target - $now;
506
+
507
+ $day = date ( 'd', $target );
508
+ $month = date ( 'm', $target );
509
+ $year = date ( 'Y', $target );
510
+ $hour = date ( 'H', $target );
511
+ $min = date ( 'i', $target );
512
+ $sec = date ( 's', $target );
513
+
514
+ //countdown digits
515
+ $date_arr = array();
516
+ $date_arr['secs'] = $diffSecs % 60;
517
+ $date_arr['mins'] = floor($diffSecs/60)%60;
518
+ $date_arr['hours'] = floor($diffSecs/60/60)%24;
519
+
520
+ if($omitweeks == 'false'){
521
+ $date_arr['days'] = floor($diffSecs/60/60/24)%7;
522
  }
523
+ else{
524
+ $date_arr['days'] = floor($diffSecs/60/60/24);
525
+ }
526
+ $date_arr['weeks'] = floor($diffSecs/60/60/24/7);
527
+
528
+ foreach ($date_arr as $i => $d) {
529
+ $d1 = $d%10;
530
+ if($d < 100){
531
+ $d2 = ($d-$d1) / 10;
532
+ $d3 = 0;
533
+ }
534
+ else{
535
+ $dr = $d%100;
536
+ $dm = $d-$dr;
537
+ $d2 = ($d-$dm-$d1) / 10;
538
+ $d3 = $dm / 100;
539
+ }
540
+ /* here is where the 1000's support will go... someday. */
541
+
542
+ //now assign all the digits to the array
543
+ $date_arr[$i] = array(
544
+ (int)$d3,
545
+ (int)$d2,
546
+ (int)$d1,
547
+ (int)$d
548
+ );
549
+ }
550
+
551
+ if(is_numeric($width)){
552
+ $width .= 'px';
553
+ }
554
+ if(is_numeric($height)){
555
+ $height .= 'px';
556
+ }
557
+ $tminus = '<div id="'.$id.'-countdown" style="width:'.$width.'; height:'.$height.';">';
558
+ $tminus .= '<div id="'.$id.'-above" class="'.$style.'-tophtml">';
559
+ if($before){
560
+ $tminus .= $before;
561
+ }
562
+ $tminus .= '</div>';
563
+
564
+ //drop in the dashboard
565
+ $tminus .= '<div id="'.$id.'-dashboard" class="'.$style.'-dashboard">';
566
+ if($omitweeks == 'false'){
567
+ //set up correct style class for double or triple digit love
568
+ $wclass = $style.'-dash '.$style.'-weeks_dash';
569
+ if($date_arr['weeks'][0] > 0){
570
+ $wclass = $style.'-tripdash '.$style.'-weeks_trip_dash';
571
+ }
572
+
573
+ $tminus .= '<div class="'.$wclass.'"><span class="'.$style.'-dash_title">'.$weeks.'</span>';
574
+ if($date_arr['weeks'][0] > 0){
575
+ $tminus .= '<div class="'.$style.'-digit">'.$date_arr['weeks'][0].'</div>';
576
+ }
577
+ $tminus .= '<div class="'.$style.'-digit">'.$date_arr['weeks'][1].'</div><div class="'.$style.'-digit">'.$date_arr['weeks'][2].'</div></div>';
578
+ }
579
+
580
+ //set up correct style class for double or triple digit love
581
+ $dclass = $style.'-dash '.$style.'-days_dash';
582
+ if($omitweeks == 'true' && $date_arr['days'][3] > 99){
583
+ $dclass = $style.'-tripdash '.$style.'-days_trip_dash';
584
+ }
585
+
586
+ $tminus .= '<div class="'.$dclass.'"><span class="'.$style.'-dash_title">'.$days.'</span>';
587
+ //show thrid day digit if there are NO weeks and the number of days is greater that 99
588
+ if($omitweeks == 'true' && $date_arr['days'][3] > 99){
589
+ $tminus .= '<div class="'.$style.'-digit">'.$date_arr['days'][0].'</div>';
590
+ }
591
+ $tminus .= '<div class="'.$style.'-digit">'.$date_arr['days'][1].'</div><div class="'.$style.'-digit">'.$date_arr['days'][2].'</div>
592
+ </div>
593
+ <div class="'.$style.'-dash '.$style.'-hours_dash">
594
+ <span class="'.$style.'-dash_title">'.$hours.'</span>
595
+ <div class="'.$style.'-digit">'.$date_arr['hours'][1].'</div>
596
+ <div class="'.$style.'-digit">'.$date_arr['hours'][2].'</div>
597
+ </div>
598
+
599
+ <div class="'.$style.'-dash '.$style.'-minutes_dash">
600
+ <span class="'.$style.'-dash_title">'.$minutes.'</span>
601
+ <div class="'.$style.'-digit">'.$date_arr['mins'][1].'</div>
602
+ <div class="'.$style.'-digit">'.$date_arr['mins'][2].'</div>
603
+ </div>
604
+
605
+ <div class="'.$style.'-dash '.$style.'-seconds_dash">
606
+ <span class="'.$style.'-dash_title">'.$seconds.'</span>
607
+ <div class="'.$style.'-digit">'.$date_arr['secs'][1].'</div>
608
+ <div class="'.$style.'-digit">'.$date_arr['secs'][2].'</div>
609
+ </div>
610
+ </div>'; //close the dashboard
611
 
612
+ $tminus .= '<div id="'.$id.'-below" class="'.$style.'-bothtml">';
613
+ if($after){
614
+ $tminus .= $after;
615
+ }
616
+ $tminus .= '</div></div>';
617
 
618
+ $t = date( 'n/j/Y H:i:s', gmmktime() + ( get_option( 'gmt_offset' ) * 3600));
619
+ if(is_numeric($launchwidth)){
620
+ $launchwidth .= 'px';
621
+ }
622
+ if(is_numeric($launchheight)){
623
+ $launchheight .= 'px';
624
+ }
625
+ ?>
626
+ <script language="javascript" type="text/javascript">
627
+ jQuery(document).ready(function() {
628
+ //only trigger the countdown if one actually exists.
629
+ if(jQuery('#<?php echo $id; ?>-dashboard').length){
630
+ jQuery('#<?php echo $id; ?>-dashboard').countDown({
631
+ targetDate: {
632
+ 'day': <?php echo $day; ?>,
633
+ 'month': <?php echo $month; ?>,
634
+ 'year': <?php echo $year; ?>,
635
+ 'hour': <?php echo $hour; ?>,
636
+ 'min': <?php echo $min; ?>,
637
+ 'sec': <?php echo $sec; ?>,
638
+ 'localtime': '<?php echo $t; ?>',
639
+ },
640
+ style: '<?php echo $style; ?>',
641
+ omitWeeks: <?php echo $omitweeks;
642
+ if($content){
643
+ echo ", onComplete: function() {
644
+ jQuery('#".$id."-".$launchtarget."').css({'width' : '".$launchwidth."', 'height' : '".$launchheight."'});
645
+ jQuery('#".$id."-".$launchtarget."').html('".do_shortcode($content)."');
646
+ }";
647
+ }?>
648
+ });
649
+ }
650
+ });
651
+ </script>
652
+ <?php
653
+ return $tminus;
654
+ }
655
+ add_shortcode('tminus', 'tminuscountdown');
656
 
657
  ?>
css/carbonite/style.css CHANGED
@@ -1,4 +1,11 @@
1
- #countdown_dashboard {
 
 
 
 
 
 
 
2
  height: 127px;
3
  width: 250px;
4
  margin: 0 auto;
@@ -7,54 +14,54 @@
7
  background: transparent url('images/bg_countdown.png') 0 0 no-repeat;
8
  }
9
 
10
- .dash {
11
  width: 42px;
12
  height: 44px;
13
  float: left;
14
  margin-left: 2px;
15
  padding-left: 6px;
16
- padding-top: 10px;
17
  position: relative;
18
  color: #FFF;
19
  }
20
 
21
- .tripdash {
22
  width: 62px;
23
  height: 44px;
24
  float: left;
25
  margin-left: 2px;
26
  padding-left: 6px;
27
- padding-top: 10px;
28
  position: relative;
29
  color: #FFF;
30
  }
31
 
32
- .hours_dash, .minutes_dash, .seconds_dash {
33
  background: transparent url('images/bg_dash.png') 0 0 no-repeat;
34
  }
35
 
36
- .days_dash {
37
  clear: left;
38
  margin-left: 10px;
39
  background: transparent url('images/bg_dash.png') 0 0 no-repeat;
40
  }
41
 
42
- .days_trip_dash {
43
  clear: left;
44
  background: transparent url('images/bg_trip_dash.png') 0 0 no-repeat;
45
  }
46
 
47
- .weeks_dash {
48
  margin-left: 10px;
49
  background: transparent url('images/bg_dash.png') 0 0 no-repeat;
50
  }
51
 
52
- .weeks_trip_dash {
53
  margin-left: 10px;
54
  background: transparent url('images/bg_trip_dash.png') 0 0 no-repeat;
55
  }
56
 
57
- .digit {
58
  font: normal normal normal 16pt/normal arial;
59
  float: left;
60
  width: 20px;
@@ -62,7 +69,7 @@
62
  position: relative;
63
  }
64
 
65
- .dash .dash_title {
66
  display: block;
67
  position: absolute;
68
  text-transform:uppercase;
@@ -73,7 +80,7 @@
73
  font-size: 9px;
74
  }
75
 
76
- .tripdash .dash_title {
77
  display: block;
78
  position: absolute;
79
  text-transform:uppercase;
@@ -82,4 +89,10 @@
82
  color: #AAA;
83
  text-align: center;
84
  font-size: 9px;
 
 
 
 
 
 
85
  }
1
+ /*above the dashboard*/
2
+ .carbonite-tophtml {
3
+ margin: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ /*above the dashboard*/
8
+ .carbonite-dashboard {
9
  height: 127px;
10
  width: 250px;
11
  margin: 0 auto;
14
  background: transparent url('images/bg_countdown.png') 0 0 no-repeat;
15
  }
16
 
17
+ .carbonite-dash {
18
  width: 42px;
19
  height: 44px;
20
  float: left;
21
  margin-left: 2px;
22
  padding-left: 6px;
23
+ padding-top: 12px;
24
  position: relative;
25
  color: #FFF;
26
  }
27
 
28
+ .carbonite-tripdash {
29
  width: 62px;
30
  height: 44px;
31
  float: left;
32
  margin-left: 2px;
33
  padding-left: 6px;
34
+ padding-top: 12px;
35
  position: relative;
36
  color: #FFF;
37
  }
38
 
39
+ .carbonite-hours_dash, .carbonite-minutes_dash, .carbonite-seconds_dash {
40
  background: transparent url('images/bg_dash.png') 0 0 no-repeat;
41
  }
42
 
43
+ .carbonite-days_dash {
44
  clear: left;
45
  margin-left: 10px;
46
  background: transparent url('images/bg_dash.png') 0 0 no-repeat;
47
  }
48
 
49
+ .carbonite-days_trip_dash {
50
  clear: left;
51
  background: transparent url('images/bg_trip_dash.png') 0 0 no-repeat;
52
  }
53
 
54
+ .carbonite-weeks_dash {
55
  margin-left: 10px;
56
  background: transparent url('images/bg_dash.png') 0 0 no-repeat;
57
  }
58
 
59
+ .carbonite-weeks_trip_dash {
60
  margin-left: 10px;
61
  background: transparent url('images/bg_trip_dash.png') 0 0 no-repeat;
62
  }
63
 
64
+ .carbonite-digit {
65
  font: normal normal normal 16pt/normal arial;
66
  float: left;
67
  width: 20px;
69
  position: relative;
70
  }
71
 
72
+ .carbonite-dash .carbonite-dash_title {
73
  display: block;
74
  position: absolute;
75
  text-transform:uppercase;
80
  font-size: 9px;
81
  }
82
 
83
+ .carbonite-tripdash .carbonite-dash_title {
84
  display: block;
85
  position: absolute;
86
  text-transform:uppercase;
89
  color: #AAA;
90
  text-align: center;
91
  font-size: 9px;
92
+ }
93
+
94
+ /*below the dashboard*/
95
+ .carbonite-bothtml {
96
+ margin: 0;
97
+ padding: 0;
98
  }
css/darth/style.css CHANGED
@@ -1,4 +1,11 @@
1
- #countdown_dashboard {
 
 
 
 
 
 
 
2
  height: 100px;
3
  width: 250px;
4
  margin: 0 auto;
@@ -6,7 +13,7 @@
6
  padding-left: 0px;
7
  }
8
 
9
- .dash {
10
  width: 62px;
11
  height: 44px;
12
  float: left;
@@ -17,7 +24,7 @@
17
  color: #333;
18
  }
19
 
20
- .tripdash {
21
  width: 93px;
22
  height: 44px;
23
  float: left;
@@ -28,20 +35,20 @@
28
  color: #333;
29
  }
30
 
31
- .weeks_dash, .days_dash, .minutes_dash, .seconds_dash {
32
  background: transparent url('images/dark_bg_dash.png') 0 0 no-repeat;
33
  }
34
 
35
- .weeks_trip_dash, .days_trip_dash {
36
  background: transparent url('images/dark_bg_trip_dash.png') 0 0 no-repeat;
37
  }
38
 
39
- .hours_dash {
40
  clear: left;
41
  background: transparent url('images/dark_bg_dash.png') 0 0 no-repeat;
42
  }
43
 
44
- .digit {
45
  font: bold 20pt Verdana;
46
  font-weight: bold;
47
  float: left;
@@ -50,7 +57,7 @@
50
  position: relative;
51
  }
52
 
53
- .dash_title {
54
  -webkit-transform: rotate(-90deg);
55
  -moz-transform: rotate(-90deg);
56
  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
1
+ /*above the dashboard*/
2
+ .darth-tophtml {
3
+ margin: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ /*above the dashboard*/
8
+ .darth-dashboard {
9
  height: 100px;
10
  width: 250px;
11
  margin: 0 auto;
13
  padding-left: 0px;
14
  }
15
 
16
+ .darth-dash {
17
  width: 62px;
18
  height: 44px;
19
  float: left;
24
  color: #333;
25
  }
26
 
27
+ .darth-tripdash {
28
  width: 93px;
29
  height: 44px;
30
  float: left;
35
  color: #333;
36
  }
37
 
38
+ .darth-weeks_dash, .darth-days_dash, .darth-minutes_dash, .darth-seconds_dash {
39
  background: transparent url('images/dark_bg_dash.png') 0 0 no-repeat;
40
  }
41
 
42
+ .darth-weeks_trip_dash, .darth-days_trip_dash {
43
  background: transparent url('images/dark_bg_trip_dash.png') 0 0 no-repeat;
44
  }
45
 
46
+ .darth-hours_dash {
47
  clear: left;
48
  background: transparent url('images/dark_bg_dash.png') 0 0 no-repeat;
49
  }
50
 
51
+ .darth-digit {
52
  font: bold 20pt Verdana;
53
  font-weight: bold;
54
  float: left;
57
  position: relative;
58
  }
59
 
60
+ .darth-dash_title {
61
  -webkit-transform: rotate(-90deg);
62
  -moz-transform: rotate(-90deg);
63
  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
css/jedi/style.css CHANGED
@@ -1,4 +1,11 @@
1
- #countdown_dashboard {
 
 
 
 
 
 
 
2
  height: 100px;
3
  width: 250px;
4
  margin: 0 auto;
@@ -6,7 +13,7 @@
6
  padding-left: 0px;
7
  }
8
 
9
- .dash {
10
  width: 62px;
11
  height: 44px;
12
  float: left;
@@ -17,7 +24,7 @@
17
  color: #333;
18
  }
19
 
20
- .tripdash {
21
  width: 93px;
22
  height: 44px;
23
  float: left;
@@ -28,20 +35,20 @@
28
  color: #333;
29
  }
30
 
31
- .weeks_dash, .days_dash, .minutes_dash, .seconds_dash {
32
  background: transparent url('images/light_bg_dash.png') 0 0 no-repeat;
33
  }
34
 
35
- .weeks_trip_dash, .days_trip_dash {
36
  background: transparent url('images/light_bg_trip_dash.png') 0 0 no-repeat;
37
  }
38
 
39
- .hours_dash {
40
  clear: left;
41
  background: transparent url('images/light_bg_dash.png') 0 0 no-repeat;
42
  }
43
 
44
- .digit {
45
  font: bold 20pt Verdana;
46
  font-weight: bold;
47
  float: left;
@@ -50,7 +57,7 @@
50
  position: relative;
51
  }
52
 
53
- .dash_title {
54
  -webkit-transform: rotate(-90deg);
55
  -moz-transform: rotate(-90deg);
56
  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
@@ -62,4 +69,10 @@
62
  color: #000;
63
  text-align: left;
64
  font-size: 9px;
 
 
 
 
 
 
65
  }
1
+ /*above the dashboard*/
2
+ .jedi-tophtml {
3
+ margin: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ /*above the dashboard*/
8
+ .jedi-dashboard {
9
  height: 100px;
10
  width: 250px;
11
  margin: 0 auto;
13
  padding-left: 0px;
14
  }
15
 
16
+ .jedi-dash {
17
  width: 62px;
18
  height: 44px;
19
  float: left;
24
  color: #333;
25
  }
26
 
27
+ .jedi-tripdash {
28
  width: 93px;
29
  height: 44px;
30
  float: left;
35
  color: #333;
36
  }
37
 
38
+ .jedi-weeks_dash, .jedi-days_dash, .jedi-minutes_dash, .jedi-seconds_dash {
39
  background: transparent url('images/light_bg_dash.png') 0 0 no-repeat;
40
  }
41
 
42
+ .jedi-weeks_trip_dash, .jedi-days_trip_dash {
43
  background: transparent url('images/light_bg_trip_dash.png') 0 0 no-repeat;
44
  }
45
 
46
+ .jedi-hours_dash {
47
  clear: left;
48
  background: transparent url('images/light_bg_dash.png') 0 0 no-repeat;
49
  }
50
 
51
+ .jedi-digit {
52
  font: bold 20pt Verdana;
53
  font-weight: bold;
54
  float: left;
57
  position: relative;
58
  }
59
 
60
+ .jedi-dash_title {
61
  -webkit-transform: rotate(-90deg);
62
  -moz-transform: rotate(-90deg);
63
  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
69
  color: #000;
70
  text-align: left;
71
  font-size: 9px;
72
+ }
73
+
74
+ /*below the dashboard*/
75
+ .jedi-bothtml {
76
+ margin: 0;
77
+ padding: 0;
78
  }
js/jquery.collapse.js ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ jQuery('.collapseomatic').livequery('click', function(event) {
3
+ //alert('phones ringin dude');
4
+ jQuery(this).toggleClass('close');
5
+ var id = jQuery(this).attr('id');
6
+ jQuery('#target-'+id).slideToggle('fast', function() {
7
+ // Animation complete.
8
+ });
9
+ });
10
+
11
+ jQuery('.rockstar').livequery('click', function(event) {
12
+ //alert('phones ringin dude');
13
+ //jQuery(this).toggleClass('close');
14
+ var id = jQuery(this).attr('id');
15
+ var key = jQuery(this).val();
16
+ jQuery('.isrockstar').each(function(){
17
+ jQuery(this).val('Rockstar Features:');
18
+ });
19
+ });
20
+ });
js/jquery.livequery.min.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ /* Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
2
+ * Dual licensed under the MIT (MIT_LICENSE.txt)
3
+ * and GPL Version 2 (GPL_LICENSE.txt) licenses.
4
+ *
5
+ * Version: 1.1.1
6
+ * Requires jQuery 1.3+
7
+ * Docs: http://docs.jquery.com/Plugins/livequery
8
+ */
9
+ (function(a){a.extend(a.fn,{livequery:function(e,d,c){var b=this,f;if(a.isFunction(e)){c=d,d=e,e=undefined}a.each(a.livequery.queries,function(g,h){if(b.selector==h.selector&&b.context==h.context&&e==h.type&&(!d||d.$lqguid==h.fn.$lqguid)&&(!c||c.$lqguid==h.fn2.$lqguid)){return(f=h)&&false}});f=f||new a.livequery(this.selector,this.context,e,d,c);f.stopped=false;f.run();return this},expire:function(e,d,c){var b=this;if(a.isFunction(e)){c=d,d=e,e=undefined}a.each(a.livequery.queries,function(f,g){if(b.selector==g.selector&&b.context==g.context&&(!e||e==g.type)&&(!d||d.$lqguid==g.fn.$lqguid)&&(!c||c.$lqguid==g.fn2.$lqguid)&&!this.stopped){a.livequery.stop(g.id)}});return this}});a.livequery=function(b,d,f,e,c){this.selector=b;this.context=d;this.type=f;this.fn=e;this.fn2=c;this.elements=[];this.stopped=false;this.id=a.livequery.queries.push(this)-1;e.$lqguid=e.$lqguid||a.livequery.guid++;if(c){c.$lqguid=c.$lqguid||a.livequery.guid++}return this};a.livequery.prototype={stop:function(){var b=this;if(this.type){this.elements.unbind(this.type,this.fn)}else{if(this.fn2){this.elements.each(function(c,d){b.fn2.apply(d)})}}this.elements=[];this.stopped=true},run:function(){if(this.stopped){return}var d=this;var e=this.elements,c=a(this.selector,this.context),b=c.not(e);this.elements=c;if(this.type){b.bind(this.type,this.fn);if(e.length>0){a.each(e,function(f,g){if(a.inArray(g,c)<0){a.event.remove(g,d.type,d.fn)}})}}else{b.each(function(){d.fn.apply(this)});if(this.fn2&&e.length>0){a.each(e,function(f,g){if(a.inArray(g,c)<0){d.fn2.apply(g)}})}}}};a.extend(a.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if(a.livequery.running&&a.livequery.queue.length){var b=a.livequery.queue.length;while(b--){a.livequery.queries[a.livequery.queue.shift()].run()}}},pause:function(){a.livequery.running=false},play:function(){a.livequery.running=true;a.livequery.run()},registerPlugin:function(){a.each(arguments,function(c,d){if(!a.fn[d]){return}var b=a.fn[d];a.fn[d]=function(){var e=b.apply(this,arguments);a.livequery.run();return e}})},run:function(b){if(b!=undefined){if(a.inArray(b,a.livequery.queue)<0){a.livequery.queue.push(b)}}else{a.each(a.livequery.queries,function(c){if(a.inArray(c,a.livequery.queue)<0){a.livequery.queue.push(c)}})}if(a.livequery.timeout){clearTimeout(a.livequery.timeout)}a.livequery.timeout=setTimeout(a.livequery.checkQueue,20)},stop:function(b){if(b!=undefined){a.livequery.queries[b].stop()}else{a.each(a.livequery.queries,function(c){a.livequery.queries[c].stop()})}}});a.livequery.registerPlugin("append","prepend","after","before","wrap","attr","removeAttr","addClass","removeClass","toggleClass","empty","remove","html");a(function(){a.livequery.play()})})(jQuery);
js/{jquery.lwtCountdown-1.0.js → jquery.lwtCountdown-1.1.js} RENAMED
@@ -33,19 +33,21 @@
33
  $.extend(config, options);
34
 
35
  diffSecs = this.setCountDown(config);
36
-
 
 
 
37
  if (config.onComplete){
38
  $.data($(this)[0], 'callback', config.onComplete);
39
  }
40
  if (config.omitWeeks){
41
  $.data($(this)[0], 'omitWeeks', config.omitWeeks);
42
  }
43
-
44
- $('#' + $(this).attr('id') + ' .digit').html('<div class="top"></div><div class="bottom"></div>');
45
  $(this).doCountDown($(this).attr('id'), diffSecs, 500);
46
-
47
  return this;
48
-
49
  };
50
 
51
  $.fn.stopCountDown = function () {
@@ -102,14 +104,15 @@
102
  days = Math.floor(diffSecs/60/60/24)%7;
103
  weeks = Math.floor(diffSecs/60/60/24/7);
104
  }
105
-
106
- $this.dashChangeTo(id, 'seconds_dash', secs, duration ? duration : 500);
107
- $this.dashChangeTo(id, 'minutes_dash', mins, duration ? duration : 1000);
108
- $this.dashChangeTo(id, 'hours_dash', hours, duration ? duration : 1000);
109
- $this.dashChangeTo(id, 'days_dash', days, duration ? duration : 1000);
110
- $this.dashChangeTo(id, 'days_trip_dash', days, duration ? duration : 1000);
111
- $this.dashChangeTo(id, 'weeks_dash', weeks, duration ? duration : 1000);
112
- $this.dashChangeTo(id, 'weeks_trip_dash', weeks, duration ? duration : 1000);
 
113
 
114
  $.data($this[0], 'diffSecs', diffSecs);
115
  if (diffSecs > 0){
@@ -126,11 +129,13 @@
126
 
127
  $.fn.dashChangeTo = function(id, dash, n, duration) {
128
  $this = $('#' + id);
 
 
129
  //loop through each digit and chage that dude
130
- for (var i=($this.find('.' + dash + ' .digit').length-1); i>=0; i--){
131
  var d = n%10;
132
  n = (n - d) / 10;
133
- $this.digitChangeTo('#' + $this.attr('id') + ' .' + dash + ' .digit:eq('+i+')', d, duration);
134
  }
135
  };
136
 
33
  $.extend(config, options);
34
 
35
  diffSecs = this.setCountDown(config);
36
+
37
+ style = config.style;
38
+ $.data($(this)[0], 'style', config.style);
39
+
40
  if (config.onComplete){
41
  $.data($(this)[0], 'callback', config.onComplete);
42
  }
43
  if (config.omitWeeks){
44
  $.data($(this)[0], 'omitWeeks', config.omitWeeks);
45
  }
46
+
47
+ $('#' + $(this).attr('id') + ' .' + style + '-digit').html('<div class="top"></div><div class="bottom"></div>');
48
  $(this).doCountDown($(this).attr('id'), diffSecs, 500);
49
+
50
  return this;
 
51
  };
52
 
53
  $.fn.stopCountDown = function () {
104
  days = Math.floor(diffSecs/60/60/24)%7;
105
  weeks = Math.floor(diffSecs/60/60/24/7);
106
  }
107
+
108
+ style = $.data($this[0], 'style');
109
+ $this.dashChangeTo(id, style + '-seconds_dash', secs, duration ? duration : 500);
110
+ $this.dashChangeTo(id, style + '-minutes_dash', mins, duration ? duration : 1000);
111
+ $this.dashChangeTo(id, style + '-hours_dash', hours, duration ? duration : 1000);
112
+ $this.dashChangeTo(id, style + '-days_dash', days, duration ? duration : 1000);
113
+ $this.dashChangeTo(id, style + '-days_trip_dash', days, duration ? duration : 1000);
114
+ $this.dashChangeTo(id, style + '-weeks_dash', weeks, duration ? duration : 1000);
115
+ $this.dashChangeTo(id, style + '-weeks_trip_dash', weeks, duration ? duration : 1000);
116
 
117
  $.data($this[0], 'diffSecs', diffSecs);
118
  if (diffSecs > 0){
129
 
130
  $.fn.dashChangeTo = function(id, dash, n, duration) {
131
  $this = $('#' + id);
132
+ style = $.data($this[0], 'style');
133
+
134
  //loop through each digit and chage that dude
135
+ for (var i=($this.find('.' + dash + ' .' + style + '-digit').length-1); i>=0; i--){
136
  var d = n%10;
137
  n = (n - d) / 10;
138
+ $this.digitChangeTo('#' + $this.attr('id') + ' .' + dash + ' .' + style + '-digit:eq('+i+')', d, duration);
139
  }
140
  };
141
 
readme.txt CHANGED
@@ -1,17 +1,17 @@
1
- === Plugin Name ===
2
 
3
  Contributors: Twinpictures, G2, littlewebthings
4
- Donate link: http://www.twinpictures.de/t-minus-countdown-widget/
5
  Tags: countdown, timer, clock, ticker, widget, event, counter, count down, t minus, t-minus, twinpictures, G2, spaceBros, littlewebtings, jQuery, javascript
6
- Requires at least: 2.7
7
- Tested up to: 3.0.1
8
- Stable tag: 1.7
9
 
10
- jQuery T Minus CountDown Widget displays a highly customizable, sweet-n-sexy flash-free countdown timer in the sidebar.
11
 
12
  == Description ==
13
 
14
- jQuery T Minus CountDown Widget will display a sweet, sexy and totally flash-free countdown timer clock based on littlewebthings' CountDown jQuery plugin. Perfect for informing one's website visitors of an upcoming event, such as a pending space voyage. Using Jedi Mindtricks and CSS... but mostly CSS, the countdown timer is highly customizable for your viewing pleasure. Intergalactic planetary thanks to G2 (www.g2.de) and Lauren (www.siliconstudio.com) for the included css flavors.
15
 
16
  == Installation ==
17
 
@@ -26,29 +26,31 @@ jQuery T Minus CountDown Widget will display a sweet, sexy and totally flash-fre
26
 
27
  == Frequently Asked Questions ==
28
 
29
- = How do I create custom styles? =
30
-
31
- 1. create a new sub-folder in the plugin's css folder
32
- 1. name the css file style.css
33
- 1. select the new style in the widget settings, save and that's it.
34
 
35
  = How does one pronounce T Minus? =
36
-
37
  1. Tee - As in Tea for Two, or Tee off time
38
  1. Minus - As in the opposite of plus (+)
39
  1. T Minus- As in "This is Apollo Saturn Launch Control. We've passed the 11-minute mark. Now T minus 10 minutes 54 seconds on our countdown for Apollo 11."
40
 
41
  = Where can I get reliable news that makes me giggle? =
42
-
43
  The Daily Show with John Stewart
44
 
45
  == Screenshots ==
46
 
47
- 1. Here, in screenshot-1.png an expansive view of the available `jQuery T Minus CountDown Widget` options hs been provided for your viewing pleasure.
48
- 2. screenshot-2.png catches the `jQuery T Minus CountDown Widget` in some hot on-page action. Take care, number 7, your scene is next.
 
49
 
50
  == Changelog ==
51
 
 
 
 
 
 
 
52
  = 1.7 =
53
  * 1.6 had completely different file structure that hosed the svn repository.
54
 
@@ -77,6 +79,9 @@ The Daily Show with John Stewart
77
 
78
  == Upgrade Notice ==
79
 
 
 
 
80
  = 1.7 =
81
  1.6 failed to upload correctly to svn... very messed up situation
82
 
1
+ === jQuery T Minus CountDown Widget ===
2
 
3
  Contributors: Twinpictures, G2, littlewebthings
4
+ Donate link: http://www.twinpictures.de/jquery-t-minus-2-0/
5
  Tags: countdown, timer, clock, ticker, widget, event, counter, count down, t minus, t-minus, twinpictures, G2, spaceBros, littlewebtings, jQuery, javascript
6
+ Requires at least: 2.8
7
+ Tested up to: 3.1
8
+ Stable tag: 2.0
9
 
10
+ jQuery T(-) CountDown v2.0 will dispaly a highly customizable, sweet-n-sexy flash-free countdown timer in the sidebar or in your post using a shortcode.
11
 
12
  == Description ==
13
 
14
+ jQuery T(-) CountDown v2.0 will display a sweet, sexy and totally flash-free countdown timer clock based on littlewebthings' CountDown jQuery plugin. Perfect for informing one's website visitors of an upcoming event, such as a pending space voyage. Using Jedi Mindtricks and CSS... but mostly CSS, the countdown timer is highly customizable for your viewing pleasure. Intergalactic planetary thanks to G2 (www.g2.de) and Lauren (www.siliconstudio.com) for the included css flavors.
15
 
16
  == Installation ==
17
 
26
 
27
  == Frequently Asked Questions ==
28
 
29
+ = How does one use the shortcode, exactly? =
30
+ A <a href='http://www.twinpictures.de/jquery-t-minus-2-0/'>complete listing of shortcode options</a> has been provided to answer this exact question.
 
 
 
31
 
32
  = How does one pronounce T Minus? =
 
33
  1. Tee - As in Tea for Two, or Tee off time
34
  1. Minus - As in the opposite of plus (+)
35
  1. T Minus- As in "This is Apollo Saturn Launch Control. We've passed the 11-minute mark. Now T minus 10 minutes 54 seconds on our countdown for Apollo 11."
36
 
37
  = Where can I get reliable news that makes me giggle? =
 
38
  The Daily Show with John Stewart
39
 
40
  == Screenshots ==
41
 
42
+ 1. screenshot-1.png shows the jQuery T(-) CountDown in action with the three included styles: Darth, Jedi and Carbonite.
43
+ 2. Here, in screenshot-2.png is are the basic `jQuery T(-) CountDown` options.
44
+ 3. screenshot-3.png shows an expansive view of the available `jQuery T(-) CountDown` options that have been provided for your viewing pleasure.
45
 
46
  == Changelog ==
47
 
48
+ = 2.0 =
49
+ * Multiple instance sidebar widgets.
50
+ * Advanced above and below HTML areas.
51
+ * Advanced 'on-launch' event that will display custom HTML in a target area when the countdown reaches 00:00:00.
52
+ * Added shortcode to include mulitple countdowns in post and pages.
53
+
54
  = 1.7 =
55
  * 1.6 had completely different file structure that hosed the svn repository.
56
 
79
 
80
  == Upgrade Notice ==
81
 
82
+ = 2.0 =
83
+ Requires WordPress version 2.8 or higher. Backup custom CSS folders.
84
+
85
  = 1.7 =
86
  1.6 failed to upload correctly to svn... very messed up situation
87
 
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png ADDED
Binary file