Version Description
- Reworked scroll functionality for better performance
Download this release
Release Info
Developer | metaphorcreations |
Plugin | Ditty News Ticker |
Version | 2.3 |
Comparing to | |
See all releases |
Code changes from version 2.2.19 to 2.3
- ditty-news-ticker.php +2 -2
- inc/static/css/style.css +4 -0
- inc/static/js/ditty-news-ticker.js +30 -38
- inc/static/js/ditty-news-ticker.min.js +1 -1
- inc/static/sass/style.scss +4 -0
- readme.txt +5 -2
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.
|
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.
|
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.3
|
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.3' );
|
66 |
}
|
67 |
|
68 |
// Plugin Folder Path
|
inc/static/css/style.css
CHANGED
@@ -50,6 +50,10 @@
|
|
50 |
|
51 |
.mtphr-dnt-scroll-left .mtphr-dnt-tick,
|
52 |
.mtphr-dnt-scroll-right .mtphr-dnt-tick {
|
|
|
|
|
|
|
|
|
53 |
white-space: nowrap; }
|
54 |
|
55 |
.mtphr-dnt-trim-ticks .mtphr-dnt-tick * {
|
50 |
|
51 |
.mtphr-dnt-scroll-left .mtphr-dnt-tick,
|
52 |
.mtphr-dnt-scroll-right .mtphr-dnt-tick {
|
53 |
+
position: absolute;
|
54 |
+
top: 0;
|
55 |
+
left: 0;
|
56 |
+
display: block;
|
57 |
white-space: nowrap; }
|
58 |
|
59 |
.mtphr-dnt-trim-ticks .mtphr-dnt-tick * {
|
inc/static/js/ditty-news-ticker.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
/**
|
2 |
* Ditty News Ticker
|
3 |
-
* Date:
|
4 |
*
|
5 |
* @author Metaphor Creations
|
6 |
-
* @version
|
7 |
*
|
8 |
**/
|
9 |
|
@@ -230,7 +230,7 @@
|
|
230 |
clearInterval( ticker_scroll );
|
231 |
ticker_scroll = setInterval( function() {
|
232 |
|
233 |
-
for( var i=0; i<vars.tick_count; i++ ) {
|
234 |
|
235 |
if( ticks[i][0].visible === true ) {
|
236 |
|
@@ -242,32 +242,30 @@
|
|
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 {
|
247 |
-
ticks[i][0].headline.css('opacity', 1);
|
248 |
-
ticks[i][0].headline.stop(true,true).animate( {
|
249 |
-
left: pos+'px'
|
250 |
-
}, 100, 'linear' );
|
251 |
}
|
|
|
|
|
|
|
252 |
} 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 {
|
260 |
ticks[i][0].headline.css('opacity', 1);
|
261 |
-
ticks[i][0].headline.stop(true,true).animate( {
|
262 |
-
top: pos+'px'
|
263 |
-
}, 100, 'linear' );
|
264 |
}
|
|
|
|
|
|
|
265 |
}
|
266 |
|
267 |
ticks[i][0].position = pos;
|
268 |
}
|
269 |
}
|
270 |
-
},
|
271 |
}
|
272 |
|
273 |
/**
|
@@ -278,7 +276,7 @@
|
|
278 |
function mtphr_dnt_scroll_left( i ) {
|
279 |
|
280 |
// Find the new position
|
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) ) {
|
@@ -298,7 +296,7 @@
|
|
298 |
function mtphr_dnt_scroll_right( i ) {
|
299 |
|
300 |
// Find the new position
|
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 ) {
|
@@ -318,7 +316,7 @@
|
|
318 |
function mtphr_dnt_scroll_up( i ) {
|
319 |
|
320 |
// Find the new position
|
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) ) {
|
@@ -338,7 +336,7 @@
|
|
338 |
function mtphr_dnt_scroll_down( i ) {
|
339 |
|
340 |
// Find the new position
|
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 ) {
|
@@ -411,7 +409,7 @@
|
|
411 |
*/
|
412 |
function mtphr_dnt_scroll_resize_ticks() {
|
413 |
|
414 |
-
for( var i=0; i<vars.tick_count; i++ ) {
|
415 |
|
416 |
// Set the tick position
|
417 |
var position;
|
@@ -422,14 +420,14 @@
|
|
422 |
case 'left':
|
423 |
position = ticker_width+settings.offset;
|
424 |
if( ticks[i][0].visible === false ) {
|
425 |
-
$tick.css('
|
426 |
}
|
427 |
break;
|
428 |
|
429 |
case 'right':
|
430 |
position = parseInt('-'+($tick.width()+settings.offset));
|
431 |
if( ticks[i][0].visible === false ) {
|
432 |
-
$tick.css('
|
433 |
}
|
434 |
break;
|
435 |
|
@@ -439,7 +437,7 @@
|
|
439 |
}
|
440 |
position = parseInt(ticker_height+settings.offset);
|
441 |
if( ticks[i][0].visible === false ) {
|
442 |
-
$tick.css('
|
443 |
}
|
444 |
break;
|
445 |
|
@@ -449,7 +447,7 @@
|
|
449 |
}
|
450 |
position = parseInt('-'+($tick.height()+settings.offset));
|
451 |
if( ticks[i][0].visible === false ) {
|
452 |
-
$tick.css('
|
453 |
}
|
454 |
break;
|
455 |
}
|
@@ -474,7 +472,7 @@
|
|
474 |
var position,
|
475 |
$tick;
|
476 |
|
477 |
-
for( var i=0; i<vars.tick_count; i++ ) {
|
478 |
|
479 |
if( ticks[i] ) {
|
480 |
|
@@ -483,18 +481,12 @@
|
|
483 |
switch( settings.scroll_direction ) {
|
484 |
case 'left':
|
485 |
position = ticker_width+settings.offset;
|
486 |
-
$tick.
|
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');
|
498 |
break;
|
499 |
|
500 |
case 'up':
|
@@ -502,7 +494,7 @@
|
|
502 |
$tick.css('width',ticker_width);
|
503 |
}
|
504 |
position = parseInt(ticker_height+settings.offset);
|
505 |
-
$tick.
|
506 |
break;
|
507 |
|
508 |
case 'down':
|
@@ -510,7 +502,7 @@
|
|
510 |
$tick.css('width',ticker_width);
|
511 |
}
|
512 |
position = parseInt('-'+($tick.height()+settings.offset));
|
513 |
-
$tick.
|
514 |
break;
|
515 |
}
|
516 |
|
@@ -541,14 +533,14 @@
|
|
541 |
position = ticker_height*0.9;
|
542 |
}
|
543 |
|
544 |
-
for( i=0; i<vars.tick_count; i++ ) {
|
545 |
|
546 |
$tick = ticks[i][0].headline;
|
547 |
|
548 |
switch( settings.scroll_direction ) {
|
549 |
case 'left':
|
550 |
if( position < ticker_width ) {
|
551 |
-
$tick.
|
552 |
ticks[i][0].position = position;
|
553 |
ticks[i][0].visible = true;
|
554 |
position = position + ticks[i][0].width + settings.scroll_spacing;
|
@@ -558,7 +550,7 @@
|
|
558 |
case 'right':
|
559 |
if( position > 0 ) {
|
560 |
position = position - ticks[i][0].width;
|
561 |
-
$tick.
|
562 |
ticks[i][0].position = position;
|
563 |
ticks[i][0].visible = true;
|
564 |
position = position - settings.scroll_spacing;
|
@@ -567,7 +559,7 @@
|
|
567 |
|
568 |
case 'up':
|
569 |
if( position < ticker_height ) {
|
570 |
-
$tick.
|
571 |
ticks[i][0].position = position;
|
572 |
ticks[i][0].visible = true;
|
573 |
position = position + ticks[i][0].height + settings.scroll_spacing;
|
@@ -576,7 +568,7 @@
|
|
576 |
|
577 |
case 'down':
|
578 |
if( position > 0 ) {
|
579 |
-
|
580 |
$tick.stop(true,true).css('top',position+'px');
|
581 |
ticks[i][0].position = position;
|
582 |
ticks[i][0].visible = true;
|
1 |
/**
|
2 |
* Ditty News Ticker
|
3 |
+
* Date: 12/20/2020
|
4 |
*
|
5 |
* @author Metaphor Creations
|
6 |
+
* @version 2.3
|
7 |
*
|
8 |
**/
|
9 |
|
230 |
clearInterval( ticker_scroll );
|
231 |
ticker_scroll = setInterval( function() {
|
232 |
|
233 |
+
for( var i=0; i < vars.tick_count; i++ ) {
|
234 |
|
235 |
if( ticks[i][0].visible === true ) {
|
236 |
|
242 |
if( pos === 'reset' ) {
|
243 |
pos = ticks[i][0].reset;
|
244 |
ticks[i][0].headline.css('opacity', 0);
|
|
|
245 |
} else {
|
246 |
+
ticks[i][0].headline.css('opacity', 1);
|
|
|
|
|
|
|
247 |
}
|
248 |
+
ticks[i][0].headline.css( {
|
249 |
+
transform: 'translateX( ' + pos + 'px )',
|
250 |
+
} );
|
251 |
} else {
|
252 |
|
253 |
pos = (settings.scroll_direction === 'up') ? mtphr_dnt_scroll_up(i) : mtphr_dnt_scroll_down(i);
|
254 |
if( pos === 'reset' ) {
|
255 |
pos = ticks[i][0].reset;
|
256 |
ticks[i][0].headline.css('opacity', 0);
|
|
|
257 |
} else {
|
258 |
ticks[i][0].headline.css('opacity', 1);
|
|
|
|
|
|
|
259 |
}
|
260 |
+
ticks[i][0].headline.css( {
|
261 |
+
transform: 'translateY( ' + pos + 'px )',
|
262 |
+
} );
|
263 |
}
|
264 |
|
265 |
ticks[i][0].position = pos;
|
266 |
}
|
267 |
}
|
268 |
+
}, 1);
|
269 |
}
|
270 |
|
271 |
/**
|
276 |
function mtphr_dnt_scroll_left( i ) {
|
277 |
|
278 |
// Find the new position
|
279 |
+
var pos = parseFloat( ticks[i][0].position - ( settings.scroll_speed * 0.05 ) );
|
280 |
|
281 |
// Reset the tick if off the screen
|
282 |
if( pos < -(ticks[i][0].headline.width()+settings.offset) ) {
|
296 |
function mtphr_dnt_scroll_right( i ) {
|
297 |
|
298 |
// Find the new position
|
299 |
+
var pos = parseFloat( ticks[i][0].position + ( settings.scroll_speed * 0.05 ) );
|
300 |
|
301 |
// Reset the tick if off the screen
|
302 |
if( pos > ticker_width+settings.offset ) {
|
316 |
function mtphr_dnt_scroll_up( i ) {
|
317 |
|
318 |
// Find the new position
|
319 |
+
var pos = parseFloat( ticks[i][0].position - ( settings.scroll_speed * 0.05 ) );
|
320 |
|
321 |
// Reset the tick if off the screen
|
322 |
if( pos < -(ticks[i][0].headline.height()+settings.offset) ) {
|
336 |
function mtphr_dnt_scroll_down( i ) {
|
337 |
|
338 |
// Find the new position
|
339 |
+
var pos = parseFloat( ticks[i][0].position + ( settings.scroll_speed * 0.05 ) );
|
340 |
|
341 |
// Reset the tick if off the screen
|
342 |
if( pos > ticker_height+settings.offset ) {
|
409 |
*/
|
410 |
function mtphr_dnt_scroll_resize_ticks() {
|
411 |
|
412 |
+
for( var i=0; i < vars.tick_count; i++ ) {
|
413 |
|
414 |
// Set the tick position
|
415 |
var position;
|
420 |
case 'left':
|
421 |
position = ticker_width+settings.offset;
|
422 |
if( ticks[i][0].visible === false ) {
|
423 |
+
$tick.css('transform','translateX( ' + position + 'px )');
|
424 |
}
|
425 |
break;
|
426 |
|
427 |
case 'right':
|
428 |
position = parseInt('-'+($tick.width()+settings.offset));
|
429 |
if( ticks[i][0].visible === false ) {
|
430 |
+
$tick.css('transform','translateX( ' + position + 'px )');
|
431 |
}
|
432 |
break;
|
433 |
|
437 |
}
|
438 |
position = parseInt(ticker_height+settings.offset);
|
439 |
if( ticks[i][0].visible === false ) {
|
440 |
+
$tick.css('transform','translateY( ' + position + 'px )');
|
441 |
}
|
442 |
break;
|
443 |
|
447 |
}
|
448 |
position = parseInt('-'+($tick.height()+settings.offset));
|
449 |
if( ticks[i][0].visible === false ) {
|
450 |
+
$tick.css('transform','translateY( ' + position + 'px )');
|
451 |
}
|
452 |
break;
|
453 |
}
|
472 |
var position,
|
473 |
$tick;
|
474 |
|
475 |
+
for( var i=0; i < vars.tick_count; i++ ) {
|
476 |
|
477 |
if( ticks[i] ) {
|
478 |
|
481 |
switch( settings.scroll_direction ) {
|
482 |
case 'left':
|
483 |
position = ticker_width+settings.offset;
|
484 |
+
$tick.css('transform','translateX( ' + position + 'px )');
|
485 |
break;
|
486 |
|
487 |
case 'right':
|
|
|
488 |
position = parseInt('-'+($tick.width()+settings.offset));
|
489 |
+
$tick.css('transform','translateX( ' + position + 'px )');
|
|
|
|
|
|
|
|
|
|
|
490 |
break;
|
491 |
|
492 |
case 'up':
|
494 |
$tick.css('width',ticker_width);
|
495 |
}
|
496 |
position = parseInt(ticker_height+settings.offset);
|
497 |
+
$tick.css('transform','translateY( ' + position + 'px )');
|
498 |
break;
|
499 |
|
500 |
case 'down':
|
502 |
$tick.css('width',ticker_width);
|
503 |
}
|
504 |
position = parseInt('-'+($tick.height()+settings.offset));
|
505 |
+
$tick.css('transform','translateY( ' + position + 'px )');
|
506 |
break;
|
507 |
}
|
508 |
|
533 |
position = ticker_height*0.9;
|
534 |
}
|
535 |
|
536 |
+
for( i=0; i < vars.tick_count; i++ ) {
|
537 |
|
538 |
$tick = ticks[i][0].headline;
|
539 |
|
540 |
switch( settings.scroll_direction ) {
|
541 |
case 'left':
|
542 |
if( position < ticker_width ) {
|
543 |
+
$tick.css('transform','translateX( ' + position + 'px )');
|
544 |
ticks[i][0].position = position;
|
545 |
ticks[i][0].visible = true;
|
546 |
position = position + ticks[i][0].width + settings.scroll_spacing;
|
550 |
case 'right':
|
551 |
if( position > 0 ) {
|
552 |
position = position - ticks[i][0].width;
|
553 |
+
$tick.css('transform','translateX( ' + position + 'px )');
|
554 |
ticks[i][0].position = position;
|
555 |
ticks[i][0].visible = true;
|
556 |
position = position - settings.scroll_spacing;
|
559 |
|
560 |
case 'up':
|
561 |
if( position < ticker_height ) {
|
562 |
+
$tick.css('transform','translateY( ' + position + 'px )');
|
563 |
ticks[i][0].position = position;
|
564 |
ticks[i][0].visible = true;
|
565 |
position = position + ticks[i][0].height + settings.scroll_spacing;
|
568 |
|
569 |
case 'down':
|
570 |
if( position > 0 ) {
|
571 |
+
$tick.css('transform','translateY( ' + position + 'px )');
|
572 |
$tick.stop(true,true).css('top',position+'px');
|
573 |
ticks[i][0].position = position;
|
574 |
ticks[i][0].visible = true;
|
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(){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);
|
1 |
+
!function(t){var e={init:function(e){return this.each((function(){function r(){J.tick_count=N.find(".mtphr-dnt-tick").length,J.tick_count>0&&("scroll"===H.type?n():"rotate"===H.type&&m()),H.after_load.call(K,N),K.trigger("mtphr_dnt_after_load_single",[J,tt]),t("body").trigger("mtphr_dnt_after_load",[K,J,tt])}function i(){N.find(".mtphr-dnt-tick").each((function(){t(this).height()>$&&($=t(this).height()),"up"!==H.scroll_direction&&"down"!==H.scroll_direction||t(this).css("height","auto")})),N.css("height",$+"px")}function n(){var e=N.find(".mtphr-dnt-tick:first");if(e.attr("style")){var r,n=e.attr("style").split("width:");rt=!(n.length>1)}tt=[],N.find("img").length?N.imagesLoaded((function(){i(),N.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];tt.push(e)})),g(),o()})):(i(),N.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];tt.push(e)})),g(),o()),N.hover((function(){H.scroll_pause&&s()}),(function(){H.scroll_pause&&!J.paused&&a()}))}function s(){clearInterval(et)}function a(){o()}function o(){clearInterval(et),et=setInterval((function(){for(var t=0;t<J.tick_count;t++)if(!0===tt[t][0].visible){var e="reset";"left"===H.scroll_direction||"right"===H.scroll_direction?("reset"===(e="left"===H.scroll_direction?c(t):p(t))?(e=tt[t][0].reset,tt[t][0].headline.css("opacity",0)):tt[t][0].headline.css("opacity",1),tt[t][0].headline.css({transform:"translateX( "+e+"px )"})):("reset"===(e="up"===H.scroll_direction?l(t):_(t))?(e=tt[t][0].reset,tt[t][0].headline.css("opacity",0)):tt[t][0].headline.css("opacity",1),tt[t][0].headline.css({transform:"translateY( "+e+"px )"})),tt[t][0].position=e}}),1)}function c(t){var e=parseFloat(tt[t][0].position-.05*H.scroll_speed);return e<-(tt[t][0].headline.width()+H.offset)?e=f(t):e<parseFloat(Z-tt[t][0].headline.width()-H.scroll_spacing)&&u(t),e}function p(t){var e=parseFloat(tt[t][0].position+.05*H.scroll_speed);return e>Z+H.offset?e=f(t):e>H.scroll_spacing&&u(t),e}function l(t){var e=parseFloat(tt[t][0].position-.05*H.scroll_speed);return e<-(tt[t][0].headline.height()+H.offset)?e=f(t):e<$-tt[t][0].headline.height()-H.scroll_spacing&&u(t),e}function _(t){var e=parseFloat(tt[t][0].position+.05*H.scroll_speed);return e>$+H.offset?e=f(t):e>H.scroll_spacing&&u(t),e}function f(e){return J.tick_count>1&&(tt[e][0].visible=!1),J.tick_count===e+1&&(K.trigger("mtphr_dnt_scroll_complete",[J,tt]),t("body").trigger("mtphr_dnt_scroll_complete",[K,J,tt])),"reset"}function d(t){!1===tt[t][0].visible&&(J.previous_tick=parseInt(t-1),J.previous_tick<0&&(J.previous_tick=parseInt(J.tick_count-1)),J.current_tick=t,J.next_tick=parseInt(t+1),J.next_tick>=J.tick_count&&(J.next_tick=0))}function u(t){t===J.tick_count-1?H.scroll_loop&&(d(0),tt[0][0].visible=!0):(d(parseInt(t+1)),tt[t+1][0].visible=!0)}function h(){for(var t=0;t<J.tick_count;t++){var e,r=tt[t][0].headline;switch(H.scroll_direction){case"left":e=Z+H.offset,!1===tt[t][0].visible&&r.css("transform","translateX( "+e+"px )");break;case"right":e=parseInt("-"+(r.width()+H.offset)),!1===tt[t][0].visible&&r.css("transform","translateX( "+e+"px )");break;case"up":rt&&r.css("width",Z),e=parseInt($+H.offset),!1===tt[t][0].visible&&r.css("transform","translateY( "+e+"px )");break;case"down":rt&&r.css("width",Z),e=parseInt("-"+(r.height()+H.offset)),!1===tt[t][0].visible&&r.css("transform","translateY( "+e+"px )");break}tt[t][0].width=r.width(),tt[t][0].height=r.height(),!1===tt[t][0].visible&&(tt[t][0].position=e),tt[t][0].reset=e}}function g(){for(var t,e,r=0;r<J.tick_count;r++)if(tt[r]){switch(e=tt[r][0].headline,H.scroll_direction){case"left":t=Z+H.offset,e.css("transform","translateX( "+t+"px )");break;case"right":t=parseInt("-"+(e.width()+H.offset)),e.css("transform","translateX( "+t+"px )");break;case"up":rt&&e.css("width",Z),t=parseInt($+H.offset),e.css("transform","translateY( "+t+"px )");break;case"down":rt&&e.css("width",Z),t=parseInt("-"+(e.height()+H.offset)),e.css("transform","translateY( "+t+"px )");break}tt[r][0].width=e.width(),tt[r][0].height=e.height(),tt[r][0].position=t,tt[r][0].reset=t,tt[r][0].visible=!1}if(J.current_tick=0,tt[J.current_tick][0].visible=!0,H.scroll_init)for("left"===H.scroll_direction?t=.1*Z:"right"===H.scroll_direction?t=.9*Z:"up"===H.scroll_direction?t=.1*$:"down"===H.scroll_direction&&(t=.9*$),r=0;r<J.tick_count;r++)switch(e=tt[r][0].headline,H.scroll_direction){case"left":t<Z&&(e.css("transform","translateX( "+t+"px )"),tt[r][0].position=t,tt[r][0].visible=!0,t=t+tt[r][0].width+H.scroll_spacing);break;case"right":t>0&&(t-=tt[r][0].width,e.css("transform","translateX( "+t+"px )"),tt[r][0].position=t,tt[r][0].visible=!0,t-=H.scroll_spacing);break;case"up":t<$&&(e.css("transform","translateY( "+t+"px )"),tt[r][0].position=t,tt[r][0].visible=!0,t=t+tt[r][0].height+H.scroll_spacing);break;case"down":t>0&&(e.css("transform","translateY( "+t+"px )"),e.stop(!0,!0).css("top",t+"px"),tt[r][0].position=t,tt[r][0].visible=!0,t-=H.scroll_spacing);break}}function v(){y()}function k(){clearInterval(it)}function m(){switch(N.find(".mtphr-dnt-tick").each((function(){tt.push(t(this)),t(this).imagesLoaded((function(){F()}))})),F(),N.find(".mtphr-dnt-tick").show(),H.rotate_type){case"fade":X(N,tt,parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_left":D(N,tt,parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_right":L(N,tt,parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_down":j(N,tt,parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_up":M(N,tt,parseInt(100*H.rotate_speed),H.rotate_ease);break}w(0),H.auto_rotate&&v(),N.hover((function(){H.auto_rotate&&H.rotate_pause&&!J.running&&k()}),(function(){H.auto_rotate&&H.rotate_pause&&!J.running&&!J.paused&&v()}))}function y(){k(),it=setInterval((function(){var t=parseInt(J.current_tick+1);t===J.tick_count&&(t=0),b(t)}),parseInt(1e3*H.rotate_delay))}function b(e){J.current_tick!==e&&(H.auto_rotate&&k(),J.next_tick=e,H.before_change.call(K,N),K.trigger("mtphr_dnt_before_change_single",[J,tt]),t("body").trigger("mtphr_dnt_before_change",[K,J,tt]),J.running=1,I(e),x(e),J.previous_tick=J.current_tick,J.current_tick=e,st=setTimeout((function(){H.after_change.call(K,N),K.trigger("mtphr_dnt_after_change_single",[J,tt]),t("body").trigger("mtphr_dnt_after_change",[K,J,tt]),nt=H.rotate_type,J.reverse=0,J.running=0,H.auto_rotate&&!J.paused&&y()}),parseInt(100*H.rotate_speed)))}function w(t){U&&(U.children("a").removeClass("active"),U.children('a[href="'+t+'"]').addClass("active"))}function x(e){switch(w(e),nt){case"fade":Y(N,t(tt[e]),t(tt[J.current_tick]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_left":W(N,t(tt[e]),t(tt[J.current_tick]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_right":O(N,t(tt[e]),t(tt[J.current_tick]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_down":E(N,t(tt[e]),t(tt[J.current_tick]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_up":Q(N,t(tt[e]),t(tt[J.current_tick]),parseInt(100*H.rotate_speed),H.rotate_ease);break}}function I(e){switch(nt){case"fade":C(N,t(tt[J.current_tick]),t(tt[e]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_left":z(N,t(tt[J.current_tick]),t(tt[e]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_right":T(N,t(tt[J.current_tick]),t(tt[e]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_down":A(N,t(tt[J.current_tick]),t(tt[e]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_up":R(N,t(tt[J.current_tick]),t(tt[e]),parseInt(100*H.rotate_speed),H.rotate_ease);break}}function F(){for(var e=0;e<J.tick_count;e++)t(tt[e]).width(Z+"px"),J.current_tick!==e&&t(tt[e]).css({left:parseFloat(Z+H.offset)+"px"});var r=t(tt[J.current_tick]).height();N.stop().css("height",r+"px")}function X(t,e){var r=e[0],i=r.height();t.css("height",i+"px"),r.css({opacity:1,left:"auto"})}function Y(t,e,r,i,n){e.css({opacity:0,left:"auto"}),e.stop().animate({opacity:1},i,n);var s=e.height();t.stop().animate({height:s+"px"},i,n)}function C(e,r,i,n,s){r.stop().animate({opacity:0},n,s,(function(){t(this).css({left:parseFloat(Z+H.offset)+"px"}),r.remove(),e.append(r)}))}function D(t,e){var r=e[0],i=r.height();t.css("height",i+"px"),r.css({opacity:1,left:0})}function W(t,e,r,i,n){var s=e.height();e.css({opacity:1,left:parseFloat(Z+H.offset)+"px"}),t.stop().animate({height:s+"px"},i,n,(function(){})),e.stop().animate({left:"0"},i,n,(function(){}))}function z(t,e,r,i,n){e.stop().animate({left:"-"+parseFloat(Z+H.offset)+"px"},i,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function L(t,e){var r=e[0],i=r.height();t.css("height",i+"px"),r.css({opacity:1,left:0})}function O(t,e,r,i,n){var s=e.height();e.css({opacity:1,left:"-"+parseFloat(Z+H.offset)+"px"}),t.stop().animate({height:s+"px"},i,n,(function(){})),e.stop().animate({left:"0"},i,n)}function T(t,e,r,i,n){e.stop().animate({left:parseFloat(Z+H.offset)+"px"},i,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function j(t,e){var r=e[0],i=r.height();t.css("height",i+"px"),r.css({opacity:1,top:0,left:"auto"})}function E(t,e,r,i,n){var s=e.height();e.css({opacity:1,top:"-"+parseFloat(s+H.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},i,n),e.stop().animate({top:"0"},i,n)}function A(t,e,r,i,n){var s=r.height();e.stop().animate({top:parseFloat(s+H.offset)+"px"},i,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function M(t,e){var r=e[0],i=r.height();t.css({height:i+"px",left:"auto"}),r.css({opacity:1,top:0})}function Q(t,e,r,i,n){var s=e.height();e.css({opacity:1,top:parseFloat(r.height()+H.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},i,n),e.stop().animate({top:"0"},i,n)}function R(t,e,r,i,n){var s=e.height();e.stop().animate({top:"-"+parseFloat(s+H.offset)+"px"},i,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function q(){if(J.running)return!1;var t=parseInt(J.current_tick+1);t===J.tick_count&&(t=0),b(t)}function B(){if(J.running)return!1;var t=parseInt(J.current_tick-1);t<0&&(t=J.tick_count-1),H.nav_reverse&&("slide_left"===H.rotate_type?nt="slide_right":"slide_right"===H.rotate_type?nt="slide_left":"slide_down"===H.rotate_type?nt="slide_up":"slide_up"===H.rotate_type&&(nt="slide_down"),J.reverse=1),b(t)}function G(t){t?(J.paused=!1,V.removeClass("paused"),"scroll"===H.type?a():v()):(J.paused=!0,V.addClass("paused"),"scroll"===H.type?s():k()),K.trigger("mtphr_dnt_play_pause",[J,tt])}var H={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(){}},J={id:H.id,tick_count:0,previous_tick:0,current_tick:0,next_tick:0,reverse:0,running:0,paused:0};e&&t.extend(H,e);var K=t(this),N=K.find(".mtphr-dnt-tick-contents"),P=K.find(".mtphr-dnt-nav-prev"),S=K.find(".mtphr-dnt-nav-next"),U=K.find(".mtphr-dnt-control-links"),V=K.find(".mtphr-dnt-play-pause"),Z=N.outerWidth(!0),$=0,tt=[],et,rt=!0,it,nt=H.rotate_type,st;if(N.data("ditty:vars",J),P&&"rotate"===H.type&&(P.bind("click",(function(t){t.preventDefault(),B()})),S.bind("click",(function(t){t.preventDefault(),q()}))),U&&"rotate"===H.type&&U.children("a").bind("click",(function(e){e.preventDefault();var r=parseInt(t(this).attr("href"));if(J.running)return!1;if(r===J.current_tick)return!1;var i=r<J.current_tick?1:0;H.nav_reverse&&i&&("slide_left"===H.rotate_type?nt="slide_right":"slide_right"===H.rotate_type?nt="slide_left":"slide_down"===H.rotate_type?nt="slide_up":"slide_up"===H.rotate_type&&(nt="slide_down"),J.reverse=1),b(r)})),V.bind("click",(function(t){t.preventDefault(),G(J.paused)})),"rotate"!==H.type||H.disable_touchswipe||N.swipe({triggerOnTouchEnd:!0,swipeLeft:function(){if(J.running)return!1;var t=parseInt(J.current_tick+1);t===J.tick_count&&(t=0),"slide_left"!==H.rotate_type&&"slide_right"!==H.rotate_type||(nt="slide_left"),b(t)},swipeRight:function(){if(J.running)return!1;var t=parseInt(J.current_tick-1);t<0&&(t=J.tick_count-1),"slide_left"!==H.rotate_type&&"slide_right"!==H.rotate_type||(nt="slide_right"),H.nav_reverse&&("slide_down"===H.rotate_type?nt="slide_up":"slide_up"===H.rotate_type&&(nt="slide_down"),J.reverse=1),b(t)}}),K.on("mtphr_dnt_next",(function(){q()})),K.on("mtphr_dnt_prev",(function(){B()})),K.on("mtphr_dnt_goto",(function(t,e){b(parseInt(e))})),K.on("mtphr_dnt_pause",(function(){G()})),K.on("mtphr_dnt_play",(function(){G(!0)})),t(window).resize((function(){N.outerWidth()!==Z&&(Z=N.outerWidth(!0),"scroll"===H.type?("up"===H.scroll_direction||"down"===H.scroll_direction)&&rt?g():h():"rotate"===H.type&&F())})),K.on("mtphr_dnt_resize_single",(function(){"scroll"===H.type?h():"rotate"===H.type&&F()})),t("body").on("mtphr_dnt_resize",(function(t,e){e&&e.indexOf(H.id)>=0&&("scroll"===H.type?h():"rotate"===H.type&&F())})),K.on("mtphr_dnt_replace_ticks",(function(e,i,n){clearInterval(et),K.find(".mtphr-dnt-tick").remove(),i.each((function(){N.append(t(this))})),setTimeout((function(){r()}),n)})),0===K.width())var at=setInterval((function(){K.width()>10&&(clearInterval(at),Z=N.outerWidth(!0),r())}),100);else r()}))}};t.fn.ditty_news_ticker=function(r){return e[r]?e[r].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof r&&r?void t.error("Method "+r+" does not exist in ditty_news_ticker"):e.init.apply(this,arguments)}}(jQuery);
|
inc/static/sass/style.scss
CHANGED
@@ -63,6 +63,10 @@
|
|
63 |
.mtphr-dnt-scroll-left,
|
64 |
.mtphr-dnt-scroll-right {
|
65 |
.mtphr-dnt-tick {
|
|
|
|
|
|
|
|
|
66 |
white-space: nowrap;
|
67 |
}
|
68 |
}
|
63 |
.mtphr-dnt-scroll-left,
|
64 |
.mtphr-dnt-scroll-right {
|
65 |
.mtphr-dnt-tick {
|
66 |
+
position: absolute;
|
67 |
+
top: 0;
|
68 |
+
left: 0;
|
69 |
+
display: block;
|
70 |
white-space: nowrap;
|
71 |
}
|
72 |
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: metaphorcreations
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FUZKZGAJSBAE6
|
4 |
Tags: ticker, news, news ticker, rotator, data rotator, lists, data
|
5 |
Requires at least: 4.5
|
6 |
-
Tested up to: 5.
|
7 |
Stable tag: /trunk/
|
8 |
License: GPL2
|
9 |
|
@@ -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.19 =
|
76 |
* Added aria-label to previous and next nav elements
|
77 |
|
@@ -543,4 +546,4 @@ The most common cause for an unresponsive ticker (when using scroll or rotate mo
|
|
543 |
|
544 |
== Upgrade Notice ==
|
545 |
|
546 |
-
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FUZKZGAJSBAE6
|
4 |
Tags: ticker, news, news ticker, rotator, data rotator, lists, data
|
5 |
Requires at least: 4.5
|
6 |
+
Tested up to: 5.6
|
7 |
Stable tag: /trunk/
|
8 |
License: GPL2
|
9 |
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 2.3 =
|
76 |
+
* Reworked scroll functionality for better performance
|
77 |
+
|
78 |
= 2.2.19 =
|
79 |
* Added aria-label to previous and next nav elements
|
80 |
|
546 |
|
547 |
== Upgrade Notice ==
|
548 |
|
549 |
+
Reworked scroll functionality for better performance
|