﻿(function (a) { a.fn.Ticker = function (b) { var c = a.extend({}, a.fn.Ticker.Defaults, b); c.tickerShow = "." + c.tickerShow; c.tickerContent = "." + c.tickerContent; return this.each(function () { a(c.tickerShow, this).html("<a></a>"); a(c.tickerContent, this).find("a:first-child").tick(c) }) }; a.fn.tick = function (b) { function c(d) { var f = a(e).text(); if (f.length - 1 < d.length) f = d.substring(0, f.length) + b.cursor, a(e).text(f), setTimeout(function () { c(d) }, b.speed); else if (a(e).text(f.substring(0, f.length - 1)), a(i).find("a").size() > 1) { var h = a(g).next("a"); a(h).length == 0 && (h = a(i).find("a:first-child")); setTimeout(function () { a(h).tick(b) }, b.delay) } } var g = a(this), d = a(g).parents(b.container), i = a(g).parents(b.tickerContent), e = a(b.tickerShow, d).find("a"); a(e).text("").attr("href", ""); (d = a(g).attr("href")) && d.length != 0 ? a(e).attr("href", d) : a(e).removeAttr("href"); setTimeout(function () { c(a(g).text().trim()) }, b.speed); return this }; a.fn.Ticker.Defaults = { container: ".Ticker", tickerShow: "TickerShow", tickerContent: "TickerContent", cursor: "_", speed: 100, delay: 5E3} })(jQuery);
