1$(function () { 2 $('[data-birth]').on('keyup', function () { 3 var val = $(this).val(); 4 val = val.replace(/[^\d.]/g, ""); 5 $(this).val(val); 6 var birth = $(this).attr('data-birth'); 7 // if (birth == 'm') { 8 // if (val.length == 2) { 9 // $('[data-birth="d"]').focus() 10 // } 11 12 // if (val > 12) $(this).val(12); 13 // var d = $('[data-birth="d"]').val(); 14 // var max = 31; 15 // if (val == 2) { 16 // max = 31; 17 // } 18 // if (['04', '06', '09', 11].indexOf(val) > -1) { 19 // max = 31; 20 21 // } 22 // if (d > max) $('[data-birth="d"]').val(max); 23 // } 24 // if (birth == 'd') { 25 // var m = parseInt($('[data-birth="m"]').val()); 26 // if (m < 10) $('[data-birth="m"]').val('0' + m); 27 // var max = 31; 28 // if (m == 2) { 29 // max = 31; 30 // } 31 // if (['04', '06', '09', 11].indexOf(m) > -1) { 32 // max = 31; 33 // } 34 // if (val == '') { 35 // $('[data-birth="m"]').focus() 36 // } 37 // if (val > max) $(this).val(max); 38 // } 39 40 }) 41 $('[data-birth]').on('blur', function () { 42 var m = parseInt($('[data-birth="m"]').val()); 43 var d = parseInt($('[data-birth="d"]').val()); 44 if (m < 10) $('[data-birth="m"]').val('0' + m); 45 if (d < 10) $('[data-birth="d"]').val('0' + d); 46 47 }) 48 var o = new Swiper(".zoom-top", { 49 spaceBetween: 5, slidesPerView: 1, 50 keyboard: true 51 , on: { 52 slideChangeTransitionEnd: function () { 53 $('.slide').removeClass('slide-active'); 54 $('.slider-nav-item').html(this.activeIndex + 1); 55 $('[data-thumb="' + (this.activeIndex) + '"]').addClass('slide-active'); 56 } 57 } 58 }); 59 var nt = 0; 60 $('[data-thumb]').on('click', function () { 61 var that = this; 62 $('.slide').removeClass('slide-active'); 63 $(that).addClass('slide-active'); 64 var n = $(that).attr('data-thumb'); 65 if (nt == 0) { 66 o = new Swiper(".zoom-top", { 67 spaceBetween: 5, slidesPerView: 1, 68 keyboard: true 69 , on: { 70 slideChangeTransitionEnd: function () { 71 $('.slide').removeClass('slide-active'); 72 $('.slider-nav-item').html(this.activeIndex + 1); 73 $('[data-thumb="' + (this.activeIndex) + '"]').addClass('slide-active'); 74 } 75 } 76 }); 77 } 78 setTimeout(function () { 79 o.slideTo(n, 500, false); 80 nt++; 81 }, 30) 82 83 }) 84 var tn = new Swiper(".zoom-thumbss", { 85 spaceBetween: 5, 86 slidesPerView: (Math.ceil($(window).width() / 50)), 87 freeMode: true, 88 observer: true, 89 observeParents: true 90 }); 91 var sn = new Swiper(".zoom-tops", { 92 spaceBetween: 40, slidesPerView: 1, thumbs: {swiper: tn}, observer: true, 93 freeMode:true, 94 mousewheel:true, 95 direction: "vertical", 96 observeParents: true, on: { 97 slideChangeTransitionEnd: function () { 98 o.slideTo(this.activeIndex, 500, false); 99 console.log(this.activeIndex) 100 $('.slide').removeClass('slide-active'); 101 $('[data-thumb="' + (this.activeIndex) + '"]').addClass('slide-active'); 102 $('.slider-nav-item').html(this.activeIndex + 1); 103 } 104 } 105 }); 106 107 $('.nav-link').on('click', function () { 108 $('.nav-link').removeClass('active'); 109 $(this).addClass('active'); 110 }) 111 $('[data-img-thumb]').on('click', function () { 112 var parent = $(this).parent().parent().parent(); 113 var key = parseInt($(this).attr('data-img-thumb')); 114 var str = ''; 115 var str_min = ''; 116 parent.find('[data-img-thumb]').each(function () { 117 str += ' <div class="swiper-slide preview">\n' + 118 ' <img class="img-responsive m-auto" src="' + $(this).attr('src') + '" alt="">\n' + 119 ' </div>'; 120 str_min += ' <div class="swiper-slide preview-min"><img class="img-responsive m-auto" src="' + $(this).attr('src') + '" alt="">\n' + 121 ' </div>'; 122 }) 123 $('.preveiw-max').html(str); 124 if (parent.find('[data-img-thumb]').length > 1) { 125 $('.preveiw-min').html(str_min).show(); 126 } else { 127 $('.preveiw-min').hide(); 128 } 129 $('.swiper-preview-image').css({'opacity': '1', 'z-index': '9999999'}); 130 sn.slideTo(key, 0, false); 131 $('body').css({'overflow': 'hidden'}) 132 }) 133 $('.preview-close').on('click', function () { 134 $('.swiper-preview-image').css({'opacity': '0', 'z-index': '-1'}); 135 $('body').css({'overflow': 'auto'}) 136 }) 137 $('[data-pack]').on('keyup', function () { 138 var pack = ''; 139 var val = $(this).val(); 140 val = val.replace(/[^\d.]/g, ""); 141 $(this).val(val); 142 $('[name="priv"]').val(''); 143 $('[name="city"]').val(''); 144 var url = $(this).attr('data-url'); 145 if (val.length == 7) { 146 $('[data-pack]').each(function (i) { 147 var info = ''; 148 if (i == 0) info = val.substring(0, 3); 149 if (i == 1) info = val.substring(3, 7); 150 $('[data-pack]').eq(i).val(info) 151 }) 152 $.post(url, {code: val}, function (res) { 153 if (res.code == 1) { 154 $('[name="priv"]').val(res.data.priv); 155 $('[name="city"]').val(res.data.city + res.data.dist); 156 } 157 }) 158 } else { 159 $('[data-pack]').each(function (i) { 160 pack += $('[data-pack]').eq(i).val(); 161 }) 162 if (pack > 7) pack = pack.substring(0, 7); 163 if (pack.length == 7) { 164 $.post(url, {code: pack}, function (res) { 165 if (res.code == 1) { 166 $('[name="priv"]').val(res.data.priv); 167 $('[name="city"]').val(res.data.city + res.data.dist); 168 } 169 }) 170 } 171 } 172 173 }) 174 $('[data-number]').on('keyup', function () { 175 var n = parseInt($(this).attr('data-number')); 176 var val = $(this).val(); 177 val = val.replace(/[^\d.]/g, ""); 178 $(this).val(val); 179 var l = $(this).attr('data-length'); 180 if (val.length == 11) { 181 $('[data-number]').each(function (i) { 182 var info = ''; 183 if (i == 0) info = val.substring(0, 3); 184 if (i == 1) info = val.substring(3, 7); 185 if (i == 2) info = val.substring(7, 11); 186 $('[data-number]').eq(i).val(info) 187 }) 188 } else { 189 if (val.length >= l) { 190 $(this).val(val.substring(0, (l))); 191 n++; 192 $('[data-number="' + n + '"]').focus(); 193 } 194 if (val == '') { 195 n-- 196 $('[data-number="' + n + '"]').focus(); 197 } 198 } 199 200 }) 201 $('[data-email-code]').on('click', function () { 202 203 var name = ($(this).attr('data-email-code')); 204 var email = $('[name="' + name + '"]').val(); 205 var url = $(this).attr('data-url'); 206 var that = this; 207 if (email == '') { 208 msg($(this).attr('data-msg2')); 209 return false;
210 } 211 var regx = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/; 212 var type = $(this).attr('data-type'); 213 // if (regx.test(email)) { 214 msg_receive($(this).attr('data-loading')); 215 $.post(url, {email: email, time: (new Date()).toTimeString(), type: type}, function (res) { 216 msg(res.info) 217 if (res.code == 1) { 218 var abc = null; 219 daojishi(that, abc); 220 $('[name="email_code"]').val(res.data.code); 221 222 } 223 }) 224 // } else { 225 // msg($(this).attr('data-msg1')); 226 // } 227 }) 228 $('[data-session]').on('click', function () { 229 if ($(this).attr('data-session-action') == 0) return false; 230 var url = $('[data-session-url]').attr('data-session-url'); 231 var data = $(this).attr('data-session').split('#'); 232 var reload = $(this).attr('data-reload'); 233 if (reload != undefined) { 234 msg_receive() 235 } 236 var form = {}; 237 form[data[0]] = data[1]; 238 $.post(url, form, function () { 239 if (reload != undefined) { 240 do_init(1, 1); 241 } 242 }) 243 }) 244 $('[data-action]').on('click', function () { 245 var url = $(this).attr('data-action'); 246 check_login(url); 247 var confirm = $(this).attr('data-bs-target'); 248 var loading_msg = $(this).attr('data-loading'); 249 var jump = $(this).attr('data-jump'); 250 var relation = $(this).attr('data-relation'); 251 if (confirm != undefined && confirm != '') { 252 var confirm_storm = $('[data-confirm-confirm-btn]'); 253 confirm_storm.attr('data-action', $(this).attr('data-action')).attr('data-data', $(this).attr('data-data')).attr('onclick', 'data_action(this)'); 254 $('.confirm-title').html($(this).attr('data-confirm-title')); 255 $('.confirm-content').html($(this).attr('data-confirm-content')); 256 if (jump != undefined) confirm_storm.attr('data-jump', jump); 257 if (loading_msg != undefined) confirm_storm.attr('data-loading', loading_msg); 258 return false; 259 } 260 msg_receive(loading_msg) 261 if (loading_msg == undefined) { 262 loading_msg = $('[data-msg-loading]').attr('data-msg-loading'); 263 } 264 var form = {}; 265 if ($(this).attr('data-data') != undefined) { 266 var data_storm = $(this).attr('data-data').split(','); 267 for (var i in data_storm) { 268 var data = data_storm[i].split('#'); 269 form[data[0]] = data[1] 270 } 271 } 272 var that = this; 273 $.post(url, form, function (res) { 274 msg(res.info); 275 if (jump != '' && res.code == 1) { 276 sessionStorage.setItem("need-refresh", true); 277 if (jump == 'reload') { 278 do_init(1000, 1) 279 } else if (jump == 'top') { 280 if (res.data.is_top == 1) { 281 $(that).find('.top-checked').css({color: '#eaaa85'}) 282 } else { 283 $(that).find('.top-checked').css({color: '#000'}) 284 } 285 $(that).find('.top_num').html(res.data.top_num); 286 287 } else if (jump == 'relation') { 288 do_relation(form); 289 } else { 290 window.location.href = jump; 291 } 292 293 } 294 }) 295 296 }) 297 $('[data-collect]').on('click', function () { 298 collect_action(this, $(this).attr('data-mobile')); 299 }) 300 $('[data-cart]').on('click', function () { 301 cart_action(this); 302 }) 303 $('[data-phone-code]').on('click', function () { 304 var field = $(this).attr('data-field').split(','); 305 var mobile = ''; 306 for (var i in field) { 307 mobile += ($('[name="' + field[i] + '"]').val()).toString(); 308 } 309 var url = $(this).attr('data-url'); 310 var that = this; 311 if (mobile == '') { 312 msg($(this).attr('data-msg1')); 313 return false;
314 } 315 if (mobile.length != 11) { 316 msg($(this).attr('data-msg2')); 317 return false 318 } 319 msg_receive($(this).attr('data-loading')); 320 var type = $(this).attr('data-type'); 321 $.post(url, {mobile: mobile, time: (new Date()).toTimeString(), type: type}, function (res) { 322 msg(res.info) 323 if (res.code == 1) { 324 var bcd = null 325 daojishi(that, bcd); 326 $('[name="phone_code"]').val(res.data.code); 327 328 } 329 }) 330 }) 331 $('[data-forget-code]').on('click', function () { 332 var val = $('[name="' + $(this).attr('data-field') + '"]').val(); 333 var regx = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/; 334 var type = $(this).attr('data-type'); 335 if (val == '') { 336 msg($(this).attr('data-msg1')) 337 return false; 338 } 339 var url = $(this).attr('data-url-phone'); 340 if (!regx.test(val)) { 341 if (val.length != 11) { 342 msg($(this).attr('data-msg2')) 343 return false; 344 } 345 msg_receive($(this).attr('data-phone-loading')); 346 } else { 347 url = $(this).attr('data-url-email'); 348 msg_receive($(this).attr('data-email-loading')); 349 $('[name="forget_type"]').val('email'); 350 } 351 var that = this; 352 $.post(url, {email: val, mobile: val, time: (new Date()).toTimeString(), type: type}, function (res) { 353 msg(res.info) 354 if (res.code == 1) { 355 var exc = null 356 daojishi(that, exc); 357 $('[name="account_code"]').val(res.data.code); 358 359 } 360 }) 361 }) 362 $('[data-spec]').on('click', function () { 363 if ($(this).hasClass('spec-disabeld')) return false; 364 $('.spec-item').removeClass('spec-active').addClass('spec').find('.radio-storm').css('background', 'none'); 365 var id = ($(this).attr('data-item-id')); 366 $(this).addClass('spec-active').removeClass('spec'); 367 $('.radio-checked').removeClass('radio-checked').addClass('radio'); 368 $('[data-raido-id="' + id + '"]').addClass('radio-checked').removeClass('radio'); 369 $('.goods_price').html($(this).attr('data-price')); 370 var max_num = 9999; 371 var is_only = $(this).attr('data-is_only'); 372 if (is_only == 1) { 373 var stock = $(this).attr('data-stock'); 374 console.log(stock); 375 max_num = stock; 376 $('.cart-plus-minus-box').attr('data-max-num', max_num); 377 } 378 $(this).find('.radio-storm').css('background', '#FFF'); 379 $('[data-input-cart]').attr('name', 'cart_num_' + id).val(1); 380 }) 381 $('[data-min-num]').on('keyup', function () { 382 var val = parseInt($(this).val()); 383 val = isNaN(val) ? 1 : val; 384 var n = parseInt($(this).attr('data-min-num')); 385 if (val <= n) { 386 $(this).val(n); 387 } else { 388 $(this).val(val); 389 } 390 }) 391 $('[data-max-num]').on('keyup', function () { 392 var val = parseInt($(this).val()); 393 val = isNaN(val) ? 1 : val; 394 var n = parseInt($(this).attr('data-max-num')); 395 if (val > n) { 396 $(this).val(n); 397 } else { 398 $(this).val(val); 399 } 400 }) 401 $('[data-tips-image]').on('click', function () { 402 var src = $(this).attr('src'); 403 $('[data-img-active]').attr('src', src); 404 }) 405 $('[data-num]').on('keyup', function () { 406 var val = $(this).val(); 407 408 val = val.replace(/[^\d.]/g, ""); 409 var n = parseInt($(this).attr('data-num')); 410 if (val.length > n) val = val.substring(0, n); 411 $(this).val(val); 412 413 }) 414 $('[data-storm]').on('click', function () { 415 416 var is_html = 1; 417 if ($(this).find('.address-active')[0] != undefined) { 418 if (!$(this).find('.address-active').hasClass('active-checked')) { 419 sessionStorage.setItem("need-refresh", true); 420 is_html = 0; 421 $(this).parent().find('.address-active').removeClass('active-card').removeClass('active-checked'); 422 $(this).find('.address-active').addClass('active-card').addClass('active-checked'); 423 $(this).parent().find('.active').removeClass('hide'); 424 $(this).find('.active').addClass('hide'); 425 $(this).parent().parent().find('.card-pay').addClass('hide').removeClass('active-checked'); 426 $(this).find('.card-pay').removeClass('hide'); 427 $('[name="pay_code"]').val(''); 428 var url = $(this).attr('data-url'); 429 var id = $(this).attr('data-id'); 430 $.post(url, {id: id}, function (res) { 431 // msg(res.info); 432 if (res.code == 1 && is_html == 0) { 433 do_init(1, 1); 434 } 435 }) 436 } 437 } else if ($(this).attr('data-coupons') == 1) { 438 $(this).parent().find('.coupon-b').removeClass('reds').addClass('orang'); 439 $(this).find('.coupon-b').addClass('reds').removeClass('orang'); 440 $(this).parent().find('.coupon-c').removeClass('red-color').addClass('orang-color'); 441 $(this).find('.coupon-c').addClass('red-color').removeClass('orang-color'); 442 $(this).parent().find('.coupon-n').removeClass('red-btn').addClass('orang-btn').html($(this).attr('data-u')); 443 $(this).find('.coupon-n').addClass('red-btn').removeClass('orang-btn').html($(this).attr('data-c')); 444 var is_html = 1; 445 var url = $(this).attr('data-url'); 446 var id = $(this).attr('data-id'); 447 $.post(url, {id: id}, function (res) { 448 // msg(res.info); 449 if (res.code == 1 && is_html == 1) { 450 do_init(1, 1); 451 } 452 }) 453 } else { 454 msg_receive(); 455 var url = $(this).attr('data-url'); 456 var id = $(this).attr('data-id'); 457 $.post(url, {id: id}, function (res) { 458 // msg(res.info); 459 if (res.code == 1 && is_html == 1) { 460 do_init(1, 1); 461 } 462 }) 463 } 464 465 }) 466 $('[data-hide-storm]').on('click', function () { 467 var url = $(this).attr('data-url'); 468 var id = $(this).attr('data-id'); 469 $.post(url, {id: id}, function (res) { 470 471 }) 472 }) 473 // $('[data-reload]').on('click', function () { 474 // msg_receive(); 475 // setTimeout(function () { 476 // do_init(); 477 // },200) 478 // }) 479 $('[data-form]').on('click', function () { 480 481 482 var that=this; 483 var form = $('#' + $(this).attr('data-form')); 484 var data = form.serialize(); 485 var url = form.attr('data-url'); 486 if(url.indexOf('login')<0){ 487 check_login(); 488 } 489 var confirm = $(this).attr('data-bs-target'); 490 var loading_msg = $(this).attr('data-loading'); 491 if (confirm != undefined && confirm != '') { 492 var confirm_storm = $('[data-confirm-confirm-btn]'); 493 confirm_storm.attr('data-form', $(this).attr('data-form')).attr('onclick', 'action_form(this)'); 494 $('.confirm-title').html($(this).attr('data-confirm-title')); 495 $('.confirm-content').html($(this).attr('data-confirm-content')); 496 var is_jump = $(this).attr('data-is_jump'); 497 if (is_jump != undefined) confirm_storm.attr('data-is_jump', is_jump); 498 if (loading_msg != undefined) confirm_storm.attr('data-loading', loading_msg) 499 return false;
500 } 501 $(this).attr('disabled','disabled'); 502 if (loading_msg == undefined) { 503 loading_msg = $('[data-msg-loading]').attr('data-msg-loading'); 504 } 505 msg_receive(loading_msg); 506 $.post(url, data, function (res) { 507 $(that).removeAttr('disabled'); 508 msg(res.info) 509 if (res.code == 1) { 510 if(res.data!='{-null-}' && res.data.link!='' && res.data.link!='back'){ 511 window.location.href = res.data.link; 512 return false; 513 } 514 sessionStorage.setItem("need-refresh", true); 515 var is_jump = form.attr('data-is_jump'); 516 setTimeout(function () { 517 if (is_jump == 0) { 518 setTimeout(function(){ 519 history.go(-1); 520 },500) 521 return false; 522 } 523 if (is_jump == 'reload') { 524 setTimeout(function(){ 525 do_init(1, 1); 526 },300) 527 }else if(is_jump=='reload_top'){ 528 do_init(1, 1) 529 setTimeout(function(){ 530 $('#scrollUp').click(); 531 },500) 532 } else { 533 if (res.data != '{-null-}') { 534 window.location.href = res.data.link; 535 536 } 537 } 538 }, 2500) 539 } 540 }) 541 }) 542 $('[data-confirm-cancel-btn]').on('click', function () { 543 $('.close-btn').click(); 544 }) 545 $('[data-float-l]').on('click', function () { 546 var r = $('.float-storm').css('right'); 547 if ($(this).attr('data-float-l') == 'abc') { 548 $(this).hide(); 549 } else { 550 $('[data-float-l]').show(); 551 } 552 if (r == '-60px') { 553 $('.float-storm').css('right', '10px'); 554 } else { 555 556 $('.float-storm').css('right', '-60px'); 557 } 558 }) 559 $('[data-confirm-confirm-btn]').on('click', function () { 560 $('.close-btn').click(); 561 }) 562 $('[data-score]').on('mousemove', function () { 563 var score = $(this).attr('data-score'); 564 var id = $(this).attr('data-item'); 565 $('[data-item="' + id + '"]').each(function (i) { 566 if (i < score) { 567 $(this).attr('class', 'fa fa-star') 568 } else { 569 $(this).attr('class', 'fa fa-star-o') 570 } 571 }) 572 }) 573 $('[data-score]').on('mouseout', function () { 574 var id = $(this).attr('data-item'); 575 var score = $("[data-score-item='" + id + "']").val(); 576 console.log(score); 577 $('[data-item="' + id + '"]').each(function (i) { 578 if (i < score) { 579 $(this).attr('class', 'fa fa-star') 580 } else { 581 $(this).attr('class', 'fa fa-star-o') 582 } 583 }) 584 }) 585 $('[data-score]').on('click', function () { 586 var score = $(this).attr('data-score'); 587 var id = $(this).attr('data-item'); 588 $("[data-score-item='" + id + "']").val(score); 589 $('[data-item="' + id + '"]').each(function (i) { 590 if (i < score) { 591 $(this).attr('class', 'fa fa-star') 592 } else { 593 $(this).attr('class', 'fa fa-star-o') 594 } 595 }) 596 }) 597 $('[data-copy]').on('click', function () { 598 const str = $(this).attr('data-copy'); 599 console.log(str); 600 const inputo = document.createElement("input"); 601 document.body.appendChild(inputo); 602 inputo.value = str; 603 inputo.setAttribute('readOnly', 'readOnly') 604 inputo.select(); 605 document.execCommand("Copy"); 606 document.body.removeChild(inputo); 607 msg($(this).attr('data-msg')); 608 }); 609 $('[data-file]').on('click', function () { 610 var url = $(this).attr('data-file'); 611 var id = $(this).attr('data-file-id'); 612 $(this).parent().append('<input accept="image/*" data-file-storm="' + id + '" data-file-change multiple="multiple" data-url="' + url + '" type="file" style="display: none" />'); 613 $('[data-file-change]').click(); 614 $('[data-file-change]').on('change', function () { 615 $(this).remove(); 616 var files = $(this).prop('files'); 617 var data = new FormData(); 618 var id = $(this).attr('data-file-storm'); 619 var url = $(this).attr('data-url'); 620 setTimeout(function () { 621 for (var i = 0; i < files.length; i++) { 622 data.append('file', files[i]); 623 upload(url, data, function (res) { 624 $('[data-file-id="' + id + '"]').before('<div class="img-thumb" data-thumb-id="' + id + '" data-value="' + res.data.url + '" ><img class="del-img" src="/static/home/image/del.png" alt=""><img style="width:100%;height:100%" src="' + res.data.url + '" alt=""></div>') 625 var img = ''; 626 $('[data-thumb-id="' + id + '"]').each(function () { 627 img += $(this).attr('data-value') + '|'; 628 $('[data-image-item="' + id + '"]').val(img); 629 }) 630 $('.del-img').on('click', function () { 631 $(this).parent().remove(); 632 var img = ''; 633 $('[data-thumb-id="' + id + '"]').each(function () { 634 img += $(this).attr('data-value') + '|'; 635 }) 636 $('[data-image-item="' + id + '"]').val(img); 637 }) 638 }) 639 } 640 }, 100) 641 }) 642 }) 643 $('[data-jump-storm]').on('click',function(){ 644 var url=$(this).attr('data-jump-storm'); 645 setTimeout(function(){ 646 location.href=url; 647 },300) 648 }) 649 $('[data-cate-storm]').on('click', function () { 650 var hes = $('#cate-id').height(); 651 if (hes == 0) { 652 $('#cate-id').css({'max-height': '100vh','height':'100vh'}); 653 $('body').append('<div id="float-back" onclick="close_cate(this)" style="position:fixed;top:0;left:0;width:100%;height:100%;background:#000;opacity: .75;z-index:49;"></div>') 654 $('#cate-hide').hide(); 655 var open = $(this).attr('data-open'); 656 $('.cs-clear').addClass('hide'); 657 $('.cs-checked').removeClass('hide'); 658 if (open != undefined) { 659 $(this).html(open); 660 } 661 $('body').css({'overflow': 'hidden'}) 662 } else { 663 $('#cate-id').css({'max-height': 0,'height':0}); 664 var close = $(this).attr('data-close'); 665 if (close != undefined) { 666 $(this).html(close); 667 } 668 setTimeout(function () { 669 if ($('#cate-hide').find('[data-cate-storm]').html() != '') { 670 $('.cs-checked').addClass('hide'); 671 $('.cs-clear').removeClass('hide'); 672 $('#cate-hide').show(); 673 $('[data-height-max]').css({'height': '55px'}); 674 } else { 675 $('[data-height-max]').css({'height': '35px'}); 676 $('.cs-clear').addClass('hide'); 677 } 678 $('#float-back').remove(); 679 }, 300) 680 $('body').css({'overflow': 'auto'}) 681 } 682 }) 683 $('[data-search]').on('click', function () { 684 var right = $('.search-storm').css('right'); 685 if (right == '-2060px') { 686 $('.search-storm').css('right', '-50px'); 687 $('.position-relative').css('padding-bottom', '10px'); 688 } else { 689 $('.search-storm').css('right', '-2060px'); 690 $('.position-relative').css('padding-bottom', '0'); 691 } 692 693 }) 694 $('.del-img').on('click', function () { 695 $(this).parent().remove(); 696 var id = $(this).attr('data-img-storm-id'); 697 console.log(id) 698 var img = ''; 699 $('[data-thumb-id="' + id + '"]').each(function () { 700 img += $(this).attr('data-value') + '|'; 701 }) 702 $('[data-image-item="' + id + '"]').val(img); 703 }) 704 var three_content_height = $("#three_content").height(); 705 $('#twitter').css('height', (three_content_height) + 'px'); 706 $('.twitter').css('height', (three_content_height) + 'px'); 707 $('[data-dingxiu]').on('click', function () { 708 $('#exampleModal').show(); 709 }) 710}) 711 712function upload(url, $data, callback) { 713 msg_receive($('[data-upload-loading]').attr('data-upload-loading')); 714 var that = this; 715 $.ajax({ 716 type: 'post', 717 url: url, 718 dataType: 'json', 719 data: $data, 720 async: true, 721 cache: false, 722 processData: false, 723 contentType: false, 724 success: function (data) { 725 msg(data.info); 726 setTimeout(function () { 727 if (typeof callback === 'function' && callback.call(that, data) === false) return false;
728 }, 300) 729 }, 730 error: function (data) { 731 $.hideLoading(); 732 msg('å è½½å¼å¸¸'); 733 } 734 }); 735} 736 737function daojishi(othis, index) { 738 var t = 60; 739 clearInterval(index); 740 var cl=$(othis).attr('data-class')==undefined?'span-btn':$(othis).attr('data-class'); 741 console.log(cl); 742 index = setInterval(function () { 743 if (t == 0) { 744 $(othis).attr('disabled', false).attr('class', cl).html($(othis).attr('title')); 745 clearInterval(index); 746 } else { 747 var title=$(othis).attr('title'); 748 var ts=t; 749 if(title!=undefined && title.length>0){ 750 ts=title+'ã¾ã§'+'('+t+')ç§'; 751 } 752 $(othis).attr('disabled', 'disabled').attr('class', cl+' '+cl+'-disabeld').html(ts); 753 t--; 754 } 755 756 }, 1000) 757} 758 759function msg(msg, time = 2500) { 760 $('#msg').remove(); 761 $('#loading-gif').remove(); 762 $('body').append('<div id="msg" class="toast-storm"><div class="toast-flit"></div><div class="toast-msg" >' + msg + '</div></div>') 763 setTimeout(function () { 764 $('#msg').css('bottom', '55%'); 765 }, 100) 766 setTimeout(function () { 767 $('#msg').css('bottom', '-50px'); 768 setTimeout(function () { 769 $('#msg').remove(); 770 }, 100) 771 }, time) 772 return false; 773} 774 775function msg_receive(msg) { 776 $('body').append('<div id="loading-gif" style="position:fixed;top:30%;width: 100%;text-align: center;z-index:99999;">\n' + 777 ' <img src="/static/home/image/wait.gif" style="width:125px;height:auto;border-radius:12px;opacity: .95;" alt="">\n' + 778 '</div>') 779} 780 781function msg_clear() { 782 $('#loading-gif').remove(); 783 $('#msg').remove(); 784} 785 786function check_login() { 787 $.post(location.origin + '/index/common/create_history', {url: location.pathname + location.search}, function (res) { 788 if(res.code==1){ 789 msg_clear(); 790 window.location.href = '/index/login/index?history=' + res.data; 791 return false; 792 } 793 }) 794 795} 796 797function data_action(othis) { 798 var url = $(othis).attr('data-action'); 799 msg_receive(); 800 check_login(url); 801 var form = {}; 802 var jump = $(othis).attr('data-jump'); 803 if ($(othis).attr('data-data') != undefined) { 804 var data_storm = $(othis).attr('data-data').split(','); 805 for (var i in data_storm) { 806 var data = data_storm[i].split('#'); 807 form[data[0]] = data[1] 808 } 809 } 810 console.log(jump); 811 $.post(url, form, function (res) { 812 msg(res.info); 813 if (jump != '' && res.code == 1) { 814 sessionStorage.setItem("need-refresh", true); 815 if (jump == 'reload') { 816 do_init(1, 1) 817 } else if (jump == 'relation') { 818 do_relation(form); 819 } else { 820 window.location.href = jump; 821 } 822 } 823 }) 824} 825 826function action_form(othis) { 827 $(othis).attr('disabled','disabled'); 828 var form = $('#' + $(othis).attr('data-form')); 829 var data = form.serialize(); 830 var url = form.attr('data-url'); 831 console.log(url, '#' + $(othis).attr('data-form')); 832 var loading_msg = $(othis).attr('data-loading'); 833 if (loading_msg == undefined) { 834 loading_msg = $('[data-msg-loading]').attr('data-msg-loading'); 835 } 836 msg_receive(loading_msg); 837 $.post(url, data, function (res) { 838 839 msg(res.info); 840 sessionStorage.setItem("need-refresh", true); 841 $(othis).removeAttr('disabled'); 842 if (res.code == 1) { 843 var is_jump = form.attr('data-is_jump'); 844 845 if (is_jump == 'reload') { 846 setTimeout(function(){ 847 do_init(1, 1); 848 },300) 849 } else if (is_jump == 'relation') { 850 do_relation(form); 851 } else { 852 853 if (is_jump == 0) { 854 setTimeout(function(){ 855 history.go(-1); 856 },500) 857 } else { 858 window.location.href = res.data.link; 859 } 860 861 } 862 } 863 }) 864} 865 866function collect_action(that, is_mobile) { 867 var url = $(that).attr('data-collect'); 868 check_login(url); 869 var data_storm = $(that).attr('data-data').split(','); 870 var form = {}; 871 for (var i in data_storm) { 872 var data = data_storm[i].split('#'); 873 form[data[0]] = data[1] 874 } 875 $.post(url, form, function (res) { 876 msg(res.info); 877 if (is_mobile == 1) { 878 do_init(1000, 1) 879 } 880 if (res.code == 1 || res.code == 2) { 881 var n = $('[data-collect-num]').attr('data-collect-num'); 882 if (res.code == 1) { 883 $('[data-collect-id="' + form['id'] + '"]').addClass('wishlist'); 884 n++; 885 } 886 if (res.code == 2) { 887 $('[data-collect-id="' + form['id'] + '"]').removeClass('wishlist'); 888 $('[data-collect-id-action="' + form['id'] + '"]').remove(); 889 n--; 890 } 891 var ns = n <= 9 ? ('0' + n) : n; 892 if (n == 0) { 893 $('#collect-goods').html(' <div class="empty-text-contant text-center">\n' + 894 ' <i class="pe-7s-shopbag"></i>\n' + 895 ' <h3>' + $('[data-collect-title]').attr('data-collect-title') + '</h3>\n' + 896 ' </div>'); 897 $('[data-collect-num]').addClass('hide').html(ns).attr('data-collect-num', n); 898 $('[data-collect-button]').hide(); 899 } else { 900 $('[data-collect-num]').removeClass('hide').html(ns).attr('data-collect-num', n); 901 $('[data-collect-button]').show(); 902 } 903 904 } 905 }) 906} 907 908function cart_action(that) { 909 var url = $(that).attr('data-cart'); 910 msg_receive(); 911 check_login(url); 912 var id = $(that).attr('data-cart-id'); 913 var item_id = $(that).attr('data-item-id'); 914 if (item_id == undefined) item_id = $('.spec-active').attr('data-item-id'); 915 916 var cart_num = $('[name="cart_num_' + item_id + '"]').val(); 917 console.log(cart_num); 918 console.log(cart_num); 919 console.log($(that).parent()[0]); 920 var is_add = $(that).attr('data-is_add'); 921 var subscribe=$(that).attr('data-subscribe');
922 if(subscribe==undefined) subscribe=0; 923 $.post(url, {id: id, item_id: item_id, num: cart_num, is_add: is_add,subscribe:subscribe}, function (res) { 924 if (res.info != '') { 925 msg(res.info); 926 } else { 927 msg_clear(); 928 } 929 if (res.code == 1 || res.code == 2) { 930 var n = res.data.cart_num || 0; 931 if (res.code == 2) { 932 $('[data-cart-id-action="' + item_id + '"]').remove(); 933 } 934 var ns = n <= 9 ? ('0' + n) : n; 935 if (n == 0) { 936 $('[data-nomark]').removeClass('hide'); 937 $('[data-mark]').addClass('hide'); 938 $('.cart-goods-storm').html('<div class="empty-text-contant text-center">\n' + 939 ' <i class="pe-7s-shopbag"></i>\n' + 940 ' <h3>' + $('[data-cart-title]').attr('data-cart-title') + '</h3>\n' + 941 ' </div>'); 942 943 $('[data-cart-num]').addClass('hide').html(ns).attr('data-cart-num', n); 944 $('[data-cart-button]').hide(); 945 } else { 946 $('[data-nomark]').addClass('hide'); 947 $('[data-mark]').removeClass('hide'); 948 $('[data-cart-num]').removeClass('hide').html(ns).attr('data-cart-num', n); 949 $('[data-cart-button]').show(); 950 } 951 sessionStorage.setItem("need-refresh", true); 952 if ($('[data-dopay]').attr('data-dopay') == 1) { 953 do_pay(); 954 } 955 } 956 }) 957} 958 959function data_action_storm(othis) { 960 var url = $(othis).attr('data-action'); 961 check_login(url); 962 var confirm = $(othis).attr('data-bs-target'); 963 var loading_msg = $(othis).attr('data-loading'); 964 965 966 if (confirm != undefined && confirm != '') { 967 var confirm_storm = $('[data-confirm-confirm-btn]'); 968 confirm_storm.attr('data-action', $(othis).attr('data-action')).attr('data-data', $(othis).attr('data-data')).attr('onclick', 'data_action(this)'); 969 $('.confirm-title').html($(othis).attr('data-confirm-title')); 970 $('.confirm-content').html($(othis).attr('data-confirm-content')); 971 var jump = $(othis).attr('data-jump'); 972 if (jump != undefined) confirm_storm.attr('data-jump', jump); 973 if (loading_msg != undefined) confirm_storm.attr('data-loading', loading_msg); 974 return false; 975 } 976 if (loading_msg == undefined) { 977 loading_msg = $('[data-msg-loading]').attr('data-msg-loading'); 978 } 979 msg_receive(loading_msg) 980 var data_storm = $(othis).attr('data-data').split(','); 981 var form = {}; 982 var jump = $(othis).attr('data-jump'); 983 for (var i in data_storm) { 984 var data = data_storm[i].split('#'); 985 form[data[0]] = data[1] 986 } 987 $.post(url, form, function (res) { 988 msg(res.info); 989 setTimeout(function(){ 990 if (jump != '' && res.code == 1) { 991 sessionStorage.setItem("need-refresh", true); 992 993 if (jump == 'reload') { 994 do_init(800, 1); 995 } else if (jump == 'relation') { 996 do_relation(form); 997 } else { 998 window.location.href = jump; 999 } 1000 } 1001 },2500) 1002 }) 1003} 1004 1005function close_cate(othis) { 1006 $('#cate-id').css({'max-height': 0,'height':0}); 1007 1008 setTimeout(function () { 1009 if ($('#cate-hide').find('[data-cate-storm]').html() != '') { 1010 $('#cate-hide').show(); 1011 $('[data-height-max]').css({'height': '55px'}); 1012 } else { 1013 $('[data-height-max]').css({'height': '35px'}); 1014 } 1015 $('#float-back').remove(); 1016 }, 300) 1017 $('body').css({'overflow': 'auto'}) 1018} 1019 1020function data_img(othis) { 1021 var parent = $(othis).parent().parent().parent(); 1022 var key = parseInt($(othis).attr('data-img-thumb')); 1023 var str = ''; 1024 var str_min = ''; 1025 parent.find('[data-img-thumb]').each(function () { 1026 str += ' <div class="swiper-slide preview">\n' + 1027 ' <img class="img-responsive m-auto" src="' + $(this).attr('src') + '" alt="">\n' + 1028 ' </div>'; 1029 str_min += ' <div class="swiper-slide preview-min"><img class="img-responsive m-auto" src="' + $(this).attr('src') + '" alt="">\n' + 1030 ' </div>'; 1031 }) 1032 $('.preveiw-max').html(str); 1033 if (parent.find('[data-img-thumb]').length > 1) { 1034 $('.preveiw-min').html(str_min).show(); 1035 } else { 1036 $('.preveiw-min').hide(); 1037 } 1038 $('.swiper-preview-image').css({'opacity': '1', 'z-index': '9999999'}); 1039 sn.slideTo(key, 0, false); 1040 $('body').css({'overflow': 'hidden'}) 1041} 1042 1043function money_formats($money) { 1044 if ($money >= 1000 && $money < 1000000) { 1045 $m = ($money / 1000).toString().replace('.', ','); 1046 $m = $m.split(','); 1047 1048 if ($m[1] == undefined) { 1049 $m[1] = '000'; 1050 } else { 1051 if ($m[1].length == 1) $m[1] = $m[1] + '00'; 1052 if ($m[1].length == 2) $m[1] = $m[1] + '0'; 1053 } 1054 return $m[0] + ',' + $m[1]; 1055 } 1056 if ($money >= 1000000 && $money < 1000000000) { 1057 $ms = ($money / 100000).toString().replace('.', ','); 1058 $ms = $ms.split(','); 1059 if ($ms[1] != undefined) { 1060 $ms[1] = '000,000'; 1061 } else { 1062 $m = ($ms[1] / 1000).toString().replace('.', ','); 1063 $m = $m.split(','); 1064 if ($m[1] == undefined) { 1065 $m[1] = '000'; 1066 } else { 1067 if ($m[1].length == 1) $m[1] = $m[1] + '00'; 1068 if ($m[1].length == 2) $m[1] = $m[1] + '0'; 1069 } 1070 1071 $ms[1] = $m[0] + ',' + $m[1]; 1072 } 1073 1074 return $ms[0] + ',' + $ms[1]; 1075 } 1076 return $money; 1077} 1078 1079function check_num(othis) { 1080 var val = parseInt($(othis).val()); 1081 console.log(val); 1082 val = isNaN(val) ? 1 : val; 1083 var n = parseInt($(this).attr('data-min-num')); 1084 var ns = parseInt($(this).attr('data-max-num')); 1085 if (val <= n) { 1086 $(othis).val(n); 1087 } else if (val >= ns) { 1088 $(othis).val(ns); 1089 } else { 1090 $(othis).val(val); 1091 } 1092}
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.