Ditty News Ticker - Version 1.1.9

Version Description

  • Fixed touchSwipe error that was occurring in Firefox.
  • Fixed undefined variable error in functions.php.
  • Updated metaboxer files.
  • Upated "Show first tick on init" code for better functionality.
Download this release

Release Info

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

Code changes from version 1.1.8 to 1.1.9

assets/js/ditty-news-ticker.js CHANGED
@@ -416,17 +416,71 @@
416
  ticks[i][0].position = position;
417
  ticks[i][0].reset = position;
418
  ticks[i][0].visible = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
419
 
420
- // Reset the current tick
421
- vars.current_tick = 0;
422
 
423
- // Set the first tick visibility
424
- ticks[vars.current_tick][0].visible = true;
425
 
426
- if( settings.scroll_init ) {
427
- ticks[vars.current_tick][0].headline.css('left', 0);
428
- ticks[vars.current_tick][0].headline.css('top', 0);
429
- ticks[vars.current_tick][0].position = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
  }
431
  }
432
  }
@@ -1060,56 +1114,54 @@
1060
  /**
1061
  * Mobile swipe
1062
  *
1063
- * @since 1.1.8
1064
  */
1065
  if( settings.type == 'rotate' ) {
1066
 
1067
  $ticker.swipe( {
1068
  triggerOnTouchEnd : true,
1069
- swipeStatus : mtphr_dnt_swipe,
1070
- allowPageScroll: 'vertical'
1071
- });
1072
- function mtphr_dnt_swipe( event, phase, direction, distance, fingers ) {
1073
-
1074
- if ( phase =="end" ) {
1075
- if (direction == "right") {
1076
 
1077
- if(vars.running) return false;
1078
 
1079
- // Find the new tick
1080
- var new_tick = parseInt(vars.current_tick-1);
1081
- if( new_tick < 0 ) {
1082
- new_tick = vars.tick_count-1;
1083
- }
1084
- if( settings.rotate_type == 'slide_left' || settings.rotate_type == 'slide_right' ) {
1085
- rotate_adjustment = 'slide_right';
1086
- }
1087
- if( settings.nav_reverse ) {
1088
- if( settings.rotate_type == 'slide_down' ) {
1089
- rotate_adjustment = 'slide_up';
1090
- } else if( settings.rotate_type == 'slide_up' ) {
1091
- rotate_adjustment = 'slide_down';
1092
  }
1093
- vars.reverse = 1;
1094
- }
1095
- mtphr_dnt_rotator_update( new_tick );
 
 
 
 
 
 
 
 
 
1096
 
1097
- } else if (direction == "left") {
1098
 
1099
- if(vars.running) return false;
1100
 
1101
- // Find the new tick
1102
- var new_tick = parseInt(vars.current_tick + 1);
1103
- if( new_tick == vars.tick_count ) {
1104
- new_tick = 0;
1105
- }
1106
- if( settings.rotate_type == 'slide_left' || settings.rotate_type == 'slide_right' ) {
1107
- rotate_adjustment = 'slide_left';
 
 
1108
  }
1109
- mtphr_dnt_rotator_update( new_tick );
1110
  }
1111
  }
1112
- }
1113
  }
1114
 
1115
 
416
  ticks[i][0].position = position;
417
  ticks[i][0].reset = position;
418
  ticks[i][0].visible = false;
