1//all scroll 2var globle_scroll=function(move,left,right,list,auto_time,move_time,mouse_or_click){this.move=$(move);this.left=$(left);this.right=$(right);this.list=$(list);this.move_time=move_time;this.auto_time=auto_time;this.mouse_or_click=mouse_or_click;this.len=0;this.wid=0;this.num=1;this.css3=false;this.set_html=function(){var self=this;var first=this.move.children().first().clone();var last=this.move.children().last().clone();this.move.prepend(last);this.move.append(first);var supportCss3=(function(){var div=document.createElement('div'),vendors='Khtml Ms O Moz Webkit'.split(' '),len=vendors.length;return function(prop){if(prop in div.style) return true;prop=prop.replace(/^[a-z]/, function(val){return val.toUpperCase();});while(len--){if(vendors[len] + prop in div.style){return true;}}return false;};})();this.css3=supportCss3('transition');if(this.css3){self.move.css({transitionDuration:self.move_time+'ms'});}};this.set_width=function(){this.wid=this.move.parent().width();this.len=this.move.children().length;this.move.children().width(this.wid);var move_width=this.len*this.wid;this.move.width(move_width);};this.gos=function(){var self=this;if(typeof(auto_time)=='undefined'){self.auto_time=8000;}if(typeof(move_time)=='undefined'){self.move_time=400;}this.set_html();this.set_width();var animate_go=function(num,time){if(time!=0){var time=self.move_time;}var left='-'+(num*self.wid).toString()+'px';if(self.css3){self.move.css({transitionDuration:time+'ms',transform:'translate('+left+',0px)'});window.clearInterval(animate_st);var animate_st=window.setTimeout(function(){if(num<=0){self.move.css({transitionDuration:'0ms'});self.num=self.len-2;left='-'+(self.num*self.wid).toString()+'px';self.move.css({transform:'translate('+left+',0px)'});};if(num>=self.len-1){self.move.css({transitionDuration:'0ms'});self.num=1;left='-'+(self.num*self.wid).toString()+'px';self.move.css({transform:'translate('+left+',0px)'});};self.list.children().removeClass('current');self.list.children().eq(self.num-1).addClass('current');},time);}else{self.move.stop().animate({left:left},time,function(){if(num<=0){self.num=self.len-2;left='-'+(self.num*self.wid).toString()+'px';self.move.css({left:left});};if(num>=self.len-1){self.num=1;left='-'+(self.num*self.wid).toString()+'px';self.move.css({left:left});};self.list.children().removeClass('current');self.list.children().eq(self.num-1).addClass('current');})};};if(typeof(this.mouse_or_click)=='undefined'){this.mouse_or_click='click';}this.list.children().on(this.mouse_or_click,function(){self.num=$(this).attr('value');animate_go(self.num);});this.left.on('click',function(){left_click();});function left_click(){self.num--;animate_go(self.num);}this.right.on('click',function(){right_click();});function right_click(){self.num++;animate_go(self.num);};animate_go(1,0);$(window).resize(function(){self.set_width();animate_go(self.num,0);});self.st='';self.auto_scroll=function(){self.st=window.setInterval(function(){self.num++;animate_go(self.num);},self.auto_time);};self.auto_scroll();self.move.hover(function(){window.clearInterval(self.st);},function(){self.auto_scroll();});var touch_scroll=function(ul,css3){this.startPos='';this.endPos='';this.isScrolling='';this.int=function(){var self=this;var ul_dom=$(ul);var id=$(ul).get(0);if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch){id.addEventListener('touchstart',self.start, false);id.addEventListener('touchmove',self.move, false);id.addEventListener('touchend',self.end, false);}};this.start=function(){if(css3){var left=self.move.css('transform').toString().split(',')[4];}else{var left=$(ul).css('left');}var left=parseInt(left,10);var touch = event.touches[0];this.startPos = {x:touch.pageX,y:touch.pageY,left:left};if(css3){$(ul).css({transitionDuration:'0ms'});}};this.move=function(){var self=this;var touch = event.touches[0];self.endPos = {x:touch.pageX - self.startPos.x,y:touch.pageY - self.startPos.y};self.isScrolling = Math.abs(self.endPos.x) < Math.abs(self.endPos.y) ? 1:0;if(self.isScrolling === 0){event.preventDefault();var left=self.startPos.left+self.endPos.x;left+='px';if(css3){$(ul).css({transform:'translate('+left+',0px)'});}else{$(ul).css({left:left});}}};this.end=function(){var self=this;if(self.endPos.x>0){left_click();}else if(self.endPos.x<0){right_click();}}};var touch=new touch_scroll(move,self.css3);touch.int();};} 3//cookie 4var cookie={ 5 setcookie:function(name,value){ 6 var Days=1; 7 var date=new Date(); 8 date.setTime(date.getTime() + Days*1*60*60*1000); 9 document.cookie=name+"="+value+";path=/;expires="+date.toGMTString(); 10 }, 11 getcookie:function(name){//è·åæå®åç§°çcookieçå¼ 12 var cookies=document.cookie.split(';'); 13 var cookieValue=0; 14 for (var i=0; i < cookies.length; i++){ 15 var cookie=jQuery.trim(cookies[i]); 16 if(cookie.substring(0, name.length + 1)==(name + '=')){ 17 cookieValue=decodeURIComponent(cookie.substring(name.length + 1)); 18 break; 19 } 20 } 21 return cookieValue; 22 } 23} 24//all -> js 25var ispc=true; 26var globle_js=function(){ 27 this.header=function(){ 28 var dom=$('.footer .wrap:eq(0)'); 29 var width=dom.width(); 30 pd(width); 31 $(window).resize(function(){ 32 width=dom.width(); 33 pd(width); 34 }); 35 function pd(width){ 36 if(width==750 || width==1000){ 37 ispc=true; 38 }else{ 39 ispc=false; 40 } 41 }; 42 $('#header_nav > li').mouseenter(function(){ 43 if(ispc){ 44 $(this).addClass('current'); 45 } 46 }).mouseleave(function(){ 47 if(ispc){ 48 $(this).removeClass('current'); 49 } 50 }); 51 $('#header_nav span.nav_a').parent().click(function(){ 52 if(this.id==1){ 53 if(!ispc){ 54 $(this).parent().removeClass('current'); 55 this.id=0; 56 } 57 }else{ 58 if(!ispc){ 59 $(this).parent().addClass('current'); 60 this.id=1; 61 } 62 } 63 }); 64 $('.media_show').click(function(){ 65 if(this.id==1){ 66 $('#header_nav').addClass('hidden'); 67 this.id=0; 68 }else{ 69 $('#header_nav').removeClass('hidden'); 70 this.id=1; 71 } 72 }); 73 $('.float_banner .close_bt').click(function(){ 74 $(this).parent().remove(); 75 }); 76 $('.float_banner_index .close_bt').click(function(){ 77 $(this).parent().remove(); 78 }); 79 }; 80 //Single->li->scroll 81 this.scroll_li=function(clas,left,right){var time=600;var allnum=$(clas).children().length;$(clas).html($(clas).html()+$(clas).html());var wid=0;var num=0;var goright=0;$(clas).children().each(function(){wid+=$(this).outerWidth();$(this).attr({widths:$(this).outerWidth()});});$(clas).width(wid);$(right).click(function(){click_right();});function click_right(){var gowid=Number($(clas).children().eq(num).attr('widths'));num+=1;goright+=gowid;$(clas).animate({right:goright},time,function(){if(num>=allnum){num=0;goright=0;$(clas).css({right:0});}});};$(left).click(function(){if(num==0){$(clas).css({right:wid/2});num=allnum;goright=wid/2;};num-=1;var gowid=Number($(clas).children().eq(num).attr('widths'));goright-=gowid;$(clas).animate({right:goright});});var st='';function settime(){st=window.setInterval(function(){click_right();},4000);};settime();$(clas).hover(function(){window.clearInterval(st)},function(){settime();});}; 82 this.hide_show=function(leftclick,rightclick,list,auto_time){var num=0;var effect_time=600;var len=$(list).length;$(leftclick).click(function(){left_click()});function left_click(){num--;if(num<0){num=len-1;};auto(num);};$(rightclick).click(function(){right_click();});function right_click(){num++;if(num>=len){num=0;};auto(num);};function auto(num){window.clearInterval(st);set_auto_time();$(list).eq(num).fadeIn(effect_time).removeClass('hidden').siblings().addClass('hidden').fadeOut(effect_time);};var st='';function set_auto_time(){st=window.setInterval(function(){right_click();},auto_time);};set_auto_time();}; 83 //all changes by check 84 this.check_change=function(clicks,checks){ 85 $(document).on('click',clicks,function(){ 86 var num=$(this).attr('changeid'); 87 $(clicks).removeClass('current'); 88 $(clicks+'[changeid="'+num+'"]').addClass('current'); 89 $(checks).addClass('hidden'); 90 $(checks+'[changeid="'+num+'"]').removeClass('hidden'); 91 }) 92 }; 93 this.media_click_show=function(clicks,checks){ 94 $(clicks).on('click',function(){ 95 var num=$(this).attr('changeid'); 96 if($(this).hasClass('current')){ 97 $(this).removeClass('current'); 98 $(checks+'[changeid="'+num+'"]').removeClass('current'); 99 }else{ 100 $(this).addClass('current'); 101 $(checks+'[changeid="'+num+'"]').addClass('current'); 102 } 103 }) 104 }; 105 this.hover_change=function(checks,changes){//模ææç´¢æ¡hoverææåæ¢change 106 $(checks).hover( 107 function(){ 108 $(checks+' > ol').css({display:'block'});
109 }, 110 function(){ 111 $(checks+' > ol').css({display:'none'}); 112 } 113 ) 114 $(checks+' li').click(function(){ 115 var num=$(this).attr('value') 116 $(checks+' span').html($(this).html()); 117 $(checks+' > ol').css({display:'none'}); 118 $(changes).addClass('hidden'); 119 $(changes+'[changeid="'+num+'"]').removeClass('hidden'); 120 }) 121 }; 122 this.classify_table=function(){//classify_table shows 123 var len=$('.classify_table_title li').length; 124 $('.classify_table_title span.word').each(function(){ 125 var have=0; 126 var li=$(this).parent().parent(); 127 var table_list_child=$('.classify_table_content').eq(0).clone(); 128 $(this).click(function(){ 129 if(this.id==1){ 130 li.removeClass('current'); 131 this.id=0; 132 }else{ 133 li.addClass('current'); 134 if(have==0){ 135 table_list_child.appendTo(li); 136 have=1; 137 } 138 this.id=1; 139 } 140 }) 141 }); 142 //no_img set auto min-height 143 var no_img=$('.classify_table_title .no_img'); 144 if(no_img.length>0){ 145 function no_img_fu(){ 146 no_img.removeAttr('style'); 147 var min_height=0; 148 no_img.each(function(){ 149 var height=$(this).height(); 150 if(min_height<height){ 151 min_height=height; 152 } 153 }); 154 no_img.css({minHeight:min_height+'px'}); 155 } 156 no_img_fu(); 157 $(window).resize(function(){ 158 no_img_fu(); 159 }) 160 } 161 }; 162 this.classify_table_fixed=function(){//classify_table_title fixed 163 var classify_table_title=$('.classify_table_title'); 164 var classify_table_content=$('.classify_table_content'); 165 var isfixed=false; 166 if(classify_table_title.length>0){ 167 var top=classify_table_title.offset().top; 168 var hide_top=classify_table_content.offset().top+classify_table_content.height()-classify_table_title.height(); 169 $(window).resize(function(){ 170 if(ispc){ 171 top=classify_table_title.offset().top; 172 }else{ 173 classify_table_title.removeClass('fixed'); 174 } 175 }) 176 $(window).scroll(function(){ 177 if(ispc){ 178 var sc_top=$(window).scrollTop(); 179 if(sc_top>top){ 180 if(!isfixed){ 181 classify_table_title.addClass('fixed'); 182 classify_table_content.addClass('current'); 183 isfixed=true; 184 } 185 if(sc_top<hide_top){ 186 classify_table_title.show(); 187 }else{ 188 classify_table_title.hide(); 189 } 190 }else{ 191 if(isfixed){ 192 classify_table_title.removeClass('fixed'); 193 classify_table_content.removeClass('current'); 194 isfixed=false; 195 } 196 } 197 } 198 }) 199 } 200 }; 201 this.float_side=function(){//all the sidebar and fixed js runing here 202 //nav fixed 203 var show_top=650; 204 var show_num=0; 205 if($('.subnav_product').length>0){ 206 show_top=$('.subnav_product').offset().top; 207 } 208 if($('.pro_fixed_button_for_mac').length>0){ 209 show_top=650 210 } 211 var pro_fixed_button=$('.pro_fixed_button'); 212 if(pro_fixed_button.length>0){ 213 $(window).scroll(function(){ 214 if($(window).scrollTop()>show_top){ 215 if(show_num==0){ 216 pro_fixed_button.addClass('current'); 217 show_num=1; 218 } 219 }else{ 220 if(show_num==1){ 221 pro_fixed_button.removeClass('current'); 222 show_num=0; 223 } 224 } 225 }) 226 } 227 }; 228 this.star=function(star_content,star_num,id_num){//ææ 229 $.getJSON("/product/get_star_num?pid="+id_num, function(json){ 230 change_star(star_content,star_num,json.star5,json.star4,json.star3,json.star2,json.star1,json.url); 231 }); 232 function change_star(star_content,star_num,star5,star4,star3,star2,star1,review_url){ 233 star1=Number(star1);star2=Number(star2);star3=Number(star3);star4=Number(star4);star5=Number(star5); 234 var allstar=star1+star2+star3+star4+star5;//è·åæå¤å°æ¡è¯è®º 235 var star=new Array( 236 star5,star4,star3,star2,star1 237 ); 238 var allstarnum=0;//è·åæ»çå®é è¯å 239 var i=0;//设置循ç¯i 240 for(i=4;i>=0;i--){ 241 var s=4-i; 242 allstarnum+=star[s]*(i+1); 243 } 244 allstarnum=Math.floor((allstarnum/allstar)*2)/2;//pro star 245 var span=''; 246 var big_span='';//å类页大ç©ç© 247 var spanid=1; 248 if(allstarnum%2==0.5 || allstarnum%2==1.5){ 249 spanid=0; 250 } 251 for(i=1;i<=5;i++){ 252 if(i<=allstarnum){ 253 span+='<span class="star_01"> </span>'; 254 big_span+='<span class="starBig_01"> </span>'; 255 }else{ 256 if(spanid==0){ 257 span+='<span class="star_02"> </span>'; 258 big_span+='<span class="starBig_02"> </span>'; 259 spanid=1; 260 }else{ 261 span+='<span class="star_03"> </span>'; 262 big_span+='<span class="starBig_02"> </span>'; 263 } 264 } 265 }
266 $(star_num).html(span+'<meta itemprop="ratingValue" content="'+allstarnum+'" />');//æ¤å ¥html 267 var num=0;//ç»å®æé è¯åæ¡ 268 $(star_content).find('.percent').each(function(){ 269 var star_pre=star[num]/allstar*100+'%'; 270 $(this).find('b').css({width:star_pre}); 271 $(this).next().html('('+star[num]+')'); 272 num++; 273 }) 274 //ä¸é¢æ¯ç»å®hoveräºä»¶ 275 $(star_content).mouseenter(function(){ 276 $(this).find('.star_button').addClass('current'); 277 var starlist=$(this).find('.star_list'); 278 starlist.stop(); 279 starlist.removeClass('hidden'); 280 }).mouseleave(function(){ 281 $(this).find('.star_button').removeClass('current'); 282 var starlist=$(this).find('.star_list'); 283 starlist.stop(); 284 starlist.addClass('hidden'); 285 }); 286 //é¦é¡µbanneræå ¥reviewè¯è®ºæ° 287 if($('.banner_star').length>0){ 288 $('.banner_star .star').after('<a href="/'+review_url+'" id="banner_review" class="review">('+allstar+')</a>'); 289 } 290 //å类页reviewæ°é设置 291 if($('#topreview .word').length>0){ 292 if($('#topreview .word a').length>0){ 293 $('#topreview .word a').text('Review('+allstar+')'); 294 }else{ 295 $('#topreview .word').text('Review('+allstar+')'); 296 } 297 } 298 if($('#topreview2').length>0){ 299 $('#star_num2').html(big_span); 300 $('#topreview2 .word').text('Review('+allstar+')'); 301 } 302 if($('.pro_nav_side .review').length>0){ 303 $('.pro_nav_side .review').text('Review('+allstar+')'); 304 } 305 $('.pro_fixed_button .review a').text('Review('+allstar+')'); 306 }; 307 //reviewæé®éç¹ 308 $('.top_review .button').click(function(){ 309 $('.list_liveword .nav_this li:eq(1)').click(); 310 var top=$('.submit_liveword').offset().top-100; 311 $('body,html').animate({scrollTop:top},600); 312 }) 313 }; 314 this.media_sidebar=function(){ 315 $('.part_box_support_media_show').click(function(){ 316 $('.LeftSideBar').addClass('current'); 317 $('.part_box_support_media_bg').removeClass('hidden'); 318 }) 319 $('.part_box_support_media_bg').click(function(){ 320 $('.part_box_support_media_bg').addClass('hidden'); 321 $('.LeftSideBar').removeClass('current'); 322 }) 323 }; 324 this.countdown=function(){ 325 if($('#countdown').length>0){ 326 window.setInterval(function(){ 327 var a=new Date(); 328 a.setHours(0,0,0,0); 329 a.setDate(a.getDate()+1); 330 var b=new Date(); 331 var s=Number(a)-Number(b); 332 if(s>0){ 333 var m=Math.ceil(s/1000); 334 var f=Math.floor(m/60); 335 var t=Math.floor(f/60); 336 var day=Math.floor(t/24); 337 var mm=m-f*60; 338 var ff=f-t*60; 339 var t=t-day*24; 340 $('#hours').html(t); 341 $('#minutes').html(ff); 342 $('#seconds').html(mm); 343 } 344 },1000); 345 } 346 }; 347 this.version=function(){ 348 if($('.version').length>0){ 349 var dom=document.createElement('script'); 350 document.body.appendChild(dom); 351 } 352 }; 353 this.buy_linkid_run=function(){//è´ä¹°é¡µï¼linkidæ ¹æ®æ¥æºä¸ååä¿®æ¹ï¼ æ§è¡ 354 //get buy_linkid 355 var buy_linkid=document.URL; 356 buy_linkid=buy_linkid.match(/linkid\=.*/); 357 if(buy_linkid!=null){ 358 buy_linkid=buy_linkid[0]; 359 if(/\&/.test(buy_linkid)){ 360 buy_linkid=buy_linkid.split('&'); 361 buy_linkid=buy_linkid[0]; 362 } 363 buy_linkid=buy_linkid.split('='); 364 buy_linkid=buy_linkid[1]; 365 //set buy_linkid 366 $('.buy_linkid').each(function(){ 367 var url=$(this).attr('href'); 368 linkids=url.match(/linkid\=.*/); 369 if(linkids!=null){ 370 linkids=linkids[0]; 371 if(/\&/.test(linkids)){ 372 linkids=linkids.split('&'); 373 linkids=linkids[0]; 374 } 375 url=url.replace(linkids,'linkid='+buy_linkid); 376 $(this).attr({href:url}); 377 }else{ 378 if(!(/javascript\:void\(0\)/.test(url))){ 379 $(this).attr({href:url+'&linkid='+buy_linkid}); 380 } 381 } 382 }); 383 } 384 } 385} 386//run function 387$(function(){ 388 var globleJs=new globle_js(); 389 globleJs.header(); 390 globleJs.float_side(); 391 globleJs.media_sidebar(); 392 globleJs.countdown(); 393 globleJs.version(); 394 if($('.buy_linkid').length>0){ 395 globleJs.buy_linkid_run(); 396 } 397})
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.