Free javascript Hosting


jquery-webticker-mod-min.js

Uploaded on Oct 29 2021 05:59 by webhappen

!function(i){var t=function(){var i=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(""===i.transition)return!0;for(;t.length;)if(t.pop()+"Transition"in i)return!0;return!1}();function e(t){var e=0;return t.children("li").each(function(){e+=i(this).outerWidth(!0)}),e}function s(t){return Math.max.apply(Math,t.children().map(function(){return i(this).width()}).get())}function n(i){var t=i.data("settings")||{direction:"left",speed:50},e=i.children().first(),s=Math.abs(-i.css(t.direction).replace("px","").replace("auto","0")-e.outerWidth(!0)),n=1e3*s/t.speed,r={};return r[t.direction]=i.css(t.direction).replace("px","").replace("auto","0")-s,{css:r,time:n}}function r(i){var t=i.data("settings")||{direction:"left"};i.css("transition-duration","0s").css(t.direction,"0");var e=i.children().first();e.hasClass("webticker-init")?e.remove():i.children().last().after(e)}function a(i,t){var e=i.data("settings")||{direction:"left"};void 0===t&&(t=!1),t&&r(i);var s=n(i);i.animate(s.css,s.time,"linear",function(){i.css(e.direction,"0"),a(i,!0)})}function c(i,t){void 0===t&&(t=!1),t&&r(i);var e=n(i),s=e.time/1e3;s+="s",i.css(e.css).css("transition-duration",s)}function l(t,e,s){var n=[];i.get(t,function(t){i(t).find("item").each(function(){var t=i(this),e=t.find("title").text(),s=t.find("link").text();n+='<li><a href="'+s+'"">'+e+"</a></li>"}),s.webTicker("update",n,e)})}function o(t,n){if(t.children("li").length<1)return window.console,!1;var r=t.data("settings");r.duplicateLoops=r.duplicateLoops||0,t.width("auto");var a=0;t.children("li").each(function(){a+=i(this).outerWidth(!0)});var c,l=t.find("li:first").height(),o=!0;if(r.duplicate){c=s(t);for(var d=0;a-c<t.parent().width()||1===t.children().length||d<r.duplicateLoops;){o&&(t.empty(),o=!1);var h=t.children().clone();t.append(h),a=0,a=e(t),c=s(t),d++}r.duplicateLoops=d}else{var f=t.parent().width()-a;f+=t.find("li:first").width(),t.find(".ticker-spacer").length>0?t.find(".ticker-spacer").width(f):t.append('<li class="ticker-spacer" style="float: '+r.direction+";width:"+f+"px;height:"+l+'px;"></li>')}r.startEmpty&&n&&t.prepend('<li class="webticker-init" style="float: '+r.direction+";width:"+t.parent().width()+"px;height:"+l+'px;"></li>'),a=0,a=e(t),t.width(a+200);var p=0;for(p=e(t);p>=t.width();)t.width(t.width()+200),p=0,p=e(t);return!0}var d={init:function(e){return e=jQuery.extend({speed:50,direction:"left",moving:!0,startEmpty:!0,duplicate:!1,rssurl:!1,hoverpause:!0,rssfrequency:0,updatetype:"reset",transition:"linear",height:"30px",maskleft:"",maskright:"",maskwidth:0},e),this.each(function(){jQuery(this).data("settings",e);var s=jQuery(this);window.stripChildren||(window.stripChildren=s.children());var n=s.wrap('<div class="mask"></div>');n.after('<span class="tickeroverlay-left">&nbsp;</span><span class="tickeroverlay-right">&nbsp;</span>');var r,d=s.parent().wrap('<div class="tickercontainer"></div>');if(i(window).resize(function(){clearTimeout(r),r=setTimeout(function(){console.log("window was resized"),o(s,!1)},500)}),s.children("li").css("white-space","nowrap"),s.children("li").css("float",e.direction),s.children("li").css("padding","0 7px"),s.children("li").css("line-height",e.height),n.css("position","relative"),n.css("overflow","hidden"),s.closest(".tickercontainer").css("height",e.height),s.closest(".tickercontainer").css("overflow","hidden"),s.css("float",e.direction),s.css("position","relative"),s.css("font","bold 10px Verdana"),s.css("list-style-type","none"),s.css("margin","0"),s.css("padding","0"),""!==e.maskleft&&""!==e.maskright){var h='url("'+e.maskleft+'")';d.find(".tickeroverlay-left").css("background-image",h),d.find(".tickeroverlay-left").css("display","block"),d.find(".tickeroverlay-left").css("pointer-events","none"),d.find(".tickeroverlay-left").css("position","absolute"),d.find(".tickeroverlay-left").css("z-index","30"),d.find(".tickeroverlay-left").css("height",e.height),d.find(".tickeroverlay-left").css("width",e.maskwidth),d.find(".tickeroverlay-left").css("top","0"),d.find(".tickeroverlay-left").css("left","-2px"),h='url("'+e.maskright+'")',d.find(".tickeroverlay-right").css("background-image",h),d.find(".tickeroverlay-right").css("display","block"),d.find(".tickeroverlay-right").css("pointer-events","none"),d.find(".tickeroverlay-right").css("position","absolute"),d.find(".tickeroverlay-right").css("z-index","30"),d.find(".tickeroverlay-right").css("height",e.height),d.find(".tickeroverlay-right").css("width",e.maskwidth),d.find(".tickeroverlay-right").css("top","0"),d.find(".tickeroverlay-right").css("right","-2px")}else d.find(".tickeroverlay-left").css("display","none"),d.find(".tickeroverlay-right").css("display","none");s.children("li").last().addClass("last");var f=o(s,!0);e.rssurl&&(l(e.rssurl,e.type,s),e.rssfrequency>0&&window.setInterval(function(){l(e.rssurl,e.type,s)},1e3*e.rssfrequency*60)),t?(s.css("transition-timing-function",e.transition),s.css("transition-duration","0s").css(e.direction,"0"),f&&c(s,!1),s.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend",function(t){if(!s.is(t.target))return!1;c(i(this),!0)})):f&&a(i(this)),e.hoverpause&&s.hover(function(){if(t){var s=i(this).css(e.direction);i(this).css("transition-duration","0s").css(e.direction,s)}else jQuery(this).stop()},function(){jQuery(this).data("settings").moving&&(t?c(i(this),!1):a(s))})})},stop:function(){var e=i(this).data("settings");if(e.moving)return e.moving=!1,this.each(function(){if(t){var s=i(this).css(e.direction);i(this).css("transition-duration","0s").css(e.direction,s)}else i(this).stop()})},cont:function(){var e=i(this).data("settings");if(!e.moving)return e.moving=!0,this.each(function(){t?c(i(this),!1):a(i(this))})},transition:function(e){var s=i(this);t&&s.css("transition-timing-function",e)},update:function(t,s,n,r){s=s||"reset",void 0===n&&(n=!0),void 0===r&&(r=!1),"string"==typeof t&&(t=i(t));var a=i(this);a.webTicker("stop");var c=i(this).data("settings");if("reset"===s)a.html(t),o(a,!0);else if("swap"===s){var l,d,h;if(window.console,a.children("li").length<1)a.html(t),a.css(c.direction,"0"),o(a,!0);else if(!0===c.duplicate){a.children("li").addClass("old");for(var f=t.length-1;f>=0;f--)l=i(t[f]).data("update"),a.find('[data-update="'+l+'"]').length<1?n&&(0===a.find(".ticker-spacer:first-child").length&&a.find(".ticker-spacer").length>0?a.children("li.ticker-spacer").before(t[f]):(d=i(t[f]),f===t.length-1&&d.addClass("last"),a.find("last").after(d),a.find("last").removeClass("last"))):a.find('[data-update="'+l+'"]').replaceWith(t[f]);a.children("li.webticker-init, li.ticker-spacer").removeClass("old"),r&&a.children("li").remove(".old"),h=0,h=e(a),a.width(h+200),a.find("li.webticker-init").length<1&&(c.startEmpty=!1),a.html(t),a.children("li").css("white-space","nowrap"),a.children("li").css("float",c.direction),a.children("li").css("padding","0 7px"),a.children("li").css("line-height",c.height),o(a,!0)}else{a.children("li").addClass("old");for(var p=0;p<t.length;p++)l=i(t[p]).data("update"),a.find('[data-update="'+l+'"]').length<1?n&&(0===a.find(".ticker-spacer:first-child").length&&a.find(".ticker-spacer").length>0?a.children("li.ticker-spacer").before(t[p]):(d=i(t[p]),p===t.length-1&&d.addClass("last"),a.find(".old.last").after(d),a.find(".old.last").removeClass("last"))):a.find('[data-update="'+l+'"]').replaceWith(t[p]);a.children("li.webticker-init, li.ticker-spacer").removeClass("old"),a.children("li").css("white-space","nowrap"),a.children("li").css("float",c.direction),a.children("li").css("padding","0 7px"),a.children("li").css("line-height",c.height),r&&a.children("li").remove(".old"),h=0,h=e(a),a.width(h+200)}}a.webTicker("cont")}};i.fn.webTicker=function(t){return d[t]?d[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void i.error("Method "+t+" does not exist on jQuery.webTicker"):d.init.apply(this,arguments)}}(jQuery);

Back to list