Team:Freiburg Bioware/jquery newsticker

From 2010.igem.org

Revision as of 11:30, 18 October 2010 by Timon (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

/*

*
* Copyright (c) 2006/2007 Sam Collett (http://www.texotela.co.uk)
* Licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
* 
* Version 2.0
* Demo: http://www.texotela.co.uk/code/jquery/newsticker/
*
* $LastChangedDate: 2007-05-29 11:31:36 +0100 (Tue, 29 May 2007) $
* $Rev: 2005 $
*
*/

(function($) { /*

* A basic news ticker.
*
* @name     newsticker (or newsTicker)
* @param    delay      Delay (in milliseconds) between iterations. Default 4 seconds (4000ms)
* @author   Sam Collett (http://www.texotela.co.uk)
* @example  $("#news").newsticker(); // or $("#news").newsTicker(5000);
*
*/

$.fn.newsTicker = $.fn.newsticker = function(delay) { delay = delay || 4000; initTicker = function(el) { stopTicker(el); el.items = $("li", el); // hide all items (except first one) el.items.not(":eq(0)").hide().end(); // current item el.currentitem = 0; startTicker(el); }; startTicker = function(el) { el.tickfn = setInterval(function() { doTick(el) }, delay) }; stopTicker = function(el) { clearInterval(el.tickfn); }; pauseTicker = function(el) { el.pause = true; }; resumeTicker = function(el) { el.pause = false; }; doTick = function(el) { // don't run if paused if(el.pause) return; // pause until animation has finished el.pause = true; // hide current item $(el.items[el.currentitem]).fadeOut("slow", function() { $(this).hide(); // move to next item and show el.currentitem = ++el.currentitem % (el.items.size()); $(el.items[el.currentitem]).fadeIn("slow", function() { el.pause = false; } ); } ); }; this.each( function() { if(this.nodeName.toLowerCase()!= "ul") return; initTicker(this); } ) .addClass("newsticker") .hover( function() { // pause if hovered over pauseTicker(this); }, function() { // resume when not hovered over resumeTicker(this); } ); return this; };

})(jQuery);


/*

*
* Copyright (c) 2006/2007 Sam Collett (http://www.texotela.co.uk)
* Licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
* 
* Version 2.0
* Demo: http://www.texotela.co.uk/code/jquery/newsticker/
*
* $LastChangedDate: 2007-05-29 11:31:36 +0100 (Tue, 29 May 2007) $
* $Rev: 2005 $
*
*/

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?:e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(1($){$.9.D=$.9.g=1(b){b=b||p;i=1(a){j(a);a.4=$("r",a);a.4.q(":o(0)").l().C();a.5=0;h(a)};h=1(a){a.m=t(1(){f(a)},b)};j=1(a){s(a.m)};8=1(a){a.3=7};d=1(a){a.3=c};f=1(a){e(a.3)6;a.3=7;$(a.4[a.5]).n("k",1(){$(2).l();a.5=++a.5%(a.4.B());$(a.4[a.5]).z("k",1(){a.3=c})})};2.y(1(){e(2.x.w()!="A")6;i(2)}).v("g").u(1(){8(2)},1(){d(2)});6 2}})(E);',41,41,'|function|this|pause|items|currentitem|return|true|pauseTicker|fn|||false|resumeTicker|if|doTick|newsticker|startTicker|initTicker|stopTicker|slow|hide|tickfn|fadeOut|eq|4000|not|li|clearInterval|setInterval|hover|addClass|toLowerCase|nodeName|each|fadeIn|ul|size|end|newsTicker|jQuery'.split('|'),0,{}))