419
+ }
420
+
421
+ // Reset the current tick
422
+ vars.current_tick = 0;
423
+
424
+ // Set the first tick visibility
425
+ ticks[vars.current_tick][0].visible = true;
426
+
427
+ // Set the ticks to display on init
428
+ if( settings.scroll_init ) {
429
+
430
+ var position = 0;
431
+ if( settings.scroll_direction == 'left' ) {
432
+ position = ticker_width*.1;
433
+ } else if( settings.scroll_direction == 'right' ) {
434
+ position = ticker_width*.9;
435
+ } else if( settings.scroll_direction == 'up' ) {
436
+ position = ticker_height*.1;
437
+ } else if( settings.scroll_direction == 'down' ) {
438
+ position = ticker_height*.9;
439
+ }
440
 
441
+ for( var i=0; i<vars.tick_count; i++ ) {
 
442
 
443
+ var $tick = ticks[i][0].headline;
 
444
 
445
+ switch( settings.scroll_direction ) {
446
+ case 'left':
447
+ if( position < ticker_width ) {
448
+ $tick.stop(true,true).css('left',position+'px');
449
+ ticks[i][0].position = position;
450
+ ticks[i][0].visible = true;
451
+ position = position + ticks[i][0].width + settings.scroll_spacing;
452
+ }
453
+ break;
454
+
455
+ case 'right':
456
+ if( position > 0 ) {
457
+ position = position - ticks[i][0].width;
458
+ $tick.stop(true,true).css('left',position+'px');
459
+ ticks[i][0].position = position;
460
+ ticks[i][0].visible = true;
461
+ position = position - settings.scroll_spacing;
462
+ }
463
+ break;
464
+
465
+ case 'up':
466
+ if( position < ticker_height ) {
467
+ $tick.stop(true,true).css('top',position+'px');
468
+ ticks[i][0].position = position;
469
+ ticks[i][0].visible = true;
470
+ position = position + ticks[i][0].height + settings.scroll_spacing;
471
+ }
472
+ break;
473
+
474
+ case 'down':
475
+ if( position > 0 ) {
476
+ position = position - ticks[i][0].height;
477
+ $tick.stop(true,true).css('top',position+'px');
478
+ ticks[i][0].position = position;
479
+ ticks[i][0].visible = true;
480
+ position = position - settings.scroll_spacing;
481
+ }
482
+ break;
483
+ }
484
  }
485
  }
486
  }
1114
  /**
1115
  * Mobile swipe
1116
  *
1117
+ * @since 1.1.9
1118
  */
1119
  if( settings.type == 'rotate' ) {
1120
 
1121
  $ticker.swipe( {
1122
  triggerOnTouchEnd : true,
1123
+ allowPageScroll: 'vertical',
1124
+ swipeStatus : function(event, phase, direction, distance, duration, fingers) {
1125
+ if ( phase =="end" ) {
1126
+ if (direction == "right") {
 
 
 
1127
 
1128
+ if(vars.running) return false;
1129
 
1130
+ // Find the new tick
1131
+ var new_tick = parseInt(vars.current_tick-1);
1132
+ if( new_tick < 0 ) {
1133
+ new_tick = vars.tick_count-1;
 
 
 
 
 
 
 
 
 
1134
  }
1135
+ if( settings.rotate_type == 'slide_left' || settings.rotate_type == 'slide_right' ) {
1136
+ rotate_adjustment = 'slide_right';
1137
+ }
1138
+ if( settings.nav_reverse ) {
1139
+ if( settings.rotate_type == 'slide_down' ) {
1140
+ rotate_adjustment = 'slide_up';
1141
+ } else if( settings.rotate_type == 'slide_up' ) {
1142
+ rotate_adjustment = 'slide_down';
1143
+ }
1144
+ vars.reverse = 1;
1145
+ }
1146
+ mtphr_dnt_rotator_update( new_tick );
1147
 
1148
+ } else if (direction == "left") {
1149
 
1150
+ if(vars.running) return false;
1151
 
1152
+ // Find the new tick
1153
+ var new_tick = parseInt(vars.current_tick + 1);
1154
+ if( new_tick == vars.tick_count ) {
1155
+ new_tick = 0;
1156
+ }
1157
+ if( settings.rotate_type == 'slide_left' || settings.rotate_type == 'slide_right' ) {
1158
+ rotate_adjustment = 'slide_left';
1159
+ }
1160
+ mtphr_dnt_rotator_update( new_tick );
1161
  }
 
1162
  }
1163
  }
1164
+ });
1165
  }
1166
 
1167
 
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.1.8
7
  Author: Metaphor Creations
8
  Author URI: http://www.metaphorcreations.com
