!function($){var t={init:function(t){return this.each((function(){var e={id:"",type:"scroll",scroll_direction:"left",scroll_speed:10,scroll_pause:0,scroll_spacing:40,scroll_units:10,scroll_init:0,scroll_init_delay:2,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(){}},i={id:e.id,tick_count:0,previous_tick:0,current_tick:0,next_tick:0,reverse:0,running:0,paused:0};t&&$.extend(e,t);var n,r,s,a=$(this),o=a.find(".mtphr-dnt-tick-contents"),c=a.find(".mtphr-dnt-nav-prev"),p=a.find(".mtphr-dnt-nav-next"),l=a.find(".mtphr-dnt-control-links"),_=a.find(".mtphr-dnt-play-pause"),u=o.outerWidth(!0),f=0,d=[],h=!0,g=e.rotate_type,v=!0,m=.13;function k(){i.tick_count=o.find(".mtphr-dnt-tick").length,i.tick_count>0&&("scroll"===e.type?function(){var t=o.find(".mtphr-dnt-tick:first");if(t.attr("style")){var n=t.attr("style").split("width:");h=!(n.length>1)}d=[],o.find("img").length?o.imagesLoaded((function(){y(),o.find(".mtphr-dnt-tick").each((function(){$(this).show();var t=[{headline:$(this)}];d.push(t)})),D(),x()})):(y(),o.find(".mtphr-dnt-tick").each((function(){$(this).show();var t=[{headline:$(this)}];d.push(t)})),D(),x());o.on({mouseenter:function(){e.scroll_pause&&w()},mouseleave:function(){e.scroll_pause&&!i.paused&&b()}}),o.find("a").on("click",(function(){e.scroll_pause&&!i.paused&&b()}))}():"rotate"===e.type&&function(){switch(o.find(".mtphr-dnt-tick").each((function(){d.push($(this)),$(this).imagesLoaded((function(){O()}))})),O(),o.find(".mtphr-dnt-tick").show(),e.rotate_type){case"fade":!function(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:"auto"})}(o,d,parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_left":!function(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:0})}(o,d,parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_right":!function(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,left:0})}(o,d,parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_down":!function(t,e){var i=e[0],n=i.height();t.css("height",n+"px"),i.css({opacity:1,top:0,left:"auto"})}(o,d,parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_up":!function(t,e){var i=e[0],n=i.height();t.css({height:n+"px",left:"auto"}),i.css({opacity:1,top:0})}(o,d,parseInt(100*e.rotate_speed),e.rotate_ease)}j(0),e.auto_rotate&&E();o.on({mouseenter:function(){e.auto_rotate&&e.rotate_pause&&!i.running&&L()},mouseleave:function(){e.auto_rotate&&e.rotate_pause&&!i.running&&!i.paused&&E()}}),o.find("a").on("click",(function(){e.auto_rotate&&e.rotate_pause&&!i.running&&!i.paused&&E()}))}()),e.after_load.call(a,o),a.trigger("mtphr_dnt_after_load_single",[i,d]),$("body").trigger("mtphr_dnt_after_load",[a,i,d])}function y(){o.find(".mtphr-dnt-tick").each((function(){$(this).height()>f&&(f=$(this).height()),"up"!==e.scroll_direction&&"down"!==e.scroll_direction||$(this).css("height","auto")})),o.css("height",f+"px")}function w(){clearTimeout(s),cancelAnimationFrame(n)}function b(){x()}function x(){clearTimeout(s),cancelAnimationFrame(n),n=requestAnimationFrame((function t(){for(var r=0;ru+e.offset?i=X(t):i>e.scroll_spacing&&W(t),i}function T(t){var i=parseFloat(d[t][0].position-e.scroll_speed*m);return i<-(d[t][0].headline.height()+e.offset)?i=X(t):if+e.offset?i=X(t):i>e.scroll_spacing&&W(t),i}function X(t){return i.tick_count>1&&(d[t][0].visible=!1),i.tick_count===t+1&&(a.trigger("mtphr_dnt_scroll_complete",[i,d]),$("body").trigger("mtphr_dnt_scroll_complete",[a,i,d])),"reset"}function Y(t){!1===d[t][0].visible&&(i.previous_tick=parseInt(t-1),i.previous_tick<0&&(i.previous_tick=parseInt(i.tick_count-1)),i.current_tick=t,i.next_tick=parseInt(t+1),i.next_tick>=i.tick_count&&(i.next_tick=0))}function W(t){t===i.tick_count-1?e.scroll_loop&&(Y(0),d[0][0].visible=!0):(Y(parseInt(t+1)),d[t+1][0].visible=!0)}function C(){for(var t=0;t0&&(t-=d[r][0].width,n.css("transform","translateX( "+t+"px )"),d[r][0].position=t,d[r][0].visible=!0,t-=e.scroll_spacing);break;case"up":t0&&(n.css("transform","translateY( "+t+"px )"),n.stop(!0,!0).css("top",t+"px"),d[r][0].position=t,d[r][0].visible=!0,t-=e.scroll_spacing)}}function E(){q()}function L(){clearInterval(r)}function q(){L(),r=setInterval((function(){var t=parseInt(i.current_tick+1);t===i.tick_count&&(t=0),z(t)}),parseInt(1e3*e.rotate_delay))}function z(t){i.current_tick!==t&&(e.auto_rotate&&L(),i.next_tick=t,e.before_change.call(a,o),a.trigger("mtphr_dnt_before_change_single",[i,d]),$("body").trigger("mtphr_dnt_before_change",[a,i,d]),i.running=1,function(t){switch(g){case"fade":!function(t,i,n,r,s){i.stop().animate({opacity:0},r,s,(function(){$(this).css({left:parseFloat(u+e.offset)+"px"}),i.remove(),t.append(i)}))}(o,$(d[i.current_tick]),$(d[t]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_left":!function(t,i,n,r,s){i.stop().animate({left:"-"+parseFloat(u+e.offset)+"px"},r,s,(function(){i.css({opacity:0}),i.remove(),t.append(i)}))}(o,$(d[i.current_tick]),$(d[t]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_right":!function(t,i,n,r,s){i.stop().animate({left:parseFloat(u+e.offset)+"px"},r,s,(function(){i.css({opacity:0}),i.remove(),t.append(i)}))}(o,$(d[i.current_tick]),$(d[t]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_down":!function(t,i,n,r,s){var a=n.height();i.stop().animate({top:parseFloat(a+e.offset)+"px"},r,s,(function(){i.css({opacity:0}),i.remove(),t.append(i)}))}(o,$(d[i.current_tick]),$(d[t]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_up":!function(t,i,n,r,s){var a=i.height();i.stop().animate({top:"-"+parseFloat(a+e.offset)+"px"},r,s,(function(){i.css({opacity:0}),i.remove(),t.append(i)}))}(o,$(d[i.current_tick]),$(d[t]),parseInt(100*e.rotate_speed),e.rotate_ease)}}(t),function(t){switch(j(t),g){case"fade":!function(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)}(o,$(d[t]),$(d[i.current_tick]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_left":!function(t,i,n,r,s){var a=i.height();i.css({opacity:1,left:parseFloat(u+e.offset)+"px"}),t.stop().animate({height:a+"px"},r,s,(function(){})),i.stop().animate({left:"0"},r,s,(function(){}))}(o,$(d[t]),$(d[i.current_tick]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_right":!function(t,i,n,r,s){var a=i.height();i.css({opacity:1,left:"-"+parseFloat(u+e.offset)+"px"}),t.stop().animate({height:a+"px"},r,s,(function(){})),i.stop().animate({left:"0"},r,s)}(o,$(d[t]),$(d[i.current_tick]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_down":!function(t,i,n,r,s){var a=i.height();i.css({opacity:1,top:"-"+parseFloat(a+e.offset)+"px",left:"auto"}),t.stop().animate({height:a+"px"},r,s),i.stop().animate({top:"0"},r,s)}(o,$(d[t]),$(d[i.current_tick]),parseInt(100*e.rotate_speed),e.rotate_ease);break;case"slide_up":!function(t,i,n,r,s){var a=i.height();i.css({opacity:1,top:parseFloat(n.height()+e.offset)+"px",left:"auto"}),t.stop().animate({height:a+"px"},r,s),i.stop().animate({top:"0"},r,s)}(o,$(d[t]),$(d[i.current_tick]),parseInt(100*e.rotate_speed),e.rotate_ease)}}(t),i.previous_tick=i.current_tick,i.current_tick=t,setTimeout((function(){e.after_change.call(a,o),a.trigger("mtphr_dnt_after_change_single",[i,d]),$("body").trigger("mtphr_dnt_after_change",[a,i,d]),g=e.rotate_type,i.reverse=0,i.running=0,e.auto_rotate&&!i.paused&&q()}),parseInt(100*e.rotate_speed)))}function j(t){l&&(l.children("a").removeClass("active"),l.children('a[href="'+t+'"]').addClass("active"))}function O(){for(var t=0;t=0&&("scroll"===e.type?C():"rotate"===e.type&&O())})),a.on("mtphr_dnt_replace_ticks",(function(t,e,i){clearTimeout(s),cancelAnimationFrame(n),a.find(".mtphr-dnt-tick").remove(),e.each((function(){o.append($(this))})),setTimeout((function(){k()}),i)})),0===a.width()){var G=!0;setTimeout((function t(){a.width()>10&&(G=!1,u=o.outerWidth(!0),k()),G&&setTimeout(t,100)}),100)}else k()}))}};$.fn.ditty_news_ticker=function(e){if(t[e])return t[e].apply(this,Array.prototype.slice.call(arguments,1));if("object"!=typeof e&&e)throw new Error("Method "+e+" does not exist in ditty_news_ticker");return t.init.apply(this,arguments)}}(jQuery);