Ditty News Ticker - Version 1.1.0

Version Description

  • Added "width" override for scrolling tickers back in... whoops!
Download this release

Release Info

Developer metaphorcreations
Plugin Icon 128x128 Ditty News Ticker
Version 1.1.0
Comparing to
See all releases

Code changes from version 1.0.9 to 1.1.0

assets/js/ditty-news-ticker.js CHANGED
@@ -3,7 +3,7 @@
3
  * Date: 3/10/2013
4
  *
5
  * @author Metaphor Creations
6
- * @version 1.0.8
7
  *
8
  **/
9
 
@@ -59,6 +59,7 @@
59
  ticker_height = 0,
60
  ticks = [],
61
  ticker_scroll,
 
62
  ticker_delay,
63
  rotate_adjustment = settings.rotate_type,
64
  after_change_timeout,
@@ -92,9 +93,16 @@
92
  /**
93
  * Setup the ticker scroll
94
  *
95
- * @since 1.0.0
96
  */
97
  function mtphr_dnt_scroll_setup() {
 
 
 
 
 
 
 
98
 
99
  // Loop through the tick items
100
  $ticker.find('.mtphr-dnt-tick').each( function(index) {
@@ -130,13 +138,17 @@
130
  break;
131
 
132
  case 'up':
133
- $(this).css('width',ticker_width);
 
 
134
  position = parseInt(ticker_height);
135
  $(this).css('top',position+'px');
136
  break;
137
 
138
  case 'down':
139
- $(this).css('width',ticker_width);
 
 
140
  position = parseInt('-'+$(this).height());
141
  $(this).css('top',position+'px');
142
  break;
@@ -329,7 +341,7 @@
329
  /**
330
  * Resize the scroll ticks
331
  *
332
- * @since 1.0.0
333
  */
334
  function mtphr_dnt_scroll_resize_ticks() {
335
 
@@ -356,7 +368,9 @@
356
  break;
357
 
358
  case 'up':
359
- $tick.css('width',ticker_width);
 
 
360
  position = parseInt(ticker_height);
361
  if( ticks[i][0].visible == false ) {
362
  $tick.css('top',position+'px');
@@ -364,7 +378,9 @@
364
  break;
365
 
366
  case 'down':
367
- $tick.css('width',ticker_width);
 
 
368
  position = parseInt('-'+$tick.height());
369
  if( ticks[i][0].visible == false ) {
370
  $tick.css('top',position+'px');
@@ -385,7 +401,7 @@
385
  /**
386
  * Reset the scroller for vertical scrolls
387
  *
388
- * @since 1.0.9
389
  */
390
  function mtphr_dnt_scroll_reset_ticks() {
391
 
@@ -407,13 +423,17 @@
407
  break;
408
 
409
  case 'up':
410
- $tick.css('width',ticker_width);
 
 
411
  position = parseInt(ticker_height);
412
  $tick.css('top',position+'px');
413
  break;
414
 
415
  case 'down':
416
- $tick.css('width',ticker_width);
 
 
417
  position = parseInt('-'+$(this).height());
418
  $tick.css('top',position+'px');
419
  break;
@@ -791,7 +811,11 @@
791
 
792
  if( settings.type == 'scroll' ) {
793
  if( settings.scroll_direction=='up' || settings.scroll_direction=='down' ) {
794
- mtphr_dnt_scroll_reset_ticks();
 
 
 
 
795
  } else {
796
  mtphr_dnt_scroll_resize_ticks();
797
  }
3
  * Date: 3/10/2013
4
  *
5
  * @author Metaphor Creations
6
+ * @version 1.1.0
7
  *
8
  **/
9
 
59
  ticker_height = 0,
60
  ticks = [],
61
  ticker_scroll,
62
+ ticker_scroll_resize = true,
63
  ticker_delay,
64
  rotate_adjustment = settings.rotate_type,
65
  after_change_timeout,
93
  /**
94
  * Setup the ticker scroll
95
  *
96
+ * @since 1.1.0
97
  */
98
  function mtphr_dnt_scroll_setup() {
99
+
100
+ var $first = $ticker.find('.mtphr-dnt-tick:first');
101
+ if( $first.attr('style') ) {
102
+ var style = $first.attr('style');
103
+ var style_array = style.split('width:');
104
+ ticker_scroll_resize = (style_array.length > 1) ? false : true;
105
+ }
106
 
107
  // Loop through the tick items
108
  $ticker.find('.mtphr-dnt-tick').each( function(index) {
138
  break;
139
 
140
  case 'up':
141
+ if( ticker_scroll_resize ) {
142
+ $(this).css('width',ticker_width);
143
+ }
144
  position = parseInt(ticker_height);
145
  $(this).css('top',position+'px');
146
  break;
147
 
148
  case 'down':
149
+ if( ticker_scroll_resize ) {
150
+ $(this).css('width',ticker_width);
151
+ }
152
  position = parseInt('-'+$(this).height());
153
  $(this).css('top',position+'px');
154
  break;
341
  /**
342
  * Resize the scroll ticks
343
  *
344
+ * @since 1.1.0
345
  */
346
  function mtphr_dnt_scroll_resize_ticks() {
347
 
368
  break;
369
 
370
  case 'up':
371
+ if( ticker_scroll_resize ) {
372
+ $tick.css('width',ticker_width);
373
+ }
374
  position = parseInt(ticker_height);
375
  if( ticks[i][0].visible == false ) {
376
  $tick.css('top',position+'px');
378
  break;
379
 
380
  case 'down':
381
+ if( ticker_scroll_resize ) {
382
+ $tick.css('width',ticker_width);
383
+ }
384
  position = parseInt('-'+$tick.height());
385
  if( ticks[i][0].visible == false ) {
386
  $tick.css('top',position+'px');
401
  /**
402
  * Reset the scroller for vertical scrolls
403
  *
404
+ * @since 1.1.0
405
  */
406
  function mtphr_dnt_scroll_reset_ticks() {
407
 
423
  break;
424
 
425
  case 'up':
426
+ if( ticker_scroll_resize ) {
427
+ $tick.css('width',ticker_width);
428
+ }
429
  position = parseInt(ticker_height);
430
  $tick.css('top',position+'px');
431
  break;
432
 
433
  case 'down':
434
+ if( ticker_scroll_resize ) {
435
+ $tick.css('width',ticker_width);
436
+ }
437
  position = parseInt('-'+$(this).height());
438
  $tick.css('top',position+'px');
439
  break;
811
 
812
  if( settings.type == 'scroll' ) {
813
  if( settings.scroll_direction=='up' || settings.scroll_direction=='down' ) {
814
+ if( ticker_scroll_resize ) {
815
+ mtphr_dnt_scroll_reset_ticks();
816
+ } else {
817
+ mtphr_dnt_scroll_resize_ticks();
818
+ }
819
  } else {
820
  mtphr_dnt_scroll_resize_ticks();
821
  }
ditty-news-ticker.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Ditty News Ticker
4
  Plugin URI: http://dittynewsticker.com/
5
  Description: Ditty News Ticker is a multi-functional data display plugin
6
- Version: 1.0.9
7
  Author: Metaphor Creations
8
  Author URI: http://www.metaphorcreations.com
9
  License: GPL2
@@ -45,9 +45,9 @@ The icons are licensed under a Creative Commons Attribution
45
  * @since 1.0.0
46
  */
47
  if ( WP_DEBUG ) {
48
- define ( 'MTPHR_DNT_VERSION', '1.0.9-'.time() );
49
  } else {
50
- define ( 'MTPHR_DNT_VERSION', '1.0.9' );
51
  }
52
  define ( 'MTPHR_DNT_DIR', plugin_dir_path(__FILE__) );
53
  define ( 'MTPHR_DNT_URL', plugins_url().'/ditty-news-ticker' );
3
  Plugin Name: Ditty News Ticker
4
  Plugin URI: http://dittynewsticker.com/
5
  Description: Ditty News Ticker is a multi-functional data display plugin
6
+ Version: 1.1.0
7
  Author: Metaphor Creations
8
  Author URI: http://www.metaphorcreations.com
9
  License: GPL2
45
  * @since 1.0.0
46
  */
47
  if ( WP_DEBUG ) {
48
+ define ( 'MTPHR_DNT_VERSION', '1.1.0-'.time() );
49
  } else {
50
+ define ( 'MTPHR_DNT_VERSION', '1.1.0' );
51
  }
52
  define ( 'MTPHR_DNT_DIR', plugin_dir_path(__FILE__) );
53
  define ( 'MTPHR_DNT_URL', plugins_url().'/ditty-news-ticker' );
includes/functions.php CHANGED
@@ -22,7 +22,7 @@ function ditty_news_ticker( $id='', $class='', $atts=false ) {
22
  /**
23
  * Return the ticker
24
  *
25
- * @since 1.0.9
26
  */
27
  function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
28
 
@@ -64,15 +64,7 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
64
 
65
  // Get the contents
66
  if( $link = esc_url($tick['link']) ) {
67
-
68
- // Add nofollow
69
- $nofollow = '';
70
- if( isset($tick['nofollow']) ) {
71
- if( $tick['nofollow'] ) {
72
- $nofollow = ' rel="nofollow"';
73
- }
74
- }
75
- $contents = '<a href="'.$link.'" target="'.$tick['target'].'"'.$nofollow.'>'.$text.'</a>';
76
  } else {
77
  $contents = $text;
78
  }
@@ -132,7 +124,7 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
132
  if( $_mtphr_dnt_mode == 'scroll' ) {
133
  $padding = ( intval($_mtphr_dnt_scroll_padding) != 0 ) ? 'padding-top:'.intval($_mtphr_dnt_scroll_padding).'px;padding-bottom:'.intval($_mtphr_dnt_scroll_padding).'px;' : '';
134
  $margin = ( intval($_mtphr_dnt_scroll_margin) != 0 ) ? 'margin-top:'.intval($_mtphr_dnt_scroll_margin).'px;margin-bottom:'.intval($_mtphr_dnt_scroll_margin).'px;' : '';
135
- //$width = ( intval($_mtphr_dnt_scroll_width) != 0 ) ? 'white-space:normal;width:'.intval($_mtphr_dnt_scroll_width).'px;' : '';
136
  $height = ( intval($_mtphr_dnt_scroll_height) != 0 ) ? 'height:'.intval($_mtphr_dnt_scroll_height).'px;' : '';
137
  } elseif( $_mtphr_dnt_mode == 'rotate' ) {
138
  $padding = ( intval($_mtphr_dnt_rotate_padding) != 0 ) ? 'padding-top:'.intval($_mtphr_dnt_rotate_padding).'px;padding-bottom:'.intval($_mtphr_dnt_rotate_padding).'px;' : '';
@@ -146,7 +138,7 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
146
  // Filter the variables
147
  $padding = apply_filters( 'mtphr_dnt_tick_container_padding', $padding );
148
  $margin = apply_filters( 'mtphr_dnt_tick_container_margin', $margin );
149
- //$width = apply_filters( 'mtphr_dnt_tick_width', $width );
150
  $height = apply_filters( 'mtphr_dnt_tick_height', $height );
151
 
152
  // Create the container style
@@ -167,8 +159,7 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
167
  $spacing = ( $i != intval($total-1) ) ? 'margin-bottom:'.intval($_mtphr_dnt_list_tick_spacing).'px;' : '';
168
  }
169
  $spacing = apply_filters( 'mtphr_dnt_list_tick_spacing', $spacing, $i, $total );
170
- $tick_style = ( $height != '' || $spacing != '' ) ? ' style="'.$height.$spacing.'"' : '';
171
- //$tick_style = ( $width != '' || $height != '' || $spacing != '' ) ? ' style="'.$width.$height.$spacing.'"' : '';
172
 
173
  do_action( 'mtphr_dnt_tick_before', $id, $meta_data, $total, $i );
174
  echo '<div'.$tick_style.' '.mtphr_dnt_tick_class('clearfix').'>';
@@ -232,8 +223,6 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
232
 
233
 
234
 
235
-
236
-
237
  /**
238
  * Return the ticker class
239
  *
22
  /**
23
  * Return the ticker
24
  *
25
+ * @since 1.1.0
26
  */
27
  function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
28
 
64
 
65
  // Get the contents
66
  if( $link = esc_url($tick['link']) ) {
67
+ $contents = '<a href="'.$link.'" target="'.$tick['target'].'">'.$text.'</a>';
 
 
 
 
 
 
 
 
68
  } else {
69
  $contents = $text;
70
  }
124
  if( $_mtphr_dnt_mode == 'scroll' ) {
125
  $padding = ( intval($_mtphr_dnt_scroll_padding) != 0 ) ? 'padding-top:'.intval($_mtphr_dnt_scroll_padding).'px;padding-bottom:'.intval($_mtphr_dnt_scroll_padding).'px;' : '';
126
  $margin = ( intval($_mtphr_dnt_scroll_margin) != 0 ) ? 'margin-top:'.intval($_mtphr_dnt_scroll_margin).'px;margin-bottom:'.intval($_mtphr_dnt_scroll_margin).'px;' : '';
127
+ $width = ( intval($_mtphr_dnt_scroll_width) != 0 ) ? 'white-space:normal;width:'.intval($_mtphr_dnt_scroll_width).'px;' : '';
128
  $height = ( intval($_mtphr_dnt_scroll_height) != 0 ) ? 'height:'.intval($_mtphr_dnt_scroll_height).'px;' : '';
129
  } elseif( $_mtphr_dnt_mode == 'rotate' ) {
130
  $padding = ( intval($_mtphr_dnt_rotate_padding) != 0 ) ? 'padding-top:'.intval($_mtphr_dnt_rotate_padding).'px;padding-bottom:'.intval($_mtphr_dnt_rotate_padding).'px;' : '';
138
  // Filter the variables
139
  $padding = apply_filters( 'mtphr_dnt_tick_container_padding', $padding );
140
  $margin = apply_filters( 'mtphr_dnt_tick_container_margin', $margin );
141
+ $width = apply_filters( 'mtphr_dnt_tick_width', $width );
142
  $height = apply_filters( 'mtphr_dnt_tick_height', $height );
143
 
144
  // Create the container style
159
  $spacing = ( $i != intval($total-1) ) ? 'margin-bottom:'.intval($_mtphr_dnt_list_tick_spacing).'px;' : '';
160
  }
161
  $spacing = apply_filters( 'mtphr_dnt_list_tick_spacing', $spacing, $i, $total );
162
+ $tick_style = ( $width != '' || $height != '' || $spacing != '' ) ? ' style="'.$width.$height.$spacing.'"' : '';
 
163
 
164
  do_action( 'mtphr_dnt_tick_before', $id, $meta_data, $total, $i );
165
  echo '<div'.$tick_style.' '.mtphr_dnt_tick_class('clearfix').'>';
223
 
224
 
225
 
 
 
226
  /**
227
  * Return the ticker class
228
  *
includes/meta-boxes.php CHANGED
@@ -138,7 +138,7 @@ add_action( 'admin_init', 'mtphr_dnt_mode_metabox_scroll', 12 );
138
  /**
139
  * Create the scroll mode metabox.
140
  *
141
- * @since 1.0.0
142
  */
143
  function mtphr_dnt_mode_metabox_scroll() {
144
 
@@ -163,12 +163,19 @@ function mtphr_dnt_mode_metabox_scroll() {
163
 
164
  // Add the dimensions field
165
  $scroll_fields['dimensions'] = array(
166
- 'id' => '_mtphr_dnt_scroll_height',
167
  'type' => 'number',
168
  'name' => __('Tick dimensions', 'ditty-news-ticker'),
169
  'default' => 0,
170
- 'before' => __('Height', 'ditty-news-ticker'),
171
- 'description' => __('Override the auto dimensions with specific values.', 'ditty-news-ticker')
 
 
 
 
 
 
 
172
  );
173
 
174
  // Add the spacing field
138
  /**
139
  * Create the scroll mode metabox.
140
  *
141
+ * @since 1.1.0
142
  */
143
  function mtphr_dnt_mode_metabox_scroll() {
144
 
163
 
164
  // Add the dimensions field
165
  $scroll_fields['dimensions'] = array(
166
+ 'id' => '_mtphr_dnt_scroll_width',
167
  'type' => 'number',
168
  'name' => __('Tick dimensions', 'ditty-news-ticker'),
169
  'default' => 0,
170
+ 'before' => __('Width', 'ditty-news-ticker'),
171
+ 'description' => __('Override the auto dimensions with specific values.', 'ditty-news-ticker'),
172
+ 'append' => array(
173
+ '_mtphr_dnt_scroll_height' => array(
174
+ 'type' => 'number',
175
+ 'default' => 0,
176
+ 'before' => __('Height', 'ditty-news-ticker'),
177
+ )
178
+ )
179
  );
180
 
181
  // Add the spacing field
readme.txt CHANGED
@@ -52,6 +52,9 @@ Each individual Ticker post has multiple settings to customize.
52
 
53
  == Changelog ==
54
 
 
 
 
55
  = 1.0.9 =
56
  * Added a checkbox to set links as rel="nofollow".
57
  * Updated vertical scrolling for responsive sites.
@@ -103,6 +106,9 @@ Each individual Ticker post has multiple settings to customize.
103
 
104
  == Upgrade Notice ==
105
 
 
 
 
106
  = 1.0.9 =
107
  Added a checkbox to set links as rel="nofollow". Updated vertical scrolling for responsive sites. Removed "width" override for scrolling tickers. Added new ticker classes.
108
 
52
 
53
  == Changelog ==
54
 
55
+ = 1.1.0 =
56
+ * Added "width" override for scrolling tickers back in... whoops!
57
+
58
  = 1.0.9 =
59
  * Added a checkbox to set links as rel="nofollow".
60
  * Updated vertical scrolling for responsive sites.
106
 
107
  == Upgrade Notice ==
108
 
109
+ = 1.1.0 =
110
+ Added "width" override for scrolling tickers back in... whoops!
111
+
112
  = 1.0.9 =
113
  Added a checkbox to set links as rel="nofollow". Updated vertical scrolling for responsive sites. Removed "width" override for scrolling tickers. Added new ticker classes.
114