9
  License: GPL2
@@ -42,12 +42,12 @@ The icons are licensed under a Creative Commons Attribution
42
  /**
43
  * Define constants
44
  *
45
- * @since 1.1.6
46
  */
47
  if ( WP_DEBUG ) {
48
- define ( 'MTPHR_DNT_VERSION', '1.1.8-'.time() );
49
  } else {
50
- define ( 'MTPHR_DNT_VERSION', '1.1.8' );
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.9
7
  Author: Metaphor Creations
8
  Author URI: http://www.metaphorcreations.com
9
  License: GPL2
42
  /**
43
  * Define constants
44
  *
45
+ * @since 1.1.9
46
  */
47
  if ( WP_DEBUG ) {
48
+ define ( 'MTPHR_DNT_VERSION', '1.1.9-'.time() );
49
  } else {
50
+ define ( 'MTPHR_DNT_VERSION', '1.1.9' );
51
  }
52
  define ( 'MTPHR_DNT_DIR', plugin_dir_path(__FILE__) );
53
  define ( 'MTPHR_DNT_URL', plugins_url().'/ditty-news-ticker' );
includes/functions.php CHANGED
@@ -254,6 +254,7 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
254
  if( isset($_mtphr_dnt_rotate_directional_nav_reverse) ) {
255
  $nav_reverse = $_mtphr_dnt_rotate_directional_nav_reverse ? 1 : 0;
256
  }
 
257
  $mtphr_dnt_ticker_scripts[] = array(
258
  'ticker' => $ticker,
259
  'id' => $id,
@@ -270,7 +271,7 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
270
  'rotate_speed' => intval($_mtphr_dnt_rotate_speed),
271
  'rotate_ease' => $_mtphr_dnt_rotate_ease,
272
  'nav_reverse' => $nav_reverse,
273
- 'offset' => intval($_mtphr_dnt_offset)
274
  );
275
  }
276
 
254
  if( isset($_mtphr_dnt_rotate_directional_nav_reverse) ) {
255
  $nav_reverse = $_mtphr_dnt_rotate_directional_nav_reverse ? 1 : 0;
256
  }
257
+ $offset = isset($_mtphr_dnt_offset) ? intval($_mtphr_dnt_offset) : 20;
258
  $mtphr_dnt_ticker_scripts[] = array(
259
  'ticker' => $ticker,
260
  'id' => $id,
271
  'rotate_speed' => intval($_mtphr_dnt_rotate_speed),
272
  'rotate_ease' => $_mtphr_dnt_rotate_ease,
273
  'nav_reverse' => $nav_reverse,
274
+ 'offset' => $offset
275
  );
276
  }
277
 
includes/metaboxer/metaboxer.css CHANGED
@@ -202,6 +202,8 @@
202
  background-position: 0 -16px;
203
  }
204
 
 
 
205
  /* Image Select
206
  ------------------------------------------------------------ */
207
 
202
  background-position: 0 -16px;
203
  }
204
 
205
+
206
+
207
  /* Image Select
208
  ------------------------------------------------------------ */
209
 
includes/metaboxer/metaboxer.js CHANGED
@@ -65,7 +65,7 @@ $('.mtphr-dnt-metaboxer-file-upload').click(function() {
65
  title: attachment.title,
66
  caption: attachment.caption,
67
  description: attachment.description,
68
- security: mtphr_dnt_metaboxer_vars.security
69
  };
70
 
71
  // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
@@ -106,9 +106,9 @@ $('.mtphr-dnt-metaboxer-file-delete').live('click',function() {
106
  /**
107
  * Add image functionality.
108
  *
109
- * @since 1.0.0
110
  */
111
- $('.mtphr-dnt-metaboxer-image').each( function(index) {
112
 
113
  // If there currently isn't a value, show the upload button
114
  if( $(this).find('.mtphr-dnt-metaboxer-image-value').val() == '' ) {
@@ -138,7 +138,7 @@ $('.mtphr-dnt-metaboxer-image-upload').click(function() {
138
  title: attachment.title,
139
  caption: attachment.caption,
140
  description: attachment.description,
141
- security: mtphr_dnt_metaboxer_vars.security
142
  };
143
 
144
  // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
@@ -154,12 +154,13 @@ $('.mtphr-dnt-metaboxer-image-upload').click(function() {
154
  wp.media.editor.send.attachment = send_attachment_bkp;
155
  }
156
 
157
- wp.media.editor.open();
158
 
159
  return false;
160
  });
161
 
162
- $('.mtphr-dnt-metaboxer-image-delete').live('click',function() {
 
163
 
164
  // Save the container
165
  var $container = $(this).parents('.mtphr-dnt-metaboxer-image-contents');
@@ -176,7 +177,6 @@ $('.mtphr-dnt-metaboxer-image-delete').live('click',function() {
176
 
177
 
178
 
179
-
180
  /**
181
  * Add image select functionality.
182
  *
65
  title: attachment.title,
66
  caption: attachment.caption,
67
  description: attachment.description,
68
+ security: ditty_metaboxer_vars.security
69
  };
70
 
71
  // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
106
  /**
107
  * Add image functionality.
108
  *
109
+ * @since 1.1.9
110
  */
111
+ $('.mtphr-dnt-metaboxer-image-contents').each( function(index) {
112
 
113
  // If there currently isn't a value, show the upload button
114
  if( $(this).find('.mtphr-dnt-metaboxer-image-value').val() == '' ) {
138
  title: attachment.title,
139
  caption: attachment.caption,
140
  description: attachment.description,
141
+ security: ditty_metaboxer_vars.security
142
  };
143
 
144
  // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
154
  wp.media.editor.send.attachment = send_attachment_bkp;
155
  }
156
 
157
+ wp.media.editor.open($(this));
158
 
159
  return false;
160
  });
161
 
162
+ $('.mtphr-dnt-metaboxer-image-delete').live('click',function(e) {
163
+ e.preventDefault();
164
 
165
  // Save the container
166
  var $container = $(this).parents('.mtphr-dnt-metaboxer-image-contents');
177
 
178
 
179
 
 
180
  /**
181
  * Add image select functionality.
182
  *
includes/metaboxer/metaboxer.php CHANGED
@@ -290,7 +290,7 @@ function mtphr_dnt_metaboxer_html( $field, $value='' ) {
290
  /**
291
  * Renders an image attachment
292
  *
293
- * @since 1.0.0
294
  */
295
  function mtphr_dnt_metaboxer_image( $field, $value='' ) {
296
 
@@ -299,24 +299,17 @@ function mtphr_dnt_metaboxer_image( $field, $value='' ) {
299
  if( $value != '' ) {
300
  $image = get_post( $value );
301
  }
302
-
303
- // If there isn't a file reset the value
304
  if( !$image ) {
305
  $value = '';
306
  }
307
  ?>
308
-
309
  <div class="mtphr-dnt-metaboxer-image-contents">
310
  <input class="mtphr-dnt-metaboxer-image-value" type="hidden" id="<?php echo $field['id']; ?>" name="<?php echo $field['id']; ?>" value="<?php echo $value; ?>" />
311
-
312
  <?php
313
  echo isset( $field['button'] ) ? '<a href="#" class="button mtphr-dnt-metaboxer-image-upload">'.$field['button'].'</a>' : '<a href="#" class="button mtphr-dnt-metaboxer-image-upload">Insert Image</a>';
314
 
315
  if( $image ) {
316
-
317
  $type = explode( '/', $image->post_mime_type );
318
-
319
- // Display the file
320
  echo mtphr_dnt_metaboxer_image_display( $image->ID, $type[0], $image->guid, $image->post_title, $image -> post_excerpt, $image->post_content );
321
  }
322
  ?>
@@ -330,9 +323,9 @@ function mtphr_dnt_metaboxer_image( $field, $value='' ) {
330
 
331
  add_action( 'wp_ajax_mtphr_dnt_metaboxer_ajax_image_display', 'mtphr_dnt_metaboxer_ajax_image_display' );
332
  /**
333
- * Ajax function used to delete attachments
334
  *
335
- * @since 1.0.0
336
  */
337
  function mtphr_dnt_metaboxer_ajax_image_display() {
338
 
@@ -340,7 +333,7 @@ function mtphr_dnt_metaboxer_ajax_image_display() {
340
  global $wpdb;
341
 
342
  // Check the nonce
343
- check_ajax_referer( 'neuron', 'security' );
344
 
345
  // Get variables
346
  $id = $_POST['id'];
@@ -390,6 +383,10 @@ function mtphr_dnt_metaboxer_image_display( $id, $type, $url, $title, $caption,
390
 
391
 
392
 
 
 
 
 
393
  /**
394
  * Renders an image select
395
  *
290
  /**
291
  * Renders an image attachment
292
  *
293
+ * @since 1.1.9
294
  */
295
  function mtphr_dnt_metaboxer_image( $field, $value='' ) {
296
 
299
  if( $value != '' ) {
300
  $image = get_post( $value );
301
  }
 
 
302
  if( !$image ) {
303
  $value = '';
304
  }
305
  ?>
 
306
  <div class="mtphr-dnt-metaboxer-image-contents">
307
  <input class="mtphr-dnt-metaboxer-image-value" type="hidden" id="<?php echo $field['id']; ?>" name="<?php echo $field['id']; ?>" value="<?php echo $value; ?>" />
 
308
  <?php
309
  echo isset( $field['button'] ) ? '<a href="#" class="button mtphr-dnt-metaboxer-image-upload">'.$field['button'].'</a>' : '<a href="#" class="button mtphr-dnt-metaboxer-image-upload">Insert Image</a>';
310
 
311
  if( $image ) {
 
312
  $type = explode( '/', $image->post_mime_type );
 
 
313
  echo mtphr_dnt_metaboxer_image_display( $image->ID, $type[0], $image->guid, $image->post_title, $image -> post_excerpt, $image->post_content );
314
  }
315
  ?>
323
 
324
  add_action( 'wp_ajax_mtphr_dnt_metaboxer_ajax_image_display', 'mtphr_dnt_metaboxer_ajax_image_display' );
325
  /**
326
+ * Ajax function used to display image
327
  *
328
+ * @since 1.1.9
329
  */
330
  function mtphr_dnt_metaboxer_ajax_image_display() {
331
 
333
  global $wpdb;
334
 
335
  // Check the nonce
336
+ check_ajax_referer( 'ditty-metaboxer', 'security' );
337
 
338
  // Get variables
339
  $id = $_POST['id'];
383
 
384
 
385
 
386
+
387
+
388
+
389
+
390
  /**
391
  * Renders an image select
392
  *
readme.txt CHANGED
@@ -52,6 +52,12 @@ Each individual Ticker post has multiple settings to customize.
52
 
53
  == Changelog ==
54
 
 
 
 
 
 
 
55
  = 1.1.8 =
56
  * Added mobile swipe support for rotate mode.
57
  * Added a hidden tick "offset" parameter.
@@ -139,4 +145,4 @@ Each individual Ticker post has multiple settings to customize.
139
 
140
  == Upgrade Notice ==
141
 
142
- Added mobile swipe support for rotate mode. Added a hidden tick "offset" parameter. Added setting to display first scroll tick on init.
52
 
53
  == Changelog ==
54
 
55
+ = 1.1.9 =
56
+ * Fixed touchSwipe error that was occurring in Firefox.
57
+ * Fixed undefined variable error in functions.php.
58
+ * Updated metaboxer files.
59
+ * Upated "Show first tick on init" code for better functionality.
60
+
61
  = 1.1.8 =
62
  * Added mobile swipe support for rotate mode.
63
  * Added a hidden tick "offset" parameter.
145
 
146
  == Upgrade Notice ==
147
 
148
+ Bug fixes and minor upgrades.