Version Description
- Bug fix with scrolling ticker
Download this release
Release Info
Developer | metaphorcreations |
Plugin | Ditty News Ticker |
Version | 2.2.17 |
Comparing to | |
See all releases |
Code changes from version 2.2.16 to 2.2.17
- ditty-news-ticker.php +2 -2
- inc/static.php +1 -2
- inc/static/js/ditty-news-ticker.js +27 -76
- inc/static/js/ditty-news-ticker.min.js +1 -1
- readme.txt +4 -1
ditty-news-ticker.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://dittynewsticker.com/
|
|
5 |
Description: Ditty News Ticker is a multi-functional data display plugin
|
6 |
Text Domain: ditty-news-ticker
|
7 |
Domain Path: languages
|
8 |
-
Version: 2.2.
|
9 |
Author: Metaphor Creations
|
10 |
Author URI: http://www.metaphorcreations.com
|
11 |
Contributors: metaphorcreations
|
@@ -62,7 +62,7 @@ final class Ditty_News_Ticker {
|
|
62 |
|
63 |
// Plugin version
|
64 |
if ( ! defined( 'MTPHR_DNT_VERSION' ) ) {
|
65 |
-
define( 'MTPHR_DNT_VERSION', '2.2.
|
66 |
}
|
67 |
|
68 |
// Plugin Folder Path
|
5 |
Description: Ditty News Ticker is a multi-functional data display plugin
|
6 |
Text Domain: ditty-news-ticker
|
7 |
Domain Path: languages
|
8 |
+
Version: 2.2.17
|
9 |
Author: Metaphor Creations
|
10 |
Author URI: http://www.metaphorcreations.com
|
11 |
Contributors: metaphorcreations
|
62 |
|
63 |
// Plugin version
|
64 |
if ( ! defined( 'MTPHR_DNT_VERSION' ) ) {
|
65 |
+
define( 'MTPHR_DNT_VERSION', '2.2.17' );
|
66 |
}
|
67 |
|
68 |
// Plugin Folder Path
|
inc/static.php
CHANGED
@@ -67,8 +67,7 @@ function mtphr_dnt_scripts() {
|
|
67 |
// Register the Ditty News Ticker scripts
|
68 |
wp_enqueue_style( 'ditty-news-ticker', plugins_url('ditty-news-ticker/inc/static/css/style.css'), false, filemtime(MTPHR_DNT_DIR.'inc/static/css/style.css') );
|
69 |
|
70 |
-
|
71 |
-
wp_enqueue_script( 'ditty-news-ticker', plugins_url('ditty-news-ticker/inc/static/js/ditty-news-ticker.min.js'), array('jquery', 'imagesLoaded', 'touchSwipe', 'jquery-easing'), time(), true );
|
72 |
wp_localize_script( 'ditty-news-ticker', 'mtphr_dnt_vars', array(
|
73 |
'is_rtl' => is_rtl(),
|
74 |
)
|
67 |
// Register the Ditty News Ticker scripts
|
68 |
wp_enqueue_style( 'ditty-news-ticker', plugins_url('ditty-news-ticker/inc/static/css/style.css'), false, filemtime(MTPHR_DNT_DIR.'inc/static/css/style.css') );
|
69 |
|
70 |
+
wp_enqueue_script( 'ditty-news-ticker', plugins_url('ditty-news-ticker/inc/static/js/ditty-news-ticker.min.js'), array('jquery', 'imagesLoaded', 'touchSwipe', 'jquery-easing'), filemtime(MTPHR_DNT_DIR.'inc/static/js/ditty-news-ticker.min.js'), true );
|
|
|
71 |
wp_localize_script( 'ditty-news-ticker', 'mtphr_dnt_vars', array(
|
72 |
'is_rtl' => is_rtl(),
|
73 |
)
|
inc/static/js/ditty-news-ticker.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Date: 10/06/2014
|
4 |
*
|
5 |
* @author Metaphor Creations
|
6 |
-
* @version
|
7 |
*
|
8 |
**/
|
9 |
|
@@ -122,8 +122,8 @@
|
|
122 |
$ticker.find('.mtphr-dnt-tick').each( function() {
|
123 |
|
124 |
// Find the greatest tick height
|
125 |
-
if( $(this).
|
126 |
-
ticker_height = $(this).
|
127 |
}
|
128 |
|
129 |
if( settings.scroll_direction === 'up' || settings.scroll_direction === 'down' ) {
|
@@ -143,12 +143,6 @@
|
|
143 |
var style_array = style.split('width:');
|
144 |
ticker_scroll_resize = (style_array.length > 1) ? false : true;
|
145 |
}
|
146 |
-
|
147 |
-
// Set the offset
|
148 |
-
$ticker.css({
|
149 |
-
marginLeft: '-' + settings.offset + 'px',
|
150 |
-
width: 'calc( 100% + ' + parseFloat(settings.offset * 2) + 'px )',
|
151 |
-
});
|
152 |
|
153 |
// Reset the ticks
|
154 |
ticks = [];
|
@@ -246,7 +240,7 @@
|
|
246 |
|
247 |
pos = (settings.scroll_direction === 'left') ? mtphr_dnt_scroll_left(i) : mtphr_dnt_scroll_right(i);
|
248 |
if( pos === 'reset' ) {
|
249 |
-
pos =
|
250 |
ticks[i][0].headline.css('opacity', 0);
|
251 |
ticks[i][0].headline.stop(true,true).css('left',pos+'px');
|
252 |
} else {
|
@@ -259,7 +253,7 @@
|
|
259 |
|
260 |
pos = (settings.scroll_direction === 'up') ? mtphr_dnt_scroll_up(i) : mtphr_dnt_scroll_down(i);
|
261 |
if( pos === 'reset' ) {
|
262 |
-
pos =
|
263 |
ticks[i][0].headline.css('opacity', 0);
|
264 |
ticks[i][0].headline.stop(true,true).css('top',pos+'px');
|
265 |
} else {
|
@@ -287,9 +281,9 @@
|
|
287 |
var pos = parseFloat(ticks[i][0].position - settings.scroll_speed);
|
288 |
|
289 |
// Reset the tick if off the screen
|
290 |
-
if( pos < -(ticks[i][0].headline.
|
291 |
pos = mtphr_dnt_scroll_check_current(i);
|
292 |
-
} else if( pos < parseFloat(ticker_width-ticks[i][0].headline.
|
293 |
mtphr_dnt_scroll_check_next(i);
|
294 |
}
|
295 |
|
@@ -307,7 +301,7 @@
|
|
307 |
var pos = ticks[i][0].position + settings.scroll_speed;
|
308 |
|
309 |
// Reset the tick if off the screen
|
310 |
-
if( pos > ticker_width ) {
|
311 |
pos = mtphr_dnt_scroll_check_current(i);
|
312 |
} else if( pos > settings.scroll_spacing ) {
|
313 |
mtphr_dnt_scroll_check_next(i);
|
@@ -327,9 +321,9 @@
|
|
327 |
var pos = ticks[i][0].position - settings.scroll_speed;
|
328 |
|
329 |
// Reset the tick if off the screen
|
330 |
-
if( pos < -(ticks[i][0].headline.
|
331 |
pos = mtphr_dnt_scroll_check_current(i);
|
332 |
-
} else if( pos < ticker_height-ticks[i][0].headline.
|
333 |
mtphr_dnt_scroll_check_next(i);
|
334 |
}
|
335 |
|
@@ -347,7 +341,7 @@
|
|
347 |
var pos = ticks[i][0].position + settings.scroll_speed;
|
348 |
|
349 |
// Reset the tick if off the screen
|
350 |
-
if( pos > ticker_height ) {
|
351 |
pos = mtphr_dnt_scroll_check_current(i);
|
352 |
} else if( pos > settings.scroll_spacing ) {
|
353 |
mtphr_dnt_scroll_check_next(i);
|
@@ -409,46 +403,6 @@
|
|
409 |
ticks[(i+1)][0].visible = true;
|
410 |
}
|
411 |
}
|
412 |
-
|
413 |
-
/**
|
414 |
-
* Reset a tick
|
415 |
-
*
|
416 |
-
* @since 1.1.0
|
417 |
-
*/
|
418 |
-
function mtphr_dnt_scroll_reset_tick( i ) {
|
419 |
-
|
420 |
-
ticker_width = $ticker.outerWidth();
|
421 |
-
ticker_height = $ticker.outerHeight();
|
422 |
-
|
423 |
-
// Set the tick position
|
424 |
-
var position;
|
425 |
-
|
426 |
-
var $tick = ticks[i][0].headline;
|
427 |
-
|
428 |
-
switch( settings.scroll_direction ) {
|
429 |
-
case 'left':
|
430 |
-
position = ticker_width;
|
431 |
-
break;
|
432 |
-
|
433 |
-
case 'right':
|
434 |
-
position = parseFloat('-'+($tick.outerWidth()));
|
435 |
-
break;
|
436 |
-
|
437 |
-
case 'up':
|
438 |
-
position = parseFloat(ticker_height);
|
439 |
-
break;
|
440 |
-
|
441 |
-
case 'down':
|
442 |
-
position = parseFloat('-'+($tick.outerHeight()));
|
443 |
-
break;
|
444 |
-
}
|
445 |
-
|
446 |
-
ticks[i][0].width = $tick.outerWidth();
|
447 |
-
ticks[i][0].height = $tick.outerHeight();
|
448 |
-
ticks[i][0].reset = position;
|
449 |
-
ticks[i][0].position = position;
|
450 |
-
return position;
|
451 |
-
}
|
452 |
|
453 |
/**
|
454 |
* Resize the scroll ticks
|
@@ -466,14 +420,14 @@
|
|
466 |
|
467 |
switch( settings.scroll_direction ) {
|
468 |
case 'left':
|
469 |
-
position = ticker_width;
|
470 |
if( ticks[i][0].visible === false ) {
|
471 |
$tick.css('left',position+'px');
|
472 |
}
|
473 |
break;
|
474 |
|
475 |
case 'right':
|
476 |
-
position =
|
477 |
if( ticks[i][0].visible === false ) {
|
478 |
$tick.css('left',position+'px');
|
479 |
}
|
@@ -483,7 +437,7 @@
|
|
483 |
if( ticker_scroll_resize ) {
|
484 |
$tick.css('width',ticker_width);
|
485 |
}
|
486 |
-
position =
|
487 |
if( ticks[i][0].visible === false ) {
|
488 |
$tick.css('top',position+'px');
|
489 |
}
|
@@ -493,7 +447,7 @@
|
|
493 |
if( ticker_scroll_resize ) {
|
494 |
$tick.css('width',ticker_width);
|
495 |
}
|
496 |
-
position =
|
497 |
if( ticks[i][0].visible === false ) {
|
498 |
$tick.css('top',position+'px');
|
499 |
}
|
@@ -501,8 +455,8 @@
|
|
501 |
}
|
502 |
|
503 |
// Adjust the tick data
|
504 |
-
ticks[i][0].width = $tick.
|
505 |
-
ticks[i][0].height = $tick.
|
506 |
if( ticks[i][0].visible === false ) {
|
507 |
ticks[i][0].position = position;
|
508 |
}
|
@@ -519,9 +473,6 @@
|
|
519 |
|
520 |
var position,
|
521 |
$tick;
|
522 |
-
|
523 |
-
ticker_width = $ticker.outerWidth(true);
|
524 |
-
ticker_height = $ticker.outerHeight(true);
|
525 |
|
526 |
for( var i=0; i<vars.tick_count; i++ ) {
|
527 |
|
@@ -531,16 +482,16 @@
|
|
531 |
|
532 |
switch( settings.scroll_direction ) {
|
533 |
case 'left':
|
534 |
-
position = ticker_width;
|
535 |
$tick.stop(true,true).css('left',position+'px');
|
536 |
break;
|
537 |
|
538 |
case 'right':
|
539 |
//console.log(settings.offset);
|
540 |
-
position =
|
541 |
/*
|
542 |
if( mtphr_dnt_vars.is_rtl ) {
|
543 |
-
position =
|
544 |
}
|
545 |
*/
|
546 |
$tick.stop(true,true).css('left',position+'px');
|
@@ -550,7 +501,7 @@
|
|
550 |
if( ticker_scroll_resize ) {
|
551 |
$tick.css('width',ticker_width);
|
552 |
}
|
553 |
-
position =
|
554 |
$tick.stop(true,true).css('top',position+'px');
|
555 |
break;
|
556 |
|
@@ -558,13 +509,13 @@
|
|
558 |
if( ticker_scroll_resize ) {
|
559 |
$tick.css('width',ticker_width);
|
560 |
}
|
561 |
-
position =
|
562 |
$tick.stop(true,true).css('top',position+'px');
|
563 |
break;
|
564 |
}
|
565 |
|
566 |
-
ticks[i][0].width = $tick.
|
567 |
-
ticks[i][0].height = $tick.
|
568 |
ticks[i][0].position = position;
|
569 |
ticks[i][0].reset = position;
|
570 |
ticks[i][0].visible = false;
|
@@ -1496,13 +1447,13 @@
|
|
1496 |
|
1497 |
});
|
1498 |
|
1499 |
-
if( $container.
|
1500 |
|
1501 |
var mtphr_dnt_init_timer = setInterval( function() {
|
1502 |
|
1503 |
-
if( $container.
|
1504 |
clearInterval(mtphr_dnt_init_timer);
|
1505 |
-
ticker_width = $ticker.outerWidth();
|
1506 |
mtphr_dnt_init();
|
1507 |
}
|
1508 |
|
3 |
* Date: 10/06/2014
|
4 |
*
|
5 |
* @author Metaphor Creations
|
6 |
+
* @version 1.4.12
|
7 |
*
|
8 |
**/
|
9 |
|
122 |
$ticker.find('.mtphr-dnt-tick').each( function() {
|
123 |
|
124 |
// Find the greatest tick height
|
125 |
+
if( $(this).height() > ticker_height ) {
|
126 |
+
ticker_height = $(this).height();
|
127 |
}
|
128 |
|
129 |
if( settings.scroll_direction === 'up' || settings.scroll_direction === 'down' ) {
|
143 |
var style_array = style.split('width:');
|
144 |
ticker_scroll_resize = (style_array.length > 1) ? false : true;
|
145 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
|
147 |
// Reset the ticks
|
148 |
ticks = [];
|
240 |
|
241 |
pos = (settings.scroll_direction === 'left') ? mtphr_dnt_scroll_left(i) : mtphr_dnt_scroll_right(i);
|
242 |
if( pos === 'reset' ) {
|
243 |
+
pos = ticks[i][0].reset;
|
244 |
ticks[i][0].headline.css('opacity', 0);
|
245 |
ticks[i][0].headline.stop(true,true).css('left',pos+'px');
|
246 |
} else {
|
253 |
|
254 |
pos = (settings.scroll_direction === 'up') ? mtphr_dnt_scroll_up(i) : mtphr_dnt_scroll_down(i);
|
255 |
if( pos === 'reset' ) {
|
256 |
+
pos = ticks[i][0].reset;
|
257 |
ticks[i][0].headline.css('opacity', 0);
|
258 |
ticks[i][0].headline.stop(true,true).css('top',pos+'px');
|
259 |
} else {
|
281 |
var pos = parseFloat(ticks[i][0].position - settings.scroll_speed);
|
282 |
|
283 |
// Reset the tick if off the screen
|
284 |
+
if( pos < -(ticks[i][0].headline.width()+settings.offset) ) {
|
285 |
pos = mtphr_dnt_scroll_check_current(i);
|
286 |
+
} else if( pos < parseFloat(ticker_width-ticks[i][0].headline.width()-settings.scroll_spacing) ) {
|
287 |
mtphr_dnt_scroll_check_next(i);
|
288 |
}
|
289 |
|
301 |
var pos = ticks[i][0].position + settings.scroll_speed;
|
302 |
|
303 |
// Reset the tick if off the screen
|
304 |
+
if( pos > ticker_width+settings.offset ) {
|
305 |
pos = mtphr_dnt_scroll_check_current(i);
|
306 |
} else if( pos > settings.scroll_spacing ) {
|
307 |
mtphr_dnt_scroll_check_next(i);
|
321 |
var pos = ticks[i][0].position - settings.scroll_speed;
|
322 |
|
323 |
// Reset the tick if off the screen
|
324 |
+
if( pos < -(ticks[i][0].headline.height()+settings.offset) ) {
|
325 |
pos = mtphr_dnt_scroll_check_current(i);
|
326 |
+
} else if( pos < ticker_height-ticks[i][0].headline.height()-settings.scroll_spacing ) {
|
327 |
mtphr_dnt_scroll_check_next(i);
|
328 |
}
|
329 |
|
341 |
var pos = ticks[i][0].position + settings.scroll_speed;
|
342 |
|
343 |
// Reset the tick if off the screen
|
344 |
+
if( pos > ticker_height+settings.offset ) {
|
345 |
pos = mtphr_dnt_scroll_check_current(i);
|
346 |
} else if( pos > settings.scroll_spacing ) {
|
347 |
mtphr_dnt_scroll_check_next(i);
|
403 |
ticks[(i+1)][0].visible = true;
|
404 |
}
|
405 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
|
407 |
/**
|
408 |
* Resize the scroll ticks
|
420 |
|
421 |
switch( settings.scroll_direction ) {
|
422 |
case 'left':
|
423 |
+
position = ticker_width+settings.offset;
|
424 |
if( ticks[i][0].visible === false ) {
|
425 |
$tick.css('left',position+'px');
|
426 |
}
|
427 |
break;
|
428 |
|
429 |
case 'right':
|
430 |
+
position = parseInt('-'+($tick.width()+settings.offset));
|
431 |
if( ticks[i][0].visible === false ) {
|
432 |
$tick.css('left',position+'px');
|
433 |
}
|
437 |
if( ticker_scroll_resize ) {
|
438 |
$tick.css('width',ticker_width);
|
439 |
}
|
440 |
+
position = parseInt(ticker_height+settings.offset);
|
441 |
if( ticks[i][0].visible === false ) {
|
442 |
$tick.css('top',position+'px');
|
443 |
}
|
447 |
if( ticker_scroll_resize ) {
|
448 |
$tick.css('width',ticker_width);
|
449 |
}
|
450 |
+
position = parseInt('-'+($tick.height()+settings.offset));
|
451 |
if( ticks[i][0].visible === false ) {
|
452 |
$tick.css('top',position+'px');
|
453 |
}
|
455 |
}
|
456 |
|
457 |
// Adjust the tick data
|
458 |
+
ticks[i][0].width = $tick.width();
|
459 |
+
ticks[i][0].height = $tick.height();
|
460 |
if( ticks[i][0].visible === false ) {
|
461 |
ticks[i][0].position = position;
|
462 |
}
|
473 |
|
474 |
var position,
|
475 |
$tick;
|
|
|
|
|
|
|
476 |
|
477 |
for( var i=0; i<vars.tick_count; i++ ) {
|
478 |
|
482 |
|
483 |
switch( settings.scroll_direction ) {
|
484 |
case 'left':
|
485 |
+
position = ticker_width+settings.offset;
|
486 |
$tick.stop(true,true).css('left',position+'px');
|
487 |
break;
|
488 |
|
489 |
case 'right':
|
490 |
//console.log(settings.offset);
|
491 |
+
position = parseInt('-'+($tick.width()+settings.offset));
|
492 |
/*
|
493 |
if( mtphr_dnt_vars.is_rtl ) {
|
494 |
+
position = parseInt('-'+($tick.width()+(ticker_width/2)));
|
495 |
}
|
496 |
*/
|
497 |
$tick.stop(true,true).css('left',position+'px');
|
501 |
if( ticker_scroll_resize ) {
|
502 |
$tick.css('width',ticker_width);
|
503 |
}
|
504 |
+
position = parseInt(ticker_height+settings.offset);
|
505 |
$tick.stop(true,true).css('top',position+'px');
|
506 |
break;
|
507 |
|
509 |
if( ticker_scroll_resize ) {
|
510 |
$tick.css('width',ticker_width);
|
511 |
}
|
512 |
+
position = parseInt('-'+($tick.height()+settings.offset));
|
513 |
$tick.stop(true,true).css('top',position+'px');
|
514 |
break;
|
515 |
}
|
516 |
|
517 |
+
ticks[i][0].width = $tick.width();
|
518 |
+
ticks[i][0].height = $tick.height();
|
519 |
ticks[i][0].position = position;
|
520 |
ticks[i][0].reset = position;
|
521 |
ticks[i][0].visible = false;
|
1447 |
|
1448 |
});
|
1449 |
|
1450 |
+
if( $container.width() === 0 ) {
|
1451 |
|
1452 |
var mtphr_dnt_init_timer = setInterval( function() {
|
1453 |
|
1454 |
+
if( $container.width() > 10 ) {
|
1455 |
clearInterval(mtphr_dnt_init_timer);
|
1456 |
+
ticker_width = $ticker.outerWidth(true);
|
1457 |
mtphr_dnt_init();
|
1458 |
}
|
1459 |
|
inc/static/js/ditty-news-ticker.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){var e={init:function(e){return this.each((function(){function i(){P.tick_count=U.find(".mtphr-dnt-tick").length,P.tick_count>0&&("scroll"===N.type?n():"rotate"===N.type&&b()),N.after_load.call(S,U),S.trigger("mtphr_dnt_after_load_single",[P,et]),t("body").trigger("mtphr_dnt_after_load",[S,P,et])}function r(){U.find(".mtphr-dnt-tick").each((function(){t(this).outerHeight()>tt&&(tt=t(this).outerHeight()),"up"!==N.scroll_direction&&"down"!==N.scroll_direction||t(this).css("height","auto")})),U.css("height",tt+"px")}function n(){var e=U.find(".mtphr-dnt-tick:first");if(e.attr("style")){var i,n=e.attr("style").split("width:");rt=!(n.length>1)}U.css({marginLeft:"-"+N.offset+"px",width:"calc( 100% + "+parseFloat(2*N.offset)+"px )"}),et=[],U.find("img").length?U.imagesLoaded((function(){r(),U.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];et.push(e)})),v(),a()})):(r(),U.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];et.push(e)})),v(),a()),U.hover((function(){N.scroll_pause&&o()}),(function(){N.scroll_pause&&!P.paused&&s()}))}function o(){clearInterval(it)}function s(){a()}function a(){clearInterval(it),it=setInterval((function(){for(var t=0;t<P.tick_count;t++)if(!0===et[t][0].visible){var e="reset";"left"===N.scroll_direction||"right"===N.scroll_direction?"reset"===(e="left"===N.scroll_direction?c(t):p(t))?(e=f(t),et[t][0].headline.css("opacity",0),et[t][0].headline.stop(!0,!0).css("left",e+"px")):(et[t][0].headline.css("opacity",1),et[t][0].headline.stop(!0,!0).animate({left:e+"px"},100,"linear")):"reset"===(e="up"===N.scroll_direction?l(t):_(t))?(e=f(t),et[t][0].headline.css("opacity",0),et[t][0].headline.stop(!0,!0).css("top",e+"px")):(et[t][0].headline.css("opacity",1),et[t][0].headline.stop(!0,!0).animate({top:e+"px"},100,"linear")),et[t][0].position=e}}),100)}function c(t){var e=parseFloat(et[t][0].position-N.scroll_speed);return e<-et[t][0].headline.outerWidth()?e=u(t):e<parseFloat($-et[t][0].headline.outerWidth()-N.scroll_spacing)&&h(t),e}function p(t){var e=et[t][0].position+N.scroll_speed;return e>$?e=u(t):e>N.scroll_spacing&&h(t),e}function l(t){var e=et[t][0].position-N.scroll_speed;return e<-et[t][0].headline.outerHeight()?e=u(t):e<tt-et[t][0].headline.outerHeight()-N.scroll_spacing&&h(t),e}function _(t){var e=et[t][0].position+N.scroll_speed;return e>tt?e=u(t):e>N.scroll_spacing&&h(t),e}function u(e){return P.tick_count>1&&(et[e][0].visible=!1),P.tick_count===e+1&&(S.trigger("mtphr_dnt_scroll_complete",[P,et]),t("body").trigger("mtphr_dnt_scroll_complete",[S,P,et])),"reset"}function d(t){!1===et[t][0].visible&&(P.previous_tick=parseInt(t-1),P.previous_tick<0&&(P.previous_tick=parseInt(P.tick_count-1)),P.current_tick=t,P.next_tick=parseInt(t+1),P.next_tick>=P.tick_count&&(P.next_tick=0))}function h(t){t===P.tick_count-1?N.scroll_loop&&(d(0),et[0][0].visible=!0):(d(parseInt(t+1)),et[t+1][0].visible=!0)}function f(t){var e;$=U.outerWidth(),tt=U.outerHeight();var i=et[t][0].headline;switch(N.scroll_direction){case"left":e=$;break;case"right":e=parseFloat("-"+i.outerWidth());break;case"up":e=parseFloat(tt);break;case"down":e=parseFloat("-"+i.outerHeight());break}return et[t][0].width=i.outerWidth(),et[t][0].height=i.outerHeight(),et[t][0].reset=e,et[t][0].position=e,e}function g(){for(var t=0;t<P.tick_count;t++){var e,i=et[t][0].headline;switch(N.scroll_direction){case"left":e=$,!1===et[t][0].visible&&i.css("left",e+"px");break;case"right":e=parseFloat("-"+i.outerWidth()),!1===et[t][0].visible&&i.css("left",e+"px");break;case"up":rt&&i.css("width",$),e=parseFloat(tt),!1===et[t][0].visible&&i.css("top",e+"px");break;case"down":rt&&i.css("width",$),e=parseFloat("-"+i.outerHeight()),!1===et[t][0].visible&&i.css("top",e+"px");break}et[t][0].width=i.outerWidth(),et[t][0].height=i.outerHeight(),!1===et[t][0].visible&&(et[t][0].position=e),et[t][0].reset=e}}function v(){var t,e;$=U.outerWidth(!0),tt=U.outerHeight(!0);for(var i=0;i<P.tick_count;i++)if(et[i]){switch(e=et[i][0].headline,N.scroll_direction){case"left":t=$,e.stop(!0,!0).css("left",t+"px");break;case"right":t=parseFloat("-"+e.outerWidth()),e.stop(!0,!0).css("left",t+"px");break;case"up":rt&&e.css("width",$),t=parseFloat(tt),e.stop(!0,!0).css("top",t+"px");break;case"down":rt&&e.css("width",$),t=parseFloat("-"+e.outerHeight()),e.stop(!0,!0).css("top",t+"px");break}et[i][0].width=e.outerWidth(),et[i][0].height=e.outerHeight(),et[i][0].position=t,et[i][0].reset=t,et[i][0].visible=!1}if(P.current_tick=0,et[P.current_tick][0].visible=!0,N.scroll_init)for("left"===N.scroll_direction?t=.1*$:"right"===N.scroll_direction?t=.9*$:"up"===N.scroll_direction?t=.1*tt:"down"===N.scroll_direction&&(t=.9*tt),i=0;i<P.tick_count;i++)switch(e=et[i][0].headline,N.scroll_direction){case"left":t<$&&(e.stop(!0,!0).css("left",t+"px"),et[i][0].position=t,et[i][0].visible=!0,t=t+et[i][0].width+N.scroll_spacing);break;case"right":t>0&&(t-=et[i][0].width,e.stop(!0,!0).css("left",t+"px"),et[i][0].position=t,et[i][0].visible=!0,t-=N.scroll_spacing);break;case"up":t<tt&&(e.stop(!0,!0).css("top",t+"px"),et[i][0].position=t,et[i][0].visible=!0,t=t+et[i][0].height+N.scroll_spacing);break;case"down":t>0&&(t-=et[i][0].height,e.stop(!0,!0).css("top",t+"px"),et[i][0].position=t,et[i][0].visible=!0,t-=N.scroll_spacing);break}}function k(){m()}function y(){clearInterval(nt)}function b(){switch(U.find(".mtphr-dnt-tick").each((function(){et.push(t(this)),t(this).imagesLoaded((function(){W()}))})),W(),U.find(".mtphr-dnt-tick").show(),N.rotate_type){case"fade":H(U,et,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":L(U,et,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":T(U,et,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":A(U,et,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":R(U,et,parseInt(100*N.rotate_speed),N.rotate_ease);break}w(0),N.auto_rotate&&k(),U.hover((function(){N.auto_rotate&&N.rotate_pause&&!P.running&&y()}),(function(){N.auto_rotate&&N.rotate_pause&&!P.running&&!P.paused&&k()}))}function m(){y(),nt=setInterval((function(){var t=parseInt(P.current_tick+1);t===P.tick_count&&(t=0),x(t)}),parseInt(1e3*N.rotate_delay))}function x(e){P.current_tick!==e&&(N.auto_rotate&&y(),P.next_tick=e,N.before_change.call(S,U),S.trigger("mtphr_dnt_before_change_single",[P,et]),t("body").trigger("mtphr_dnt_before_change",[S,P,et]),P.running=1,F(e),I(e),P.previous_tick=P.current_tick,P.current_tick=e,st=setTimeout((function(){N.after_change.call(S,U),S.trigger("mtphr_dnt_after_change_single",[P,et]),t("body").trigger("mtphr_dnt_after_change",[S,P,et]),ot=N.rotate_type,P.reverse=0,P.running=0,N.auto_rotate&&!P.paused&&m()}),parseInt(100*N.rotate_speed)))}function w(t){Y&&(Y.children("a").removeClass("active"),Y.children('a[href="'+t+'"]').addClass("active"))}function I(e){switch(w(e),ot){case"fade":C(U,t(et[e]),t(et[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":z(U,t(et[e]),t(et[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":j(U,t(et[e]),t(et[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":M(U,t(et[e]),t(et[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":q(U,t(et[e]),t(et[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break}}function F(e){switch(ot){case"fade":D(U,t(et[P.current_tick]),t(et[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":O(U,t(et[P.current_tick]),t(et[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":E(U,t(et[P.current_tick]),t(et[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":Q(U,t(et[P.current_tick]),t(et[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":B(U,t(et[P.current_tick]),t(et[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break}}function W(){for(var e=0;e<P.tick_count;e++)t(et[e]).width($+"px"),P.current_tick!==e&&t(et[e]).css({left:parseFloat($+N.offset)+"px"});var i=t(et[P.current_tick]).height();U.stop().css("height",i+"px")}function H(t,e){var i=e[0],r=i.height();t.css("height",r+"px"),i.css({opacity:1,left:"auto"})}function C(t,e,i,r,n){e.css({opacity:0,left:"auto"}),e.stop().animate({opacity:1},r,n);var o=e.height();t.stop().animate({height:o+"px"},r,n)}function D(e,i,r,n,o){i.stop().animate({opacity:0},n,o,(function(){t(this).css({left:parseFloat($+N.offset)+"px"}),i.remove(),e.append(i)}))}function L(t,e){var i=e[0],r=i.height();t.css("height",r+"px"),i.css({opacity:1,left:0})}function z(t,e,i,r,n){var o=e.height();e.css({opacity:1,left:parseFloat($+N.offset)+"px"}),t.stop().animate({height:o+"px"},r,n,(function(){})),e.stop().animate({left:"0"},r,n,(function(){}))}function O(t,e,i,r,n){e.stop().animate({left:"-"+parseFloat($+N.offset)+"px"},r,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function T(t,e){var i=e[0],r=i.height();t.css("height",r+"px"),i.css({opacity:1,left:0})}function j(t,e,i,r,n){var o=e.height();e.css({opacity:1,left:"-"+parseFloat($+N.offset)+"px"}),t.stop().animate({height:o+"px"},r,n,(function(){})),e.stop().animate({left:"0"},r,n)}function E(t,e,i,r,n){e.stop().animate({left:parseFloat($+N.offset)+"px"},r,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function A(t,e){var i=e[0],r=i.height();t.css("height",r+"px"),i.css({opacity:1,top:0,left:"auto"})}function M(t,e,i,r,n){var o=e.height();e.css({opacity:1,top:"-"+parseFloat(o+N.offset)+"px",left:"auto"}),t.stop().animate({height:o+"px"},r,n),e.stop().animate({top:"0"},r,n)}function Q(t,e,i,r,n){var o=i.height();e.stop().animate({top:parseFloat(o+N.offset)+"px"},r,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function R(t,e){var i=e[0],r=i.height();t.css({height:r+"px",left:"auto"}),i.css({opacity:1,top:0})}function q(t,e,i,r,n){var o=e.height();e.css({opacity:1,top:parseFloat(i.height()+N.offset)+"px",left:"auto"}),t.stop().animate({height:o+"px"},r,n),e.stop().animate({top:"0"},r,n)}function B(t,e,i,r,n){var o=e.height();e.stop().animate({top:"-"+parseFloat(o+N.offset)+"px"},r,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function G(){if(P.running)return!1;var t=parseInt(P.current_tick+1);t===P.tick_count&&(t=0),x(t)}function J(){if(P.running)return!1;var t=parseInt(P.current_tick-1);t<0&&(t=P.tick_count-1),N.nav_reverse&&("slide_left"===N.rotate_type?ot="slide_right":"slide_right"===N.rotate_type?ot="slide_left":"slide_down"===N.rotate_type?ot="slide_up":"slide_up"===N.rotate_type&&(ot="slide_down"),P.reverse=1),x(t)}function K(t){t?(P.paused=!1,Z.removeClass("paused"),"scroll"===N.type?s():k()):(P.paused=!0,Z.addClass("paused"),"scroll"===N.type?o():y()),S.trigger("mtphr_dnt_play_pause",[P,et])}var N={id:"",type:"scroll",scroll_direction:"left",scroll_speed:10,scroll_pause:0,scroll_spacing:40,scroll_units:10,scroll_init:0,scroll_loop:1,rotate_type:"fade",auto_rotate:0,rotate_delay:10,rotate_pause:0,rotate_speed:10,rotate_ease:"easeOutExpo",nav_reverse:0,disable_touchswipe:0,offset:20,before_change:function(){},after_change:function(){},after_load:function(){}},P={id:N.id,tick_count:0,previous_tick:0,current_tick:0,next_tick:0,reverse:0,running:0,paused:0};e&&t.extend(N,e);var S=t(this),U=S.find(".mtphr-dnt-tick-contents"),V=S.find(".mtphr-dnt-nav-prev"),X=S.find(".mtphr-dnt-nav-next"),Y=S.find(".mtphr-dnt-control-links"),Z=S.find(".mtphr-dnt-play-pause"),$=U.outerWidth(!0),tt=0,et=[],it,rt=!0,nt,ot=N.rotate_type,st;if(U.data("ditty:vars",P),V&&"rotate"===N.type&&(V.bind("click",(function(t){t.preventDefault(),J()})),X.bind("click",(function(t){t.preventDefault(),G()}))),Y&&"rotate"===N.type&&Y.children("a").bind("click",(function(e){e.preventDefault();var i=parseInt(t(this).attr("href"));if(P.running)return!1;if(i===P.current_tick)return!1;var r=i<P.current_tick?1:0;N.nav_reverse&&r&&("slide_left"===N.rotate_type?ot="slide_right":"slide_right"===N.rotate_type?ot="slide_left":"slide_down"===N.rotate_type?ot="slide_up":"slide_up"===N.rotate_type&&(ot="slide_down"),P.reverse=1),x(i)})),Z.bind("click",(function(t){t.preventDefault(),K(P.paused)})),"rotate"!==N.type||N.disable_touchswipe||U.swipe({triggerOnTouchEnd:!0,swipeLeft:function(){if(P.running)return!1;var t=parseInt(P.current_tick+1);t===P.tick_count&&(t=0),"slide_left"!==N.rotate_type&&"slide_right"!==N.rotate_type||(ot="slide_left"),x(t)},swipeRight:function(){if(P.running)return!1;var t=parseInt(P.current_tick-1);t<0&&(t=P.tick_count-1),"slide_left"!==N.rotate_type&&"slide_right"!==N.rotate_type||(ot="slide_right"),N.nav_reverse&&("slide_down"===N.rotate_type?ot="slide_up":"slide_up"===N.rotate_type&&(ot="slide_down"),P.reverse=1),x(t)}}),S.on("mtphr_dnt_next",(function(){G()})),S.on("mtphr_dnt_prev",(function(){J()})),S.on("mtphr_dnt_goto",(function(t,e){x(parseInt(e))})),S.on("mtphr_dnt_pause",(function(){K()})),S.on("mtphr_dnt_play",(function(){K(!0)})),t(window).resize((function(){U.outerWidth()!==$&&($=U.outerWidth(!0),"scroll"===N.type?("up"===N.scroll_direction||"down"===N.scroll_direction)&&rt?v():g():"rotate"===N.type&&W())})),S.on("mtphr_dnt_resize_single",(function(){"scroll"===N.type?g():"rotate"===N.type&&W()})),t("body").on("mtphr_dnt_resize",(function(t,e){e&&e.indexOf(N.id)>=0&&("scroll"===N.type?g():"rotate"===N.type&&W())})),S.on("mtphr_dnt_replace_ticks",(function(e,r,n){clearInterval(it),S.find(".mtphr-dnt-tick").remove(),r.each((function(){U.append(t(this))})),setTimeout((function(){i()}),n)})),0===S.outerWidth())var at=setInterval((function(){S.outerWidth()>10&&(clearInterval(at),$=U.outerWidth(),i())}),100);else i()}))}};t.fn.ditty_news_ticker=function(i){return e[i]?e[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist in ditty_news_ticker"):e.init.apply(this,arguments)}}(jQuery);
|
1 |
+
!function(t){var e={init:function(e){return this.each((function(){function i(){N.tick_count=S.find(".mtphr-dnt-tick").length,N.tick_count>0&&("scroll"===K.type?r():"rotate"===K.type&&y()),K.after_load.call(P,S),P.trigger("mtphr_dnt_after_load_single",[N,tt]),t("body").trigger("mtphr_dnt_after_load",[P,N,tt])}function n(){S.find(".mtphr-dnt-tick").each((function(){t(this).height()>$&&($=t(this).height()),"up"!==K.scroll_direction&&"down"!==K.scroll_direction||t(this).css("height","auto")})),S.css("height",$+"px")}function r(){var e=S.find(".mtphr-dnt-tick:first");if(e.attr("style")){var i,r=e.attr("style").split("width:");it=!(r.length>1)}tt=[],S.find("img").length?S.imagesLoaded((function(){n(),S.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];tt.push(e)})),g(),a()})):(n(),S.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];tt.push(e)})),g(),a()),S.hover((function(){K.scroll_pause&&s()}),(function(){K.scroll_pause&&!N.paused&&o()}))}function s(){clearInterval(et)}function o(){a()}function a(){clearInterval(et),et=setInterval((function(){for(var t=0;t<N.tick_count;t++)if(!0===tt[t][0].visible){var e="reset";"left"===K.scroll_direction||"right"===K.scroll_direction?"reset"===(e="left"===K.scroll_direction?c(t):p(t))?(e=tt[t][0].reset,tt[t][0].headline.css("opacity",0),tt[t][0].headline.stop(!0,!0).css("left",e+"px")):(tt[t][0].headline.css("opacity",1),tt[t][0].headline.stop(!0,!0).animate({left:e+"px"},100,"linear")):"reset"===(e="up"===K.scroll_direction?l(t):_(t))?(e=tt[t][0].reset,tt[t][0].headline.css("opacity",0),tt[t][0].headline.stop(!0,!0).css("top",e+"px")):(tt[t][0].headline.css("opacity",1),tt[t][0].headline.stop(!0,!0).animate({top:e+"px"},100,"linear")),tt[t][0].position=e}}),100)}function c(t){var e=parseFloat(tt[t][0].position-K.scroll_speed);return e<-(tt[t][0].headline.width()+K.offset)?e=d(t):e<parseFloat(Z-tt[t][0].headline.width()-K.scroll_spacing)&&u(t),e}function p(t){var e=tt[t][0].position+K.scroll_speed;return e>Z+K.offset?e=d(t):e>K.scroll_spacing&&u(t),e}function l(t){var e=tt[t][0].position-K.scroll_speed;return e<-(tt[t][0].headline.height()+K.offset)?e=d(t):e<$-tt[t][0].headline.height()-K.scroll_spacing&&u(t),e}function _(t){var e=tt[t][0].position+K.scroll_speed;return e>$+K.offset?e=d(t):e>K.scroll_spacing&&u(t),e}function d(e){return N.tick_count>1&&(tt[e][0].visible=!1),N.tick_count===e+1&&(P.trigger("mtphr_dnt_scroll_complete",[N,tt]),t("body").trigger("mtphr_dnt_scroll_complete",[P,N,tt])),"reset"}function f(t){!1===tt[t][0].visible&&(N.previous_tick=parseInt(t-1),N.previous_tick<0&&(N.previous_tick=parseInt(N.tick_count-1)),N.current_tick=t,N.next_tick=parseInt(t+1),N.next_tick>=N.tick_count&&(N.next_tick=0))}function u(t){t===N.tick_count-1?K.scroll_loop&&(f(0),tt[0][0].visible=!0):(f(parseInt(t+1)),tt[t+1][0].visible=!0)}function h(){for(var t=0;t<N.tick_count;t++){var e,i=tt[t][0].headline;switch(K.scroll_direction){case"left":e=Z+K.offset,!1===tt[t][0].visible&&i.css("left",e+"px");break;case"right":e=parseInt("-"+(i.width()+K.offset)),!1===tt[t][0].visible&&i.css("left",e+"px");break;case"up":it&&i.css("width",Z),e=parseInt($+K.offset),!1===tt[t][0].visible&&i.css("top",e+"px");break;case"down":it&&i.css("width",Z),e=parseInt("-"+(i.height()+K.offset)),!1===tt[t][0].visible&&i.css("top",e+"px");break}tt[t][0].width=i.width(),tt[t][0].height=i.height(),!1===tt[t][0].visible&&(tt[t][0].position=e),tt[t][0].reset=e}}function g(){for(var t,e,i=0;i<N.tick_count;i++)if(tt[i]){switch(e=tt[i][0].headline,K.scroll_direction){case"left":t=Z+K.offset,e.stop(!0,!0).css("left",t+"px");break;case"right":t=parseInt("-"+(e.width()+K.offset)),e.stop(!0,!0).css("left",t+"px");break;case"up":it&&e.css("width",Z),t=parseInt($+K.offset),e.stop(!0,!0).css("top",t+"px");break;case"down":it&&e.css("width",Z),t=parseInt("-"+(e.height()+K.offset)),e.stop(!0,!0).css("top",t+"px");break}tt[i][0].width=e.width(),tt[i][0].height=e.height(),tt[i][0].position=t,tt[i][0].reset=t,tt[i][0].visible=!1}if(N.current_tick=0,tt[N.current_tick][0].visible=!0,K.scroll_init)for("left"===K.scroll_direction?t=.1*Z:"right"===K.scroll_direction?t=.9*Z:"up"===K.scroll_direction?t=.1*$:"down"===K.scroll_direction&&(t=.9*$),i=0;i<N.tick_count;i++)switch(e=tt[i][0].headline,K.scroll_direction){case"left":t<Z&&(e.stop(!0,!0).css("left",t+"px"),tt[i][0].position=t,tt[i][0].visible=!0,t=t+tt[i][0].width+K.scroll_spacing);break;case"right":t>0&&(t-=tt[i][0].width,e.stop(!0,!0).css("left",t+"px"),tt[i][0].position=t,tt[i][0].visible=!0,t-=K.scroll_spacing);break;case"up":t<$&&(e.stop(!0,!0).css("top",t+"px"),tt[i][0].position=t,tt[i][0].visible=!0,t=t+tt[i][0].height+K.scroll_spacing);break;case"down":t>0&&(t-=tt[i][0].height,e.stop(!0,!0).css("top",t+"px"),tt[i][0].position=t,tt[i][0].visible=!0,t-=K.scroll_spacing);break}}function v(){m()}function k(){clearInterval(nt)}function y(){switch(S.find(".mtphr-dnt-tick").each((function(){tt.push(t(this)),t(this).imagesLoaded((function(){F()}))})),F(),S.find(".mtphr-dnt-tick").show(),K.rotate_type){case"fade":C(S,tt,parseInt(100*K.rotate_speed),K.rotate_ease);break;case"slide_left":z(S,tt,parseInt(100*K.rotate_speed),K.rotate_ease);break;case"slide_right":T(S,tt,parseInt(100*K.rotate_speed),K.rotate_ease);break;case"slide_down":A(S,tt,parseInt(100*K.rotate_speed),K.rotate_ease);break;case"slide_up":R(S,tt,parseInt(100*K.rotate_speed),K.rotate_ease);break}w(0),K.auto_rotate&&v(),S.hover((function(){K.auto_rotate&&K.rotate_pause&&!N.running&&k()}),(function(){K.auto_rotate&&K.rotate_pause&&!N.running&&!N.paused&&v()}))}function m(){k(),nt=setInterval((function(){var t=parseInt(N.current_tick+1);t===N.tick_count&&(t=0),b(t)}),parseInt(1e3*K.rotate_delay))}function b(e){N.current_tick!==e&&(K.auto_rotate&&k(),N.next_tick=e,K.before_change.call(P,S),P.trigger("mtphr_dnt_before_change_single",[N,tt]),t("body").trigger("mtphr_dnt_before_change",[P,N,tt]),N.running=1,I(e),x(e),N.previous_tick=N.current_tick,N.current_tick=e,st=setTimeout((function(){K.after_change.call(P,S),P.trigger("mtphr_dnt_after_change_single",[N,tt]),t("body").trigger("mtphr_dnt_after_change",[P,N,tt]),rt=K.rotate_type,N.reverse=0,N.running=0,K.auto_rotate&&!N.paused&&m()}),parseInt(100*K.rotate_speed)))}function w(t){X&&(X.children("a").removeClass("active"),X.children('a[href="'+t+'"]').addClass("active"))}function x(e){switch(w(e),rt){case"fade":D(S,t(tt[e]),t(tt[N.current_tick]),parseInt(100*K.rotate_speed),K.rotate_ease);break;case"slide_left":L(S,t(tt[e]),t(tt[N.current_tick]),parseInt(100*K.rotate_speed),K.rotate_ease);break;case"slide_right":j(S,t(tt[e]),t(tt[N.current_tick]),parseInt(100*K.rotate_speed),K.rotate_ease);break;case"slide_down":M(S,t(tt[e]),t(tt[N.current_tick]),parseInt(100*K.rotate_speed),K.rotate_ease);break;case"slide_up":q(S,t(tt[e]),t(tt[N.current_tick]),parseInt(100*K.rotate_speed),K.rotate_ease);break}}function I(e){switch(rt){case"fade":W(S,t(tt[N.current_tick]),t(tt[e]),parseInt(100*K.rotate_speed),K.rotate_ease);break;case"slide_left":O(S,t(tt[N.current_tick]),t(tt[e]),parseInt(100*K.rotate_speed),K.rotate_ease);break;case"slide_right":E(S,t(tt[N.current_tick]),t(tt[e]),parseInt(100*K.rotate_speed),K.rotate_ease);break;case"slide_down":Q(S,t(tt[N.current_tick]),t(tt[e]),parseInt(100*K.rotate_speed),K.rotate_ease);break;case"slide_up":B(S,t(tt[N.current_tick]),t(tt[e]),parseInt(100*K.rotate_speed),K.rotate_ease);break}}function F(){for(var e=0;e<N.tick_count;e++)t(tt[e]).width(Z+"px"),N.current_tick!==e&&t(tt[e]).css({left:parseFloat(Z+K.offset)+"px"});var i=t(tt[N.current_tick]).height();S.stop().css("height",i+"px")}function C(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:"auto"})}function D(t,e,i,n,r){e.css({opacity:0,left:"auto"}),e.stop().animate({opacity:1},n,r);var s=e.height();t.stop().animate({height:s+"px"},n,r)}function W(e,i,n,r,s){i.stop().animate({opacity:0},r,s,(function(){t(this).css({left:parseFloat(Z+K.offset)+"px"}),i.remove(),e.append(i)}))}function z(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:0})}function L(t,e,i,n,r){var s=e.height();e.css({opacity:1,left:parseFloat(Z+K.offset)+"px"}),t.stop().animate({height:s+"px"},n,r,(function(){})),e.stop().animate({left:"0"},n,r,(function(){}))}function O(t,e,i,n,r){e.stop().animate({left:"-"+parseFloat(Z+K.offset)+"px"},n,r,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function T(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:0})}function j(t,e,i,n,r){var s=e.height();e.css({opacity:1,left:"-"+parseFloat(Z+K.offset)+"px"}),t.stop().animate({height:s+"px"},n,r,(function(){})),e.stop().animate({left:"0"},n,r)}function E(t,e,i,n,r){e.stop().animate({left:parseFloat(Z+K.offset)+"px"},n,r,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function A(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,top:0,left:"auto"})}function M(t,e,i,n,r){var s=e.height();e.css({opacity:1,top:"-"+parseFloat(s+K.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},n,r),e.stop().animate({top:"0"},n,r)}function Q(t,e,i,n,r){var s=i.height();e.stop().animate({top:parseFloat(s+K.offset)+"px"},n,r,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function R(t,e){var i=e[0],n=i.height();t.css({height:n+"px",left:"auto"}),i.css({opacity:1,top:0})}function q(t,e,i,n,r){var s=e.height();e.css({opacity:1,top:parseFloat(i.height()+K.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},n,r),e.stop().animate({top:"0"},n,r)}function B(t,e,i,n,r){var s=e.height();e.stop().animate({top:"-"+parseFloat(s+K.offset)+"px"},n,r,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function G(){if(N.running)return!1;var t=parseInt(N.current_tick+1);t===N.tick_count&&(t=0),b(t)}function H(){if(N.running)return!1;var t=parseInt(N.current_tick-1);t<0&&(t=N.tick_count-1),K.nav_reverse&&("slide_left"===K.rotate_type?rt="slide_right":"slide_right"===K.rotate_type?rt="slide_left":"slide_down"===K.rotate_type?rt="slide_up":"slide_up"===K.rotate_type&&(rt="slide_down"),N.reverse=1),b(t)}function J(t){t?(N.paused=!1,Y.removeClass("paused"),"scroll"===K.type?o():v()):(N.paused=!0,Y.addClass("paused"),"scroll"===K.type?s():k()),P.trigger("mtphr_dnt_play_pause",[N,tt])}var K={id:"",type:"scroll",scroll_direction:"left",scroll_speed:10,scroll_pause:0,scroll_spacing:40,scroll_units:10,scroll_init:0,scroll_loop:1,rotate_type:"fade",auto_rotate:0,rotate_delay:10,rotate_pause:0,rotate_speed:10,rotate_ease:"easeOutExpo",nav_reverse:0,disable_touchswipe:0,offset:20,before_change:function(){},after_change:function(){},after_load:function(){}},N={id:K.id,tick_count:0,previous_tick:0,current_tick:0,next_tick:0,reverse:0,running:0,paused:0};e&&t.extend(K,e);var P=t(this),S=P.find(".mtphr-dnt-tick-contents"),U=P.find(".mtphr-dnt-nav-prev"),V=P.find(".mtphr-dnt-nav-next"),X=P.find(".mtphr-dnt-control-links"),Y=P.find(".mtphr-dnt-play-pause"),Z=S.outerWidth(!0),$=0,tt=[],et,it=!0,nt,rt=K.rotate_type,st;if(S.data("ditty:vars",N),U&&"rotate"===K.type&&(U.bind("click",(function(t){t.preventDefault(),H()})),V.bind("click",(function(t){t.preventDefault(),G()}))),X&&"rotate"===K.type&&X.children("a").bind("click",(function(e){e.preventDefault();var i=parseInt(t(this).attr("href"));if(N.running)return!1;if(i===N.current_tick)return!1;var n=i<N.current_tick?1:0;K.nav_reverse&&n&&("slide_left"===K.rotate_type?rt="slide_right":"slide_right"===K.rotate_type?rt="slide_left":"slide_down"===K.rotate_type?rt="slide_up":"slide_up"===K.rotate_type&&(rt="slide_down"),N.reverse=1),b(i)})),Y.bind("click",(function(t){t.preventDefault(),J(N.paused)})),"rotate"!==K.type||K.disable_touchswipe||S.swipe({triggerOnTouchEnd:!0,swipeLeft:function(){if(N.running)return!1;var t=parseInt(N.current_tick+1);t===N.tick_count&&(t=0),"slide_left"!==K.rotate_type&&"slide_right"!==K.rotate_type||(rt="slide_left"),b(t)},swipeRight:function(){if(N.running)return!1;var t=parseInt(N.current_tick-1);t<0&&(t=N.tick_count-1),"slide_left"!==K.rotate_type&&"slide_right"!==K.rotate_type||(rt="slide_right"),K.nav_reverse&&("slide_down"===K.rotate_type?rt="slide_up":"slide_up"===K.rotate_type&&(rt="slide_down"),N.reverse=1),b(t)}}),P.on("mtphr_dnt_next",(function(){G()})),P.on("mtphr_dnt_prev",(function(){H()})),P.on("mtphr_dnt_goto",(function(t,e){b(parseInt(e))})),P.on("mtphr_dnt_pause",(function(){J()})),P.on("mtphr_dnt_play",(function(){J(!0)})),t(window).resize((function(){S.outerWidth()!==Z&&(Z=S.outerWidth(!0),"scroll"===K.type?("up"===K.scroll_direction||"down"===K.scroll_direction)&&it?g():h():"rotate"===K.type&&F())})),P.on("mtphr_dnt_resize_single",(function(){"scroll"===K.type?h():"rotate"===K.type&&F()})),t("body").on("mtphr_dnt_resize",(function(t,e){e&&e.indexOf(K.id)>=0&&("scroll"===K.type?h():"rotate"===K.type&&F())})),P.on("mtphr_dnt_replace_ticks",(function(e,n,r){clearInterval(et),P.find(".mtphr-dnt-tick").remove(),n.each((function(){S.append(t(this))})),setTimeout((function(){i()}),r)})),0===P.width())var ot=setInterval((function(){P.width()>10&&(clearInterval(ot),Z=S.outerWidth(!0),i())}),100);else i()}))}};t.fn.ditty_news_ticker=function(i){return e[i]?e[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist in ditty_news_ticker"):e.init.apply(this,arguments)}}(jQuery);
|
readme.txt
CHANGED
@@ -72,6 +72,9 @@ The most common cause for an unresponsive ticker (when using scroll or rotate mo
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
75 |
= 2.2.16 =
|
76 |
* Swapped play and pause button icons
|
77 |
|
@@ -534,4 +537,4 @@ The most common cause for an unresponsive ticker (when using scroll or rotate mo
|
|
534 |
|
535 |
== Upgrade Notice ==
|
536 |
|
537 |
-
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 2.2.17 =
|
76 |
+
* Bug fix with scrolling ticker
|
77 |
+
|
78 |
= 2.2.16 =
|
79 |
* Swapped play and pause button icons
|
80 |
|
537 |
|
538 |
== Upgrade Notice ==
|
539 |
|
540 |
+
Bug fix with scrolling ticker
|