1var index_js = { 2 addShoppingCart : function(){ 3 $('body').on('click','a.glyphicon-shopping-cart', function(e){ 4 e.preventDefault(); 5 var $this = $(this), 6 href = $this.data('href'); 7 8 if (is_logined == '1') { 9 10 if ($this.hasClass('pitch')) { 11 return; 12 } 13 $.getJSON(href, function(data){ 14 if (data.status == 'success') { 15 showBg('cart_success','dialog_content'); 16 $this.addClass('pitch').delay(3000).queue(function(next){ 17 $this.removeClass("pitch"); 18 next(); 19 }); 20 $('#min_cart .glyphicon-shopping-cart').removeClass("forbidden"); 21 $('#min_cart').find('span.web-badge').text(data.cart_count); 22 } else { 23 $('div.wrong_width').find('div.text').text(data.message); 24 showBg('wrong_width','dialog_content'); 25 } 26 }); 27 } else { 28 showBg('login_width','dialog_content'); 29 } 30 }); 31 }, 32 addCollect : function(){ 33 $('body').on('click','.action-collect', function() { 34 if (is_logined == 0) { 35 showBg('login_width','dialog_content'); 36 return false; 37 } 38 39 var id = $(this).data('id'); 40 var type = 'add'; 41 var is_virtual = $(this).data('is_virtual'); 42 if ($(this).hasClass("active") == true) { 43 $(this).removeClass("active"); 44 type = 'del'; 45 } else { 46 $(this).addClass("active"); 47 } 48 49 if (typeof(is_virtual) == 'undefined') { 50 is_virtual = 1; 51 } 52 53 var param = {action:type,ids:id,is_virtual:is_virtual}; 54 $.post('/user/collection', param, function(ret){ 55 if (ret.code == 0) { 56 if ($('.user-collect').length > 0) { 57 var init = $('.user-collect span').html(); 58 if (init == '') { 59 var num = 1; 60 } else { 61 var num = type == 'add' ? parseInt(init) + 1 : parseInt(init) - 1; 62 } 63 $('.user-collect span').html(num); 64 } 65 } 66 },'json'); 67 }); 68 } 69}; 70 71(function ($) { 72 $.getUrlParam = function (name) { 73 var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); 74 var r = window.location.search.substr(1).match(reg); 75 if (r != null) return decodeURI(r[2]); 76 return null; 77 } 78})(jQuery); 79 80 81$(function(){ 82 83 function setCookie(cname, cvalue, exdays) { 84 var host = location.host; 85 var domain = host.substring(host.lastIndexOf(".",host.lastIndexOf(".")-1)+1); 86 87 if(exdays) 88 { 89 var d = new Date(); 90 d.setTime(d.getTime() + (exdays*24*60*60*1000)); 91 var expires = "expires="+d.toUTCString(); 92 document.cookie = cname + "=" + cvalue + "; " + expires+"; path=/;domain=."+domain; 93 } 94 else 95 { 96 document.cookie = cname + "=" + cvalue + "; path=/;domain=."+domain; 97 } 98 } 99 100 $('.bg .close').click(function(){ 101 setCookie('scdkey_bg_close',true,1); 102 $('.bg').hide(); 103 }); 104 105 $(".btn-sendmail").click(function() { 106 var email = $('.input-group .email').val(); 107 var reg = /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/; 108 var phone_reg = /^(\+\d{1,4} ?)?\d{3,12}$/; 109 110 if(!email||(!reg.test(email) && !phone_reg.test(email))){ 111 $('.input-group .tips').css('display',''); 112 $('.loader-inner').hide(); 113 } 114 else { 115 $('.input-group .tips').css('display','none'); 116 $('.loader-inner').show(); 117 $.get( 118 '/index/subscribe', 119 {email:email}, 120 function (msg) { 121 $('.loader-inner').hide(); 122 $('.input-group .email').val(''); 123 $('.btn-sendmail i').addClass('glyphicon-ok'); 124 setTimeout(function(){ 125 $('.btn-sendmail i').removeClass('glyphicon-ok'); 126 } , 3000); 127 },'json'); 128 } 129 });
130 131 $('.input-group .tips').mouseover(function(){ 132 $('.input-group .tips').hide(); 133 }); 134 135 $('.current_lang').click(function(){ 136 var value = $(this).data('value'); 137 var domain = $(this).data('domain'); 138 139 var cur_value = $('#scdkeys_cursite').data('value'); 140 var cur_domain = $('#scdkeys_cursite').data('domain'); 141 142 143 var href = window.location.href.replace(window.location.hash,''); 144 var str = WWW_SITE_LOGIN.toLowerCase() + '.com'; 145 var reg = /:\/{2}([^.^\/]+)\./g; 146 var site = reg.exec(href)[1]; 147 reg = /\.[^.^\/]+/g; 148 var topDomainStr = reg.exec(str); 149 if(value == cur_value) 150 return; 151 else 152 href = href.replace(site,(domain!='com'?domain:'www')).replace(topDomainStr,'.com'); 153 reg = /auth=.[^&]*/g; 154 var auth = href.match(reg); 155 if(auth) 156 href = href.replace(auth,'auth=' + CUR_AUTH); 157 else { 158 if(href.match(/\?/)) 159 href += '&auth=' + CUR_AUTH; 160 else 161 href += '?auth=' + CUR_AUTH; 162 } 163 //setCookie('site',value,1); 164 var reg = /site=.[^&]*/g; 165 var cur_site = href.match(reg); 166 if(cur_site) 167 href = href.replace(cur_site,'site=' + value); 168 else { 169 if(href.match(/\?/)) 170 href += '&site=' + value; 171 else 172 href += '?site=' + value; 173 } 174 175 var reg = /from=.[^&]*/g; 176 var ad_referer = href.match(reg); 177 if(ad_referer) 178 href = href.replace(ad_referer,'from=' + AD_REFERER); 179 else { 180 if(href.match(/\?/)) 181 href += '&from=' + AD_REFERER; 182 else 183 href += '?from=' + AD_REFERER; 184 } 185 186 if (console) { 187 console.log(href); 188 }; 189 href = href.replace('https','http'); 190 window.location.href = href; 191 }); 192 $('.current_currency').click(function(){ 193 var value = $(this).attr('value'); 194 var href = window.location.href.replace(window.location.hash,''); 195 var reg = /currency=.[^&]*/g; 196 var currency = href.match(reg); 197 if(currency) 198 href = href.replace(currency,'currency=' + value); 199 else { 200 if(href.match(/\?/)) 201 href += '¤cy=' + value; 202 else 203 href += '?currency=' + value; 204 } 205 setCookie('currency',value); 206 window.location.href = href; 207 }); 208 209 index_js.addShoppingCart(); 210 index_js.addCollect(); 211 if (is_logined == 1) { 212 if($('.unread-notification').length != 0) 213 { 214 $.get('/user/rsyncNotification',function(ret) { 215 if (ret.code == 0) { 216 if (ret.total != 0) { 217 $('.unread-notification').html(ret.total); 218 } 219 } 220 },'json') 221 222 } 223 } 224 225 if (is_logined == 1) { 226 $(document).on('click', 'i.glyphicon-bell', function(e){ 227 e.preventDefault(); 228 if ($(this).hasClass('forbidden')) return; 229 $.get('/user/getUserOrderLog', function(data){ 230 $('#min_bell').html(data); 231 $(".web_shopping-cart ul").hide(); 232 $('#min_bell').show(); 233 }); 234 }); 235 } 236 237 238 239 $('.user-collect').click(function() { 240 window.location.href = '/user/collection'; 241 }) 242 243 window.showBgContent = function(ct ,title,content,sub_fun,param) { 244 $(".dialog,.dialog_s").hide(); 245 var bH = $(document).height(); 246 var bW = $("body").width(); 247 var objWH = getObjWh(ct); 248 $(".fullbg").css({ width: bW, height: bH, display: "block",opacity:0.8}); 249 var tbT = objWH.split("|")[0] + "px"; 250 251 //ç®åº topåå¼ 252 var window_width = $(window).width(); 253 var w_div_width = $("." + ct).width(); 254 var he_width = (window_width - w_div_width) / 2; 255 256 var window_height = $(window).height(); 257 var h_div_height = $("." + ct).height(); 258 var he_height = (window_height - h_div_height)/2; 259 260 $("." + ct).css({ top: he_height-180, left: he_width }); 261 $("." + ct).show(); 262 $("." + ct).animate({ top: he_height,opacity:1},500); 263 264 265 var obj = $("." + ct); 266 if(window.console && console.log){ 267 console.log($(obj).children().find('.alert_w p').html(title)); 268 console.log($(obj).children().find('.alert_w .text').html(content)); 269 if(sub_fun) 270 { 271 console.log($(obj).children().find(':submit').one('click',function(){ 272 sub_fun(param); 273 } )); 274 } 275 //$("'" + htmlContent + "'").html(title); 276 //$("." + content .w_tanceng_t .text).html(content); 277 } 278 279 //$("." + ct).html("<div style='text-align:center'>Loading...</div>"); 280 $(window).scroll(function () { resetBg() }); 281 $(window).resize(function () { resetBg() }); 282 } 283 284 285 286 var searchProduct_locker = false; 287 var search_timer = null; 288 $(".search-min input").keyup(function() { 289 $('.web-search-down').show(); 290 var search = $(this).val(); 291 if(search_timer !== null){ 292 clearTimeout(search_timer); 293 search_timer = null; 294 } 295 search_timer = setTimeout(function(){ 296 if(searchProduct_locker){ 297 searchProduct_locker = false; 298 } 299 else{ 300 $('.pagination .txt-c a').attr('page',1); 301 searchProduct(search); 302 } 303 }, 200); 304 });
305 306 $(".search-min input").on('paste', function() { 307 $('.web-search-down').show(); 308 var search = $(this).val(); 309 if(search_timer !== null){ 310 clearTimeout(search_timer); 311 search_timer = null; 312 } 313 314 searchProduct_locker = true; 315 $('.pagination .txt-c a').attr('page',1); 316 searchProduct(search); 317 setTimeout(function(){ 318 if(searchProduct_locker){ 319 searchProduct_locker = false; 320 } 321 }, 200); 322 }); 323 324 325 $(".search-form .page_left").click(function(){ 326 var page = $('.pagination .txt-c a').attr('page'); 327 var count = $('.pagination .txt-c a').attr('count'); 328 page = parseInt(page); 329 if(page <=1 ) 330 return 331 $('.pagination .txt-c a').attr('page',page-1); 332 var search = $(".search-min input").val(); 333 searchProduct(search); 334 return false; 335 }) 336 337 $(".search-form .page_right").click(function(){ 338 var page = $('.pagination .txt-c a').attr('page'); 339 var count = $('.pagination .txt-c a').attr('count'); 340 page = parseInt(page); 341 if(page == count || page > count-1 ) 342 return 343 $('.pagination .txt-c a').attr('page',page+1); 344 var search = $(".search-min input").val(); 345 searchProduct(search); 346 return false; 347 }) 348 349 $('.tab-pane .load_more').click(function(e){ 350 e.preventDefault(); 351 var div = $(this); 352 div.children('.fa-spinner').css('display','inline-block'); 353 var page = div.data('page'); 354 var type = div.data('type'); 355 $.get('/index/part', { page : page, type : type}, function(d){ 356 div.children('.fa-spinner').css('display','none'); 357 if(d){ 358 div.before(d); 359 div.data('page', page + 1); 360 } 361 else{ 362 div.hide(); 363 } 364 365 }); 366 367 }) 368 369 $('.windows-tiops .close-img-shade').click(function(){ 370 setCookie('vip_zone_ad_close',true,1/96); 371 $('.windows-tiops').hide(); 372 }); 373 374});
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.