T(-) Countdown - Version 1.2

Version Description

  • Reverted to the standard jQuery Library that comes with WordPress as it was conflicting with the TinyMCE/Visual Editor. To gain jQuery Google Caching, give the "Use Google Libraries" Plugin a whirl.
Download this release

Release Info

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

Version 1.2

countdown-timer.php ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: jQuery T(-) Countdown Widget
4
+ Plugin URI: http://www.twinpictures.de/t-countdown-widget
5
+ Description: Display and configure a jQuery countdown timer as a sidebar widget.
6
+ Version: 1.2
7
+ Author: Twinpictures
8
+ Author URI: http://www.twinpictures.de
9
+ License: GPL2
10
+ */
11
+
12
+ /* Copyright 2010 Twinpictures (www.twinpictures.de)
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License, version 2, as
16
+ published by the Free Software Foundation.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
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 - 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 (), '1.0' );
45
+ wp_enqueue_script('countdown-script');
46
+ }
47
+ }
48
+
49
+
50
+
51
+ // Inserts scripts into header
52
+ add_action( 'wp_print_scripts', 'countdown_script' );
53
+
54
+
55
+ //the widget
56
+ function widget_countdown_timer_init() {
57
+
58
+ if ( !function_exists('register_sidebar_widget') )
59
+ return;
60
+
61
+ function sanitizer($name) {
62
+ $name = strtolower($name); // all lowercase
63
+ $name = preg_replace('/[^a-z0-9 ]/','', $name); // nothing but a-z 0-9 and spaces
64
+ $name = preg_replace('/\s+/','-', $name); // spaces become hyphens
65
+ return $name;
66
+ }
67
+
68
+ //widget css
69
+ function countdown_style($args){
70
+ $plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
71
+ if (!is_admin()){
72
+ //css
73
+ $options = array_merge(widget_countdown_options(), get_option('widget_countdown'));
74
+ unset($options[0]); //returned by get_option(), but we don't need it
75
+ if($options['style'] == 'light'){
76
+ wp_register_style( 'countdown-css', $plugin_url.'/css/light-style.css', array (), '1.0' );
77
+ }
78
+ else{
79
+ wp_register_style( 'countdown-css', $plugin_url.'/css/dark-style.css', array (), '1.0' );
80
+ }
81
+ wp_enqueue_style( 'countdown-css' );
82
+ }
83
+ }
84
+
85
+ //insert some style into your life
86
+ add_action( 'wp_print_styles', 'countdown_style' );
87
+
88
+ // Options and default values for this widget
89
+ function widget_countdown_options() {
90
+ return array(
91
+ 'title' => 'Countdown',
92
+ 'description' => '',
93
+ 'url' => '',
94
+ 'urltarget' => '_blank',
95
+ 'urltext' => '',
96
+ 'urlpos' => 'bottom',
97
+ 'day' => 15,
98
+ 'month' => 10,
99
+ 'year' => 2010,
100
+ 'hour' => 20,
101
+ 'min' => 0,
102
+ 'sec' => 0,
103
+ 'weektitle' => 'weeks',
104
+ 'daytitle' => 'days',
105
+ 'hourtitle' => 'hours',
106
+ 'mintitle' => 'minutes',
107
+ 'sectitle' => 'seconds',
108
+ 'omitweeks' => 'false',
109
+ 'style' => 'light'
110
+ );
111
+ }
112
+
113
+ function widget_countdown($args) {
114
+ $options = array_merge(widget_countdown_options(), get_option('widget_countdown'));
115
+ unset($options[0]); //returned by get_option(), but we don't need it
116
+
117
+ //calc the inital difference
118
+ $now = time();
119
+ $target = mktime(
120
+ $options['hour'],
121
+ $options['min'],
122
+ $options['sec'],
123
+ $options['month'],
124
+ $options['day'],
125
+ $options['year']
126
+ );
127
+
128
+ $diffSecs = $target - $now;
129
+
130
+ $date = array();
131
+ $date['secs'] = $diffSecs % 60;
132
+ $date['mins'] = floor($diffSecs/60)%60;
133
+ $date['hours'] = floor($diffSecs/60/60)%24;
134
+ $date['days'] = floor($diffSecs/60/60/24)%7;
135
+ $date['weeks'] = floor($diffSecs/60/60/24/7);
136
+
137
+ foreach ($date as $i => $d) {
138
+ $d1 = $d%10;
139
+ $d2 = ($d-$d1) / 10;
140
+ $date[$i] = array(
141
+ (int)$d2,
142
+ (int)$d1,
143
+ (int)$d
144
+ );
145
+ }
146
+
147
+ echo $before_widget;
148
+ if($options['title']){
149
+ echo $before_title . $options['title'] . $after_title;
150
+ }
151
+ if($options['description']){
152
+ echo '<p>'. $options['description'] .'</p>';
153
+ }
154
+ if($options['url'] && $options['urlpos'] == 'top'){
155
+ echo '<a href="'. $options['url'] .'" target="'. $options['urltarget'] .'">'. $options['urltext'] .'</a>';
156
+ }
157
+
158
+ echo '<div id="countdown_dashboard">';
159
+
160
+ if($options['omitweeks'] == 'false'){
161
+ echo '<div class="dash weeks_dash">
162
+ <span class="dash_title">'.$options['weektitle'].'</span>
163
+ <div class="digit">'.$date['weeks'][0].'</div>
164
+ <div class="digit">'.$date['weeks'][1].'</div>
165
+ </div>';
166
+ }
167
+
168
+ echo '<div class="dash days_dash">
169
+ <span class="dash_title">'.$options['daytitle'].'</span>
170
+ <div class="digit">'.$date['days'][0].'</div>
171
+ <div class="digit">'.$date['days'][1].'</div>
172
+ </div>
173
+
174
+ <div class="dash hours_dash">
175
+ <span class="dash_title">'.$options['hourtitle'].'</span>
176
+ <div class="digit">'.$date['hours'][0].'</div>
177
+ <div class="digit">'.$date['hours'][1].'</div>
178
+ </div>
179
+
180
+ <div class="dash minutes_dash">
181
+ <span class="dash_title">'.$options['mintitle'].'</span>
182
+ <div class="digit">'.$date['mins'][0].'</div>
183
+ <div class="digit">'.$date['mins'][1].'</div>
184
+ </div>
185
+
186
+ <div class="dash seconds_dash">
187
+ <span class="dash_title">'.$options['sectitle'].'</span>
188
+ <div class="digit">'.$date['secs'][0].'</div>
189
+ <div class="digit">'.$date['secs'][1].'</div>
190
+ </div>
191
+ </div>';
192
+ if($options['url'] && $options['urlpos'] == 'bottom'){
193
+ echo '<a href="'. $options['url'] .'" target="'. $options['urltarget'] .'">'. $options['urltext'] .'</a>';
194
+ }
195
+ //echo '<p>Phones riggin dude!</p>';
196
+ echo $after_widget;
197
+ }
198
+
199
+ //add the script to the footer
200
+ function jquery_countdown_js($args){
201
+ $options = array_merge(widget_countdown_options(), get_option('widget_countdown'));
202
+ unset($options[0]); //returned by get_option(), but we don't need it
203
+ ?>
204
+ <script language="javascript" type="text/javascript">
205
+ jQuery(document).ready(function() {
206
+ //alert('Phones Ringin, Dude.');
207
+ jQuery('#countdown_dashboard').countDown({
208
+ targetDate: {
209
+ 'day': <?php echo $options['day']; ?>,
210
+ 'month': <?php echo $options['month']; ?>,
211
+ 'year': <?php echo $options['year']; ?>,
212
+ 'hour': <?php echo $options['hour']; ?>,
213
+ 'min': <?php echo $options['min']; ?>,
214
+ 'sec': <?php echo $options['sec']; ?>
215
+ },
216
+ omitWeeks: <?php echo $options['omitweeks']; ?>
217
+ });
218
+
219
+ });
220
+ </script>
221
+ <?php
222
+ }
223
+
224
+ add_action('wp_head','jquery_countdown_js');
225
+
226
+
227
+ //add the widget control form
228
+ function widget_countdown_control() {
229
+ if(($options = get_option('widget_countdown')) === FALSE) $options = array();
230
+ $options = array_merge(widget_countdown_options(), $options);
231
+ unset($options[0]); //returned by get_option(), but we don't need it
232
+
233
+ // If user is submitting custom option values for this widget
234
+ if ( $_POST['countdown-submit'] ) {
235
+ // Remember to sanitize and format use input appropriately.
236
+ foreach($options as $key => $value){
237
+ $options[$key] = strip_tags(stripslashes($_POST['countdown-'.sanitizer($key)]));
238
+ }
239
+
240
+ // Save changes
241
+ update_option('widget_countdown', $options);
242
+ }
243
+
244
+ // title option
245
+ 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>';
246
+
247
+ //description
248
+ 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>';
249
+
250
+ //url
251
+ 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>';
252
+
253
+ //url target
254
+ 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>';
255
+
256
+ //url text
257
+ 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>';
258
+
259
+ //url position Slector
260
+ $dom = '';
261
+ $sub = '';
262
+ if($options['urlpos'] == 'top'){
263
+ $dom = 'CHECKED';
264
+ }
265
+ else{
266
+ $sub = 'CHECKED';
267
+ }
268
+
269
+ //Is the link a top or a bottom?
270
+ 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>';
271
+
272
+ //Target Date
273
+ 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>';
274
+
275
+ //Target Time
276
+ 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>';
277
+
278
+ //weeks text
279
+ 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>';
280
+
281
+ //days text
282
+ 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>';
283
+
284
+ //hours text
285
+ 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>';
286
+
287
+ //minutes text
288
+ 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>';
289
+
290
+ //seconds text
291
+ 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>';
292
+
293
+
294
+ //Omit Week Slector
295
+ $negative = '';
296
+ $positive = '';
297
+ if($options['omitweeks'] == 'false'){
298
+ $negative = 'CHECKED';
299
+ }
300
+ else{
301
+ $positive = 'CHECKED';
302
+ }
303
+
304
+ //Omit Weeks
305
+ 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>';
306
+
307
+ //style Slector
308
+ $light = '';
309
+ $dark = '';
310
+ if($options['style'] == 'light'){
311
+ $light = 'CHECKED';
312
+ }
313
+ else{
314
+ $dark = 'CHECKED';
315
+ }
316
+
317
+ //Light or Dark Style? You choose!
318
+ 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="light" /> Jedi </label><input id="countdown-style" name="countdown-style" type="radio" '.$dark.' value="dark" /> Darth </label> </p>';
319
+
320
+
321
+ // Submit
322
+ echo '<input type="hidden" id="countdown-submit" name="countdown-submit" value="1" />';
323
+ }
324
+ // This registers our widget so it appears with the other available
325
+ // widgets and can be dragged and dropped into any active sidebars.
326
+ //register_sidebar_widget('jQuery T(-) CountDown', 'widget_countdown');
327
+ wp_register_sidebar_widget( 'jquery-countdown', 'jQuery T(-) CountDown', 'widget_countdown');
328
+
329
+ // This registers our optional widget control form.
330
+ wp_register_widget_control('jquery-countdown', 'jQuery T(-) CountDown', 'widget_countdown_control');
331
+ }
332
+
333
+ // Run code later in case this loads prior to any required plugins.
334
+ add_action('plugins_loaded', 'widget_countdown_timer_init');
335
+
336
+ ?>
css/dark-style.css ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #countdown_dashboard {
2
+ height: 100px;
3
+ width: 250px;
4
+ margin: 0 auto;
5
+ background: transparent;
6
+ padding-left: 0px;
7
+ }
8
+
9
+ .dash {
10
+ width: 62px;
11
+ height: 44px;
12
+ background: transparent url('../images/dash.png') 0 0 no-repeat;
13
+ float: left;
14
+ margin-left: 2px;
15
+ padding-left: 10px;
16
+ padding-top: 5px;
17
+ position: relative;
18
+ color: #333;
19
+ }
20
+
21
+ .weeks_dash, .days_dash, .minutes_dash, .seconds_dash {
22
+ background: transparent url('../images/dark_bg_dash.png') 0 0 no-repeat;
23
+ }
24
+
25
+ .hours_dash {
26
+ clear: left;
27
+ background: transparent url('../images/dark_bg_dash.png') 0 0 no-repeat;
28
+ }
29
+
30
+ .dash .digit {
31
+ font: bold 20pt Verdana;
32
+ font-weight: bold;
33
+ float: left;
34
+ width: 22px;
35
+ text-align: center;
36
+ position: relative;
37
+ }
38
+
39
+ .dash_title {
40
+ -webkit-transform: rotate(-90deg);
41
+ -moz-transform: rotate(-90deg);
42
+ filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
43
+ display: block;
44
+ position: absolute;
45
+ left: -15px;
46
+ top: 18px;
47
+ width:28px;
48
+ color: #fff;
49
+ text-align: left;
50
+ font-size: 9px;
51
+ }
52
+
53
+ .faded {
54
+ color: #999;
55
+ }
56
+
57
+ #loading {
58
+ text-align: center;
59
+ margin: 10px;
60
+ display: none;
61
+ position: absolute;
62
+ width: 100%;
63
+ top: 60px;
64
+ }
css/light-style.css ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #countdown_dashboard {
2
+ height: 100px;
3
+ width: 250px;
4
+ margin: 0 auto;
5
+ background: transparent;
6
+ padding-left: 0px;
7
+ }
8
+
9
+ .dash {
10
+ width: 62px;
11
+ height: 44px;
12
+ background: transparent url('../images/dash.png') 0 0 no-repeat;
13
+ float: left;
14
+ margin-left: 2px;
15
+ padding-left: 10px;
16
+ padding-top: 5px;
17
+ position: relative;
18
+ color: #333;
19
+ }
20
+
21
+ .weeks_dash, .days_dash, .minutes_dash, .seconds_dash {
22
+ background: transparent url('../images/light_bg_dash.png') 0 0 no-repeat;
23
+ }
24
+
25
+ .hours_dash {
26
+ clear: left;
27
+ background: transparent url('../images/light_bg_dash.png') 0 0 no-repeat;
28
+ }
29
+
30
+ .dash .digit {
31
+ font: bold 20pt Verdana;
32
+ font-weight: bold;
33
+ float: left;
34
+ width: 22px;
35
+ text-align: center;
36
+ position: relative;
37
+ }
38
+
39
+ .dash_title {
40
+ -webkit-transform: rotate(-90deg);
41
+ -moz-transform: rotate(-90deg);
42
+ filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
43
+ display: block;
44
+ position: absolute;
45
+ left: -15px;
46
+ top: 16px;
47
+ width:28px;
48
+ color: #000;
49
+ text-align: left;
50
+ font-size: 9px;
51
+ }
52
+
53
+ .faded {
54
+ color: #999;
55
+ }
56
+
57
+ #loading {
58
+ text-align: center;
59
+ margin: 10px;
60
+ display: none;
61
+ position: absolute;
62
+ width: 100%;
63
+ top: 60px;
64
+ }
images/dark_bg_dash.png ADDED
Binary file
images/dash.png ADDED
Binary file
images/light_bg_dash.png ADDED
Binary file
images/loading.gif ADDED
Binary file
js/jquery.lwtCountdown-1.0.js ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery Countdown plugin v1.0
3
+ * http://www.littlewebthings.com/projects/countdown/
4
+ *
5
+ * Copyright 2010, Vassilis Dourdounis
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
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
+ (function($){
26
+
27
+ $.fn.countDown = function (options) {
28
+ config = {};
29
+
30
+ $.extend(config, options);
31
+
32
+ diffSecs = this.setCountDown(config);
33
+
34
+ if (config.onComplete)
35
+ {
36
+ $.data($(this)[0], 'callback', config.onComplete);
37
+ }
38
+ if (config.omitWeeks)
39
+ {
40
+ $.data($(this)[0], 'omitWeeks', config.omitWeeks);
41
+ }
42
+
43
+ $('#' + $(this).attr('id') + ' .digit').html('<div class="top"></div><div class="bottom"></div>');
44
+ $(this).doCountDown($(this).attr('id'), diffSecs, 500);
45
+
46
+ return this;
47
+
48
+ };
49
+
50
+ $.fn.stopCountDown = function () {
51
+ clearTimeout($.data(this[0], 'timer'));
52
+ };
53
+
54
+ $.fn.startCountDown = function () {
55
+ this.doCountDown($(this).attr('id'),$.data(this[0], 'diffSecs'), 500);
56
+ };
57
+
58
+ $.fn.setCountDown = function (options) {
59
+ var targetTime = new Date();
60
+
61
+ if (options.targetDate)
62
+ {
63
+ 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' : ''));
64
+ }
65
+ else if (options.targetOffset)
66
+ {
67
+ targetTime.setFullYear(options.targetOffset.year + targetTime.getFullYear());
68
+ targetTime.setMonth(options.targetOffset.month + targetTime.getMonth());
69
+ targetTime.setDate(options.targetOffset.day + targetTime.getDate());
70
+ targetTime.setHours(options.targetOffset.hour + targetTime.getHours());
71
+ targetTime.setMinutes(options.targetOffset.min + targetTime.getMinutes());
72
+ targetTime.setSeconds(options.targetOffset.sec + targetTime.getSeconds());
73
+ }
74
+
75
+ var nowTime = new Date();
76
+
77
+ diffSecs = Math.floor((targetTime.valueOf()-nowTime.valueOf())/1000);
78
+
79
+ $.data(this[0], 'diffSecs', diffSecs);
80
+
81
+ return diffSecs;
82
+ };
83
+
84
+ $.fn.doCountDown = function (id, diffSecs, duration) {
85
+ $this = $('#' + id);
86
+ if (diffSecs <= 0)
87
+ {
88
+ diffSecs = 0;
89
+ if ($.data($this[0], 'timer'))
90
+ {
91
+ clearTimeout($.data($this[0], 'timer'));
92
+ }
93
+ }
94
+
95
+ secs = diffSecs % 60;
96
+ mins = Math.floor(diffSecs/60)%60;
97
+ hours = Math.floor(diffSecs/60/60)%24;
98
+ if ($.data($this[0], 'omitWeeks') == true)
99
+ {
100
+ days = Math.floor(diffSecs/60/60/24);
101
+ weeks = Math.floor(diffSecs/60/60/24/7);
102
+ }
103
+ else
104
+ {
105
+ days = Math.floor(diffSecs/60/60/24)%7;
106
+ weeks = Math.floor(diffSecs/60/60/24/7);
107
+ }
108
+
109
+ $this.dashChangeTo(id, 'seconds_dash', secs, duration ? duration : 500);
110
+ $this.dashChangeTo(id, 'minutes_dash', mins, duration ? duration : 1000);
111
+ $this.dashChangeTo(id, 'hours_dash', hours, duration ? duration : 1000);
112
+ $this.dashChangeTo(id, 'days_dash', days, duration ? duration : 1000);
113
+ $this.dashChangeTo(id, 'weeks_dash', weeks, duration ? duration : 1000);
114
+
115
+ $.data($this[0], 'diffSecs', diffSecs);
116
+ if (diffSecs > 0)
117
+ {
118
+ e = $this;
119
+ t = setTimeout(function() { e.doCountDown(id, diffSecs-1) } , 1000);
120
+ $.data(e[0], 'timer', t);
121
+ }
122
+ else if (cb = $.data($this[0], 'callback'))
123
+ {
124
+ $.data($this[0], 'callback')();
125
+ }
126
+
127
+ };
128
+
129
+ $.fn.dashChangeTo = function(id, dash, n, duration) {
130
+ $this = $('#' + id);
131
+
132
+ for (var i=($this.find('.' + dash + ' .digit').length-1); i>=0; i--)
133
+ {
134
+ var d = n%10;
135
+ n = (n - d) / 10;
136
+ $this.digitChangeTo('#' + $this.attr('id') + ' .' + dash + ' .digit:eq('+i+')', d, duration);
137
+ }
138
+ };
139
+
140
+ $.fn.digitChangeTo = function (digit, n, duration) {
141
+ if (!duration)
142
+ {
143
+ duration = 500;
144
+ }
145
+ if ($(digit + ' div.top').html() != n + '')
146
+ {
147
+
148
+ $(digit + ' div.top').css({'display': 'none'});
149
+ // $(digit + ' div.bottom').css({'border-top': '1px solid #666'});
150
+ $(digit + ' div.top').html((n ? n : '0')).slideDown(duration);
151
+
152
+ $(digit + ' div.bottom').animate({'height': ''}, duration, function() {
153
+ $(digit + ' div.bottom').html($(digit + ' div.top').html());
154
+ $(digit + ' div.bottom').css({'display': 'block', 'height': ''});
155
+ // $(digit + ' div.bottom').css({'border-top': 'none'});
156
+ $(digit + ' div.top').hide().slideUp(10);
157
+
158
+
159
+ });
160
+ }
161
+ };
162
+
163
+ })(jQuery);
164
+
165
+
readme.txt ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: Twinpictures, G2, littlewebthings
3
+ Donate link: http://www.twinpictures.de/t-minus-countdown-widget
4
+ Tags: countdown, timer, clock, ticker, widget, event, counter, count down, t (-), t (minus), t-minus, t minus, spaceBros, littlewebtings
5
+ Requires at least: 2.7
6
+ Tested up to: 3.0.1
7
+ Stable tag: 1.2
8
+
9
+ jQuery T(-) CountDown Widget is a sidebar widget that will display a sexy countdown timer based on littlewebtings CountDown plugin.
10
+
11
+ == Description ==
12
+
13
+ jQuery T(-) CountDown Widget will display a sexy, flash-free countdown timer based on littlewebthings CountDown jQuery plugin (http://www.littlewebthings.com/projects/countdown/). Perfect for informing website visitors of an upcomming event, such as a new post or even a pending space voyage. As yes, there is also a css jedi mindtrick for your viewing pleasure--intergalactic planatary thanks to G2 (Gagarin2) of SpaceBros. Own your time and space.
14
+
15
+ == Installation ==
16
+
17
+ 1. Old-school: upload the `jquery-countdown-timer` folder to the `/wp-content/plugins/` directory via FTP. Hipster: Add the jQuery T(minus) CountDown Widget via the WordPress Plugins menu.
18
+ 1. Activate the Plugin
19
+ 1. Add the Widget to the desired sidebar in the WordPress Widgets menu.
20
+ 1. Configure the `jQuery T(-) CountDown Widget' options.
21
+ 1. Test that the this plugin meets your demanding needs.
22
+ 1. Tweak the css files for premium enjoyment.
23
+ 1. Rate the plugin and verify that it works at wordpress.org.
24
+ 1. Leave a comment regarding bugs, feature request, cocktail recipes at http://www.twinpictures.de/t-minus-countdown-widget/
25
+
26
+ == Frequently Asked Questions ==
27
+
28
+ = How does one pronounce T(-)? =
29
+
30
+ 1. Tee - As in Tea for Two, or Tee off time
31
+ 1. Minus - As in the opposite of plus (+)
32
+ 1. T(-) - 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."
33
+
34
+ = Where can I get reliable news that makes me giggle? =
35
+
36
+ The Daily Show with John Stewart
37
+
38
+ == Screenshots ==
39
+
40
+ 1. Here, in screenshot-1.png an expansive view of the available `jQuery T(-) CountDown Widget` options hs been provided for your viewing pleasure.
41
+ 2. screenshot-2.png catches the `jQuery T(-) CountDown Widget` in some hot on-page action. Take care, number 7, your scene is next.
42
+
43
+ == Changelog ==
44
+
45
+ = 1.2 =
46
+ * Reverted to the standard jQuery Library that comes with WordPress as it was conflicting with the TinyMCE/Visual Editor. To gain jQuery Google Caching, give the "Use Google Libraries" Plugin a whirl.
47
+
48
+ = 1.1 =
49
+ * Squashed a bug that caused PHP to throw an extract() warning on some systems.
50
+
51
+ = 1.0 =
52
+ * The plugin came to be.
53
+
54
+ == Upgrade Notice ==
55
+
56
+ = 1.2 =
57
+ Version 1.2 fixes the issue that disabled the TinyMCE/Visual Editor.
58
+
59
+ = 1.1 =
60
+ Version 1.1 fixes the extract() warning that was being thrown on some systems.
61
+
62
+ = 1.0 =
63
+ Where once there was not, there now is.
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file