1// Copyright 2010 htmldrive.net Inc. 2/** 3* @projectHomepage http://www.htmldrive.net/welcome/amazon-scroller 4* @projectDescription Amazon style image and title scroller 5* @author htmldrive.net 6* More script and css style : htmldrive.net 7* @version 1.0 8* @license http://www.apache.org/licenses/LICENSE-2.0 9*/ 10(function(a){ 11 a.fn.amazon_scroller=function(p){ 12 var p=p||{}; 13 14 var g=p&&p.scroller_time_interval?p.scroller_time_interval:"3000"; 15 var h=p&&p.scroller_title_show?p.scroller_title_show:"enable"; 16 var i=p&&p.scroller_window_background_color?p.scroller_window_background_color:"white"; 17 var j=p&&p.scroller_window_padding?p.scroller_window_padding:"5"; 18 var k=p&&p.scroller_border_size?p.scroller_border_size:"1"; 19 var l=p&&p.scroller_border_color?p.scroller_border_color:"black"; 20 var m=p&&p.scroller_images_width?p.scroller_images_width:"70"; 21 var n=p&&p.scroller_images_height?p.scroller_images_height:"50"; 22 var o=p&&p.scroller_title_size?p.scroller_title_size:"12"; 23 var q=p&&p.scroller_title_color?p.scroller_title_color:"blue"; 24 var r=p&&p.scroller_show_count?p.scroller_show_count:"3"; 25 var d=p&&p.directory?p.directory:"images"; 26 j += "px"; 27 k += "px"; 28 m += "px"; 29 n += "px"; 30 o += "px"; 31 var dom=a(this); 32 var s; 33 var t=0; 34 var u; 35 var v; 36 var w=dom.find("ul:first").children("li").length; 37 var x=Math.ceil(w/r); 38 if(dom.find("ul").length==0||dom.find("li").length==0){ 39 dom.append("Require content"); 40 return null 41 } 42 dom.find("ul:first").children("li").children("a").children("img").css("width",m).css("height",n); 43 if(h=='enable'){ 44 dom.find("ul:first").children("li").children("a").each(function(){ 45 $(this).append('<div class="amazon_scroller_title">'+$(this).attr("title")+'</div>') 46 }) 47 dom.find("ul:first").children("li").css("height",n+o+"px"); 48 }else{ 49 dom.find("ul:first").children("li").css("height",n+"px"); 50 } 51 dom.find(".amazon_scroller_title").height(parseInt(o)+"px"); 52 s_s_ul(dom,j,k,l,i); 53 s_s_nav(dom.find(".amazon_scroller_nav"),d); 54 m=parseInt(m); 55 dom.find("ul:first").children("li").css("width",m+"px"); 56 n=parseInt(n); 57 58 dom.find("ul:first").children("li").children("a").css("color",q); 59 dom.find("ul:first").children("li").children("a").css("font-size",o); 60 begin(); 61 s=setTimeout(play,g); 62 dom.find(".amazon_scroller_nav").children("li").hover( 63 function(){ 64 if($(this).parent().children().index($(this))==0){ 65 $(this).css("background-position","left -50px"); 66 }else if($(this).parent().children().index($(this))==1){ 67 $(this).css("background-position","right -50px"); 68 } 69 }, 70 function(){ 71 if($(this).parent().children().index($(this))==0){ 72 $(this).css("background-position","left top"); 73 }else if($(this).parent().children().index($(this))==1){ 74 $(this).css("background-position","right top"); 75 } 76 } 77 ); 78 dom.find(".amazon_scroller_nav").children("li").click(function(){ 79 if($(this).parent().children().index($(this))==0){ 80 previous() 81 }else if($(this).parent().children().index($(this))==1){ 82 next() 83 } 84 }); 85 dom.hover( 86 function(){ 87 clearTimeout(s); 88 }, 89 function(){ 90 s=setTimeout(play,g); 91 } 92 ); 93 function begin(){ 94 var a=dom.find("ul:first").children("li").outerWidth(true)*w; 95 dom.find("ul:first").children("li").hide(); 96 dom.find("ul:first").children("li").slice(0,r).show(); 97 u=dom.find("ul:first").outerWidth(); 98 v=dom.find("ul:first").outerHeight(); 99 dom.find("ul:first").width(a); 100 dom.width(u+60); 101 dom.height(v); 102 dom.children(".amazon_scroller_mask").width(u); 103 dom.children(".amazon_scroller_mask").height(v); 104 dom.find("ul:first").children("li").show(); 105 dom.css("position","relative"); 106 dom.find("ul:first").css("position","absolute"); 107 dom.children(".amazon_scroller_mask").width(u); 108 dom.children(".amazon_scroller_mask").height(v); 109 dom.find(".amazon_scroller_nav").css('top',(v-50)/2+parseInt(j)+"px"); 110 dom.find(".amazon_scroller_nav").width(u+60) 111 dom.find("ul:first").clone().appendTo(dom.children(".amazon_scroller_mask")); 112 dom.children(".amazon_scroller_mask").find("ul:last").css("left",a);
113 } 114 function previous(){ 115 clearTimeout(s); 116 if(t > 0){ 117 t--; 118 dom.children(".amazon_scroller_mask").find("ul").animate({ 119 left: '+='+(m+10) 120 },500); 121 } 122 } 123 function next(){ 124 play(); 125 } 126 function play(){ 127 clearTimeout(s); 128 t++; 129 var a = dom.find("ul:first").children("li").outerWidth(true)*w; 130 if(t >= w+1){ 131 t = 0; 132 dom.children(".amazon_scroller_mask").find("ul:first").css("left","0px"); 133 dom.children(".amazon_scroller_mask").find("ul:last").css("left",a); 134 s=setTimeout(play,0); 135 }else{ 136 dom.children(".amazon_scroller_mask").find("ul").animate({ 137 left: '-='+(m+10) 138 },500); 139 s=setTimeout(play,g); 140 } 141 } 142 function s_s_ul(a,b,c,d,e){ 143 b=parseInt(b); 144 c=parseInt(c); 145 var f="border: "+d+" solid "+" "+c+"px; padding:"+b+"px; background-color:"+e; 146 a.attr("style",f) 147 } 148 function s_s_nav(a,d){ 149 var b=a.children("li:first"); 150 var c=a.children("li:last"); 151 a.children("li").css("width","25px"); 152 a.children("li").css("height","50px"); 153 a.children("li").css('background-image','url("'+d+'/arrow.gif")'); 154 c.css('background-position','right top'); 155 a.children("li").css('background-repeat','no-repeat'); 156 c.css('right','0px'); 157 b.css('left','0px'); 158 } 159 } 160})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.