text: // Modern News Ticker
  // Copyright (c) CreativeTier
  // contact@CreativeTier.com
  (function(e){var t={effect:"scroll",linksEnabled:true,pauseOnHover:true,autoplay:true,feedType:"none",feedCount:5,linkTarget:"_blank",refresh:"10:00"};var n={scroll:{scrollType:"continuous",scrollStart:"inside",scrollInterval:20,transitionTime:500},fade:{displayTime:4e3,transitionTime:300},type:{typeInterval:10,displayTime:4e3,transitionTime:300},slide:{slideDistance:100,displayTime:4e3,transitionTime:350}};var r={"rss-atom":{feedUrl:"",loadType:"direct"},twitter:{twitterName:"",twitterLoadingFile:"modern-ticker/php/twitter.php"}};var i={init:function(i){var s=t;e.extend(s,{feedType:i.feedType});e.extend(s,r[s.feedType]);e.extend(s,{effect:i.effect});e.extend(s,n[s.effect]);e.extend(s,i);return this.each(function(){function T(){var e=p.width();if(d.length)e-=d.outerWidth(true);if(y.length)e-=y.outerWidth(true);v.css("width",e);n=e}function N(){t=0;m.children().each(function(){t+=e(this).outerWidth(true)+1});m.css("width",t)}function C(){B();m.addClass("mt-hide");v.addClass("mt-preloader");m.children().remove();m.css("margin-left",0);g.css("opacity","1").removeClass("mt-hide");m.append(g);switch(s.feedType){case"rss-atom":var t={url:s.feedUrl+"?"+Math.random(),type:"GET",dataType:"xml",success:function(t){var n=e(t).find("item");var r;if(s.feedCount==0||n.length<=s.feedCount)r=n.length;else r=s.feedCount;for(var i=0;i<r;i++){var o;if(s.linksEnabled)o="<li><a href='"+e(n[i]).find("link").text()+"' target='"+s.linkTarget+"'>"+e(n[i]).find("title").text()+"</a></li>";else o="<li><a>"+e(n[i]).find("title").text()+"</a></li>";m.append(o)}k()}};var n=s.feedCount==0?-1:s.feedCount;var r={url:"https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num="+n+"&q="+s.feedUrl+"?"+Math.random(),type:"GET",dataType:"jsonp",success:function(e){var t=e.responseData.feed.entries;var n;if(s.feedCount==0||t.length<=s.feedCount)n=t.length;else n=s.feedCount;for(var r=0;r<n;r++){var i;if(s.linksEnabled)i="<li><a href='"+t[r].link+"' target='"+s.linkTarget+"'>"+t[r].title+"</a></li>";else i="<li><a>"+t[r].title+"</a></li>";m.append(i)}k()}};var i=s.loadType=="process"?r:t;e.ajax(i);break;case"twitter":e.get(s.twitterLoadingFile,{name:s.twitterName,count:s.feedCount},function(t){t=e.parseJSON(t);for(var n=0;n<t.length;n++){var r;if(s.linksEnabled)r="<li><a href='http://twitter.com/#!/"+t[n].user.id_str+"/status/"+t[n].id_str+"' target='"+s.linkTarget+"'>"+t[n].text+"</a></li>";else r="<li><a>"+t[n].text+"</a></li>";m.append(r)}k()});break}}function k(){v.removeClass("mt-preloader");m.removeClass("mt-hide");A()}function L(){if(s.feedType=="rss-atom"||s.feedType=="twitter"){clearTimeout(c);l=false;C()}}function A(){N();if(s.effect!="scroll")m.children("li:not(:first)").addClass("mt-hide");if(f){f=false;if(s.autoplay){P();if(y.length)I()}}else j();_("first");if(s.refresh)c=setTimeout(L,O(s.refresh));l=true}function O(e){var t;if(typeof e=="number")t=e;else{var n=e.split(":");n.reverse();t=parseFloat(n[0]);if(n[1])t+=parseFloat(n[1])*60;if(n[2])t+=parseFloat(n[2])*3600}return t*1e3}function M(e){if(l)_(e.data.type)}function _(r){if(!u){u=true;B();switch(r){case"first":switch(s.effect){case"scroll":if(s.scrollStart=="outside")m.css("margin-left",n);j();break;case"fade":m.children(":first").css({opacity:0}).animate({opacity:1},s.transitionTime,function(){j()});break;case"type":F(m.children(":first").css({opacity:0}).animate({opacity:1},s.transitionTime).children("a"));break;case"slide":m.children(":first").css({opacity:0,"margin-left":s.slideDistance}).animate({opacity:1,"margin-left":0},s.transitionTime,function(){j()});break}u=false;break;case"prev":switch(s.effect){case"scroll":if(s.scrollType=="discontinuous"){var i=D();var o=S.length-1;var a;if(i==-1||i==0){m.animate({"margin-left":n},s.transitionTime,function(){m.css("margin-left",-t);m.animate({"margin-left":-S[o]},s.transitionTime,function(){u=false})})}else{a=-S[i-1];m.animate({"margin-left":a},s.transitionTime,function(){u=false})}}else{m.css({"margin-left":-e(m.children(":last")).outerWidth()}).children(":last").prependTo(m);m.animate({"margin-left":0},s.transitionTime,function(){u=false})}if(y.length)b.mouseleave(function(){j()});break;case"fade":m.children(":first").animate({opacity:0},s.transitionTime,function(){e(this).addClass("mt-hide");m.children(":last").prependTo(m).removeClass("mt-hide").css({opacity:0}).animate({opacity:1},s.transitionTime,function(){j()});u=false});break;case"type":m.children(":first").animate({opacity:0},s.transitionTime,function(){e(this).addClass("mt-hide");F(m.children(":last").prependTo(m).removeClass("mt-hide").css({opacity:0}).animate({opacity:1},s.transitionTime).children("a"));u=false});break;case"slide":m.children(":first").animate({opacity:0},s.transitionTime,function(){e(this).addClass("mt-hide");m.children(":last").prependTo(m).removeClass("mt-hide").css({opacity:0,"margin-left":s.slideDistance}).animate({opacity:1,"margin-left":0},s.transitionTime,function(){j()});u=false});break}break;case"next":switch(s.effect){case"scroll":if(s.scrollType=="discontinuous"){var i=D();var o=S.length-1;var a;if(i==o){m.animate({"margin-left":-t},s.transitionTime,function(){m.css("margin-left",n);m.animate({"margin-left":0},s.transitionTime,function(){u=false})})}else{if(i==-1)a=0;else a=-S[i+1];m.animate({"margin-left":a},s.transitionTime,function(){u=false})}}else{m.animate({"margin-left":-e(m.children(":first")).outerWidth()},s.transitionTime,function(){m.css("margin-left",0).children(":first").appendTo(m);u=false})}if(y.length)w.mouseleave(function(){j()});break;case"fade":m.children(":first").animate({opacity:0},s.transitionTime,function(){e(this).addClass("mt-hide").appendTo(m);m.children(":first").removeClass("mt-hide").css({opacity:0}).animate({opacity:1},s.transitionTime,function(){j()});u=false});break;case"type":m.children(":first").animate({opacity:0},s.transitionTime,function(){e(this).addClass("mt-hide").appendTo(m);F(m.children(":first").removeClass("mt-hide").css({opacity:0}).animate({opacity:1},s.transitionTime).children("a"));u=false});break;case"slide":m.children(":first").animate({opacity:0},s.transitionTime,function(){e(this).addClass("mt-hide").appendTo(m);m.children(":first").removeClass("mt-hide").css({opacity:0,"margin-left":s.slideDistance}).animate({opacity:1,"margin-left":0},s.transitionTime,function(){j()});u=false});break}break}}}function D(){var e=parseFloat(m.css("margin-left"));var t=S.length;if(e>0){return-1}else{e=Math.abs(e);for(var n=0;n<t-1;n++){if(e>=S[n]&&e<S[n+1])return n}return t-1}}function P(){i=true;if(s.effect=="scroll"){r=setInterval(function(){if(!u){var r=parseFloat(m.css("margin-left"));m.css("margin-left",r-1);if(s.scrollType=="discontinuous"){if(r<0&&Math.abs(r)>t)m.css("margin-left",n)}else{if(r<0&&Math.abs(r)>e(m.children("li")[0]).outerWidth())m.css("margin-left",0).children(":first").appendTo(m)}}},s.scrollInterval)}else{r=setInterval(function(){_("next")},s.displayTime)}}function H(){i=false;clearInterval(r)}function B(){if(i){o=true;H()}}function j(){if(o&&!a){P();o=false}}function F(e){var t=e.html().split("");var n=0;e.html("_");var r=setInterval(function(){var i=e.html().split("_")[0]+t[n++];if(n!=t.length){i+="_"}e.html(i);if(n==t.length){clearInterval(r);j()}},s.typeInterval)}function I(){E.addClass("mt-pause")}function q(){E.removeClass("mt-pause")}function R(){return false}var t;var n;var r;var i=false;var o=false;var u=false;var a=false;var f=true;var l=false;var c;var h=e(this);var p=h.children(".mt-body");var d=p.children(".mt-label");var v=p.children(".mt-news");var m=v.children("ul");var g=m.children("li");var y=p.children(".mt-controls");var b=y.children(".mt-prev");var w=y.children(".mt-next");var E=y.children(".mt-play");if(s.effect=="scroll")h.addClass("mt-scroll");if(d.length)v.css("left",d.outerWidth(true));T();v.css("height",h.height()-2*parseInt(p.css("margin")));e(window).resize(T);if(s.scrollType=="discontinuous"){var S=[];var x=0;m.children().each(function(){S.push(x);x+=e(this).outerWidth()})}if(!s.linksEnabled)m.find("a").removeAttr("href target");if(s.pauseOnHover)v.hover(function(){if(l){B();a=true}},function(){if(l){a=false;j()}});if(y.length){b.mousedown(R).bind("click",{type:"prev"},M);w.mousedown(R).bind("click",{type:"next"},M);E.mousedown(R).click(function(){if(l){if(i){H();q()}else{P();I()}}})}if(s.feedType=="rss-atom"||s.feedType=="twitter")C();else A();h.data("pause",B);h.data("resume",j);h.data("refresh",L)})},pause:function(){return this.each(function(){e(this).data("pause")()})},resume:function(){return this.each(function(){e(this).data("resume")()})},refresh:function(){return this.each(function(){e(this).data("refresh")()})}};e.fn.modernTicker=function(t){if(i[t]){return i[t].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof t==="object"||!t){return i.init.apply(this,arguments)}else{e.error("Method "+t+" does not exist on jQuery.modernTicker")}}})(jQuery)