1(function (window) { 2 var ys = {}; 3 if (window.ys) { 4 ys = window.ys 5 }; 6 var lenis; 7 // æ»å¨æ¡éè䏿¾ç¤º 8 var scrollbar = { 9 $html: $("html"), 10 $body: $("body"), 11 originalBodyPad: null, 12 scrollbarWidth: 0, 13 hide: function () { 14 this.$body = $("body"); 15 this.checkScrollbar(); 16 this.setScrollbar(); 17 this.$html.css("overflow", "hidden"); 18 // if (this.isMobileSafari()) { 19 // this.$html.css({ 20 // width: "100%", 21 // position: "fixed" 22 // }); 23 // } 24 }, 25 show: function () { 26 this.$body = $("body"); 27 this.$html.removeAttr("style"); 28 this.resetScrollbar(); 29 }, 30 checkScrollbar: function () { 31 var fullWindowWidth = window.innerWidth 32 if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8 33 var documentElementRect = document.documentElement.getBoundingClientRect(); 34 fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left); 35 } 36 this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth; 37 this.scrollbarWidth = this.measureScrollbar(); 38 }, 39 setScrollbar: function () { 40 var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) 41 this.originalBodyPad = document.body.style.paddingRight || '' 42 if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this 43 .scrollbarWidth) 44 }, 45 measureScrollbar: function () { 46 var scrollDiv = document.createElement('div'); 47 scrollDiv.style.position = "absolute"; 48 scrollDiv.style.top = "-9999px"; 49 scrollDiv.style.width = "50px"; 50 scrollDiv.style.height = "50px"; 51 scrollDiv.style.overflow = "scroll"; 52 53 this.$body.append(scrollDiv); 54 var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; 55 this.$body[0].removeChild(scrollDiv); 56 return scrollbarWidth; 57 }, 58 resetScrollbar: function () { 59 this.$body.css('padding-right', 0); 60 }, 61 isMobileSafari: function () { 62 var ua = navigator.userAgent.toLowerCase(); 63 var isChrome = ua.indexOf("chrome") != -1; 64 var isSafari = ua.indexOf("safari") != -1; 65 var isMobile = ua.indexOf("safari") != -1; 66 67 if (!isChrome && isSafari && isMobile) { 68 return 1; 69 } else { 70 return 0; 71 } 72 } 73 }; 74 ys.scrollbar = scrollbar; 75 76 /** 77 * 78 * @description åå°é¡¶é¨ 79 * @param {Number} duration - æ¶é´(ms) 80 * 81 */ 82 function goTop(duration) { 83 var duration = duration || 500; 84 $("html,body").stop().animate({ 85 scrollTop: 0, 86 }, duration) 87 }; 88 ys.goTop = goTop; 89 90 /** 91 * 92 * @description 彿»å¨æ¡ç¦»å¼æé¡¶é¨ç»éæ©å ç´ å ä¸ä¸ªç±»åisfixed 93 * @param {String} selector - csséæ©å¨ 94 * 95 */ 96 function isFixed(selector) { 97 var $obj = $(selector); 98 $(function () { 99 judgeTop() 100 }); 101 $(window).on("scroll", judgeTop); 102 $(window).on("load", judgeTop); 103 $(window).on("resize", judgeTop); 104 105 function judgeTop() { 106 if ($(window).scrollTop() > 0) { 107 $obj.addClass("isfixed"); 108 } else { 109 $obj.removeClass("isfixed"); 110 } 111 } 112 } 113 ys.isFixed = isFixed; 114 115 /** 116 * 117 * @description bannerè½®æè§é¢åå§å 118 * @param {String} selector - csséæ©å¨ 119 * 120 */ 121 function banVideo(selector) { 122 var $obj = $(selector); 123 var autoplay = true; 124 if ($(window).width() > 1200 && $obj.find("video").length > 0) { 125 init(); 126
127 function init() { 128 firstVideo(); 129 videoEnd(); 130 afterChange(); 131 } 132 // æ£éªç¬¬ä¸å±æ¯å¦æè§é¢ 133 function firstVideo() { 134 var $firSlide = $obj.find(".slick-slide[data-slick-index=0]"); 135 var $video = $firSlide.find("video"); 136 // autoplayèªå¨ææ¾ 137 if ($video.length > 0) { 138 $obj.slick('slickPause'); 139 // å¦æè½®æåªæä¸ä¸ªå¾ªç¯ææ¾ 140 if ($obj.get(0).slick.slideCount < 2) { 141 $video.attr("loop", "loop"); 142 }; 143 if ($video.get(0).paused) { 144 setTimeout(function () { 145 $video.get(0).play(); 146 }, 100) 147 } 148 } else { 149 $obj.slick('slickPlay'); 150 } 151 } 152 // 忢å°ä¸ä¸å¼ æ¯å¦æè§é¢ 153 function afterChange() { 154 $obj.on('afterChange', function (event, slick, index) { 155 // è§é¢æåå¹¶åå°ç¬¬ä¸å¸§ 156 $obj.find("video").each(function () { 157 var video = $(this).get(0); 158 video.pause(); 159 video.currentTime = 0; 160 }); 161 // æè§é¢åæåè½®æ 162 var $nowSlide = $(slick.$slides[index]); 163 var $video = $nowSlide.find("video"); 164 if ($video.length > 0) { 165 $obj.slick('slickPause'); 166 $video.get(0).play(); 167 } else { 168 if (autoplay) { 169 $obj.slick('slickPlay'); 170 } 171 }; 172 }); 173 }; 174 // è§é¢æå®åæ¢å°ä¸ä¸å¼ 175 function videoEnd() { 176 $obj.find("video").each(function () { 177 var video = $(this).get(0); 178 video.onended = function () { 179 if (autoplay) { 180 $obj.slick("next"); 181 $obj.slick('slickPlay'); 182 } 183 }; 184 }); 185 }; 186 } else { 187 $obj.slick('play'); 188 }; 189 var banvideo = { 190 play: function () { 191 $obj.slick('slickPlay'); 192 autoplay = true; 193 }, 194 pause: function () { 195 autoplay = false; 196 $obj.slick('slickPause'); 197 } 198 } 199 return banvideo; 200 }; 201 ys.banVideo = banVideo; 202 203 /** 204 * 205 * @description 䏿鿩 206 * @param {String} selector - csséæ©å¨ 207 * 208 */ 209 function select(selector, callback) { 210 var $obj = $(selector); 211 $obj.find(".ys_select_li").each(function () { 212 var index = $(this).index(); 213 if ($(this).attr("data-id") == undefined) { 214 $(this).attr("data-id", index); 215 } 216 $(this).attr("data-value", $(this).text()); 217 }); 218 $obj.find(".ys_select_hd").click(function (e) { 219 e.stopPropagation(); 220 // var target = $(this).siblings(".ys_select_bd").get(0); 221 $(this).toggleClass("on"); 222 if ($(this).parents(".ys_select").hasClass("zindex")) { //æ¶å 223 $(this).siblings(".ys_select_bd").removeClass("showscroll"); 224 $(this).siblings(".ys_select_bd").stop().slideUp(function () { 225 $(this).parents(".ys_select").removeClass("zindex"); 226 }); 227 } else { //å±å¼ 228 var self = this; 229 setTimeout(function () { 230 $(self).parents(".ys_select").addClass("zindex"); 231 }, 200); 232 $(this).siblings(".ys_select_bd").stop().slideDown(function () { 233 $(this).mCustomScrollbar("update"); 234 $(this).addClass("showscroll"); 235 }); 236 } 237 238 $(".ys_select_hd").not(this).removeClass("on"); 239 $(".ys_select_hd").not(this).siblings(".ys_select_bd").removeClass("showscroll").stop().slideUp(); 240 var self = this; 241 setTimeout(function () { 242 $(".ys_select_hd").not(self).parents(".ys_select").removeClass("zindex"); 243 }, 200); 244 }) 245 $obj.find(".ys_select_bd").on("click", ".ys_select_li", function () { 246 var selectShow = $(this).text(); 247 var realVal = $(this).data("value"); 248 var data = $(this).data(); 249 $(this).parents(".ys_select_bd").siblings(".ys_select_hd").find(".ys_select_show").val(selectShow); 250 $(this).parents(".ys_select_bd").siblings(".ys_select_hd").find(".ys_select_real").attr("data-id", data.id).val(realVal).trigger("change"); 251 $(this).addClass("on").siblings().removeClass("on"); 252 if (callback) { 253 callback(data); 254 } 255 }); 256 // ç¹å»é¡µé¢å ³é 257 $("body").click(function () { 258 $(".ys_select_hd").removeClass("on"); 259 $(".ys_select_bd").removeClass("showscroll").stop().slideUp(function () { 260 $(this).parents(".ys_select").removeClass("zindex"); 261 }); 262 }); 263 // æ»å¨æ¡ 264 $obj.find(".ys_select_bd").mCustomScrollbar({ 265 axis: "y", 266 scrollInertia: 500, 267 theme: 'dark', 268 scrollbarPosition: "outside" 269 }); 270 }; 271 ys.select = select; 272 273 /** 274 *
275 * @description å¼¹çªèå± 276 * @param {String} btn å¼¹çªè§¦åæé®ï¼éæ©å¨ï¼ 277 * @param {String} modal 对åºå¼¹çªï¼éæ©å¨ï¼ 278 * @param {String} scrollEle æ»å¨æ¡å ç´ ï¼éæ©å¨ï¼ 279 * @param {Function} data æ°æ®å¯¹åº 280 * 281 */ 282 function modal(btn, modal, scrollEle, data) { 283 var $modal = $(modal); 284 // æ¾ç¤º 285 $("body").on("click", btn, function () { 286 var $btn = $(this); 287 $modal.stop().fadeIn(); 288 //æ°æ®å¤ç 289 if (data) { 290 appendData(data); 291 292 function appendData(data) { 293 $.each(data, function (index, item) { 294 var dataType = item[2]; 295 var $fromEle = $btn.find(item[0]).length > 0 ? $btn.find(item[0]) : $btn; 296 if (dataType == "text" || !dataType) { 297 $modal.find(item[1]).text($fromEle.text()); 298 }; 299 if (dataType == "img") { 300 $modal.find(item[1]).attr({ 301 "src": $fromEle.attr("src") 302 }); 303 }; 304 if (dataType == "attr") { 305 console.log(item[3], $fromEle); 306 $modal.find(item[1]).html($fromEle.attr(item[3])); 307 }; 308 if (dataType == "html") { 309 $modal.find(item[1]).html($fromEle.html()); 310 }; 311 }); 312 } 313 }; 314 scrollbar.hide(); 315 lenis.stop(); 316 }); 317 // å ³é 318 $("body").on("click", ".ys_modal_close", function () { 319 $(this).parents(modal).stop().fadeOut(function () { 320 scrollbar.show(); 321 lenis.start(); 322 if (data) { 323 $.each(data, function (index, item) { 324 $modal.find(item[1]).empty(); 325 }); 326 } 327 }); 328 }); 329 // æ»å¨æ¡ 330 var scrollEle = scrollEle ? scrollEle : ".ys_modal_content"; 331 if (scrollEle != "noscroll") { 332 $modal.find(scrollEle).mCustomScrollbar({ 333 axis: "y", 334 scrollInertia: 500, 335 theme: 'dark', 336 }); 337 } else { 338 $modal.find(".ys_modal_content").addClass("noscroll") 339 }; 340 341 }; 342 ys.modal = modal; 343 344 /** 345 * 346 * @description è§é¢å¼¹çª 347 * @param {selector} selector - csséæ©å¨ 348 * @param {Boolean} autoplay - æ¯å¦å¼¹çªèªå¨ææ¾video 349 * 350 */ 351 function videomodal(selector, autoplay) { 352 var $videomodal; 353 // æå ¥è§é¢æ¨¡ç 354 if ($(".ys_videom").length > 0) { 355 $videomodal = $(".ys_videom"); 356 } else { 357 var videomodal = 358 '<div class="ys_videom">' + 359 '<div class="ys_videom_container">' + 360 '<div class="ys_videom_close">' + 361 '<i class="iconfont icon-close"></i>' + 362 '</div>' + 363 '<div class="ys_videom_content">' + 364 '<div class="ys_videom_iframebox"></div>' + 365 '</div>' + 366 '</div>' + 367 '</div>'; 368 $videomodal = $(videomodal); 369 $("body").append($videomodal); 370 } 371 372 var Vmodal = { 373 $self: $videomodal, 374 close: function () { 375 scrollbar.show(); 376 lenis.start(); 377 $videomodal.hide(); 378 $videomodal.find(".ys_videom_video").remove(); 379 $videomodal.find(".ys_videom_iframebox").hide().find("iframe").remove(); 380 381 }, 382 show: function () { 383 scrollbar.hide(); 384 lenis.stop(); 385 $videomodal.show(); 386 } 387 } 388 389 $("body").on("click", selector, function () { 390 // è§é¢ç±»åæ¯videoè¿æ¯iframe 391 var videoType = $(this).attr("data-type"); 392 //src 393 var videoSrc = $(this).attr("data-src"); 394 if (videoType == "video") { // è§é¢ 395 if ($videomodal.find(".ys_videom_video").length > 0) { 396 $videomodal.find(".ys_videom_video").remove(); 397 } 398 //videoè§é¢å°é¢å¾ 399 var videoPoster = $(this).data("poster"); 400 var $video = $('<video playsinline x5-video-player-type="h5" controls class="ys_videom_video"></video>') 401 if ($(window).width() < 767 && videoSrc.indexOf("http") != -1) { 402 $video = $('<video muted playsinline x5-video-player-type="h5" controls class="ys_videom_video"></video>') 403 $video.get(0).muted = false; 404 } 405 $video.append($("<source src=" + videoSrc + ">")); 406 $video.attr("poster", videoPoster); 407 $videomodal.find(".ys_videom_content").append($video); 408 $video.stop().show(); 409 if (autoplay) { 410 $video.get(0).play(); 411 } 412 } else if (videoType == "iframe") { // iframe 413 $videomodal.find(".ys_videom_iframebox").stop().show().html(videoSrc); 414 } else { 415 return; 416 }; 417 Vmodal.show(); 418 }); 419 420 421 $videomodal.on("click", ".ys_videom_close", function () { 422 Vmodal.close(); 423 }); 424 } 425 ys.videomodal = videomodal; 426 427 /** 428 *
429 * @description æ»å¨æ¡åå§å 430 * @param {String} selector - csséæ©å¨ 431 * @param {Boolean} inside - æ»å¨æ¡å ç¨å å®¹åº 432 * @param {String} inside - æ»å¨æ¡æ¹å 433 * 434 */ 435 function mCustomScrollbarInit(selector, inside, axis) { 436 var $obj = $(selector); 437 scrollbarAxis = axis ? axis : "y"; 438 scrollbarPosition = inside ? "inside" : "outside"; 439 $obj.mCustomScrollbar({ 440 axis: scrollbarAxis, 441 scrollInertia: 500, 442 theme: 'dark', 443 scrollbarPosition: scrollbarPosition, 444 }); 445 }; 446 ys.mCustomScrollbarInit = mCustomScrollbarInit; 447 448 /** 449 * 450 * @description æ°åæ»å¨ 451 * @param {String} selector - csséæ©å¨ 452 * @param {Boolean} addZero - æ¯å¦è¡¥0 453 * @param {Number} speed - æ»å¨é度(ms) 454 * 455 */ 456 function numRoll(selector, addZero, speed) { 457 var $ele = $(selector); 458 var speed = speed || 1000; 459 $ele.appear(function () { 460 var realContent = $(this).text(); 461 $(this).width($(this).width()); 462 var content = $(this).data("to"); 463 if (!content) { 464 content = realContent; 465 }; 466 var to = parseFloat(content.toString().replace(/,/g, "")); 467 var length = parseInt(to).toString().length; 468 var hasDou = false; 469 var contentArr = content.toString().split(","); 470 if (contentArr[1]) { 471 hasDou = true; 472 }; 473 if (addZero) { 474 formatter = function (value, options) { 475 var myValue = value.toFixed(options.decimals); 476 var valLength = parseInt(myValue).toString().length; 477 for (var i = 0; i < (length - valLength); i++) { 478 myValue = "0" + myValue; 479 } 480 if (hasDou) { 481 myValue = toThousands(myValue); 482 } 483 return myValue; 484 } 485 } else { 486 formatter = function (value, options) { 487 var myValue = value.toFixed(options.decimals); 488 if (hasDou) { 489 myValue = toThousands(myValue); 490 } 491 return myValue; 492 } 493 } 494 495 496 function toThousands(num) { 497 return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'); 498 } 499 500 $(this).countTo({ 501 speed: speed, 502 refreshInterval: 60, 503 formatter: formatter, 504 onComplete: function () { 505 $(this).removeAttr("style"); 506 $(this).text(realContent); 507 } 508 }); 509 }); 510 } 511 ys.numRoll = numRoll; 512 513 514 /** 515 * 516 * @description è§£å³bshareä¹±ç 517 * @param {String} title - åäº«çæ é¢æå 518 * @param {String} summary - å享çå 容æå 519 * 520 */ 521 function shareInit(title, summary) { 522 var title = title ? encodeURI(title) : encodeURI($("h1").text()); 523 var summary = summary ? encodeURI(summary) : encodeURI($("p").eq(0).text().replace(" ", "")); 524 // bShare.addEntry({ 525 // title: title, 526 // summary: summary 527 // }); 528 // 微信 529 $(".ys_share_wechat").click(function () { 530 var $wechatpop; 531 // æå ¥å¾®ä¿¡å享äºç»´ç å¼¹çª 532 if ($(".ys_wechat").length > 0) { 533 $wechatpop = $(".ys_wechat"); 534 } else { 535 var wechatpop = 536 '<div class="ys_wechat">' + 537 '<div class="ys_wechat_cont">' + 538 '<div id="qrcode">' + 539 '<div class="ys_wechat_cont_parga">' + 540 '<p></p>' + 541 '</div>' + 542 '<div class="ys_wechat_cont_btn">' + 543 '<i class="iconfont icon-close"></i>' + 544 '</div>' + 545 '</div>' + 546 '</div>' + 547 '</div>'; 548 $wechatpop = $(wechatpop); 549 $("body").append($wechatpop); 550 }
551 var length = $(".ys_wechat_cont canvas").length; 552 console.log(length); 553 if (length > 0) { 554 $(".ys_wechat_cont canvas").remove(); 555 } 556 var urlho = window.location.href; 557 $('#qrcode').qrcode(urlho); 558 $(".ys_wechat").stop().fadeIn(); 559 scrollbar.hide(); 560 lenis.stop(); 561 562 $wechatpop.on("click", ".ys_wechat_cont_btn", function () { 563 $(".ys_wechat").stop().fadeOut(function () { 564 scrollbar.show(); 565 lenis.start(); 566 }); 567 }); 568 }) 569 // å¾®å 570 if ($(".ys_share_sinaminiblog").length > 0) { 571 var blogUrlf = (window.location.href); 572 var blogLink = 'https://service.weibo.com/share/share.php?url=' + blogUrlf + '&title=' + title + ' - ' + summary; 573 var blogTitle = $(".ys_share_sinaminiblog").attr("title"); 574 $(".ys_share_sinaminiblog").attr("title", blogTitle).css("cursor", "pointer").click(function () { 575 window.open(blogLink, "_blank"); 576 }); 577 } 578 // Twitter 579 if ($(".ys_share_twitter").length > 0) { 580 var twiUrlf = (window.location.href); 581 console.log(twiUrlf); 582 var twiLink = 'https://twitter.com/intent/tweet?text=' + title + " " + twiUrlf; 583 var twiTitle = $(".ys_share_twitter").attr("title"); 584 $(".ys_share_twitter").attr("title", twiTitle).css("cursor", "pointer").click(function () { 585 window.open(twiLink, "_blank"); 586 }); 587 } 588 // Facebook 589 if ($(".ys_share_facebook").length > 0) { 590 var faceUrlf = (window.location.href); 591 console.log(faceUrlf); 592 var faceLink = 'https://www.facebook.com/share.php?src=bm&u=' + faceUrlf; 593 var faceTtitle = $(".ys_share_facebook").attr("title"); 594 $(".ys_share_facebook").attr("title", faceTtitle).css("cursor", "pointer").click(function () { 595 window.open(faceLink, "_blank"); 596 }); 597 } 598 } 599 ys.shareInit = shareInit; 600 601 /** 602 * 603 * @description ä¾§è¾¹åºå® 604 * @param {String} nav - ä¾§è¾¹å¯¼èªæå¤é¢ççå 605 * @param {String} area - ä¾§è¾¹å¯¼èªæ¾ç¤ºçåºå 606 * 607 */ 608 function asideNav(nav, area) { 609 var nav = $(nav); 610 var area = $(area); 611 // åå§å 612 asideInit(); 613 // 页é¢å è½½å®éæ°åå§å 614 $(window).on("load", function () { 615 asideInit(); 616 }); 617 // 页é¢å°ºå¯¸æ¹åéæ°åå§å 618 $(window).resize(function () { 619 asideInit(); 620 }); 621 // æ»å¨äºä»¶çå¬ 622 $(window).scroll(function () { 623 getInto(); 624 }); 625 626 function getInto() { 627 var heightb = $(window).scrollTop(); 628 var contentTop = area.offset().top; 629 var contentBot = (contentTop + area.height()) - $(window).scrollTop() - nav.height(); 630 // console.log(heightb,contentTop,contentBot); 631 if (heightb > contentTop) { 632 nav.addClass('ys_fixed'); 633 } else { 634 nav.removeClass('ys_fixed'); 635 } 636 if (contentBot < 0) { 637 nav.addClass('ys_notfixed'); 638 639 } else { 640 nav.removeClass('ys_notfixed'); 641 } 642 } 643 644 function asideInit() { 645 getInto(); 646 } 647 } 648 ys.asideNav = asideNav; 649 /** 650 * 651 * @description ç§»å¨ç«¯å¯¼èªåå§å 652 * @param {Number} style - 653 * 654 */ 655 function phNavInit(style) { 656 switch (style) { 657 case 1: 658 phNavInit1(); 659 break; 660 case 2: 661 phNavInit2(); 662 break; 663 case 3: 664 phNavInit3(); 665 break; 666 case 4: 667 phNavInit4(); 668 break; 669 default: 670 phNavInit1(); 671 } 672 673 function phNavInit1() { 674 // menuæé®ç¹å» 675 $(".ys_phnav_menubtn").click(function () { 676 // æ¾ç¤ºéèæ»å¨æ¡ 677 if ($(this).hasClass("on")) { 678 ys.scrollbar.show(); 679 ys.lenisStart(); 680 } else { 681 ys.scrollbar.hide(); 682 ys.lenisStop(); 683 } 684 // æé®æ ·å¼ 685 $(this).toggleClass("on"); 686 // 䏿å±å¼ 687 $(".ys_phnav_menu").stop().slideToggle(); 688 }); 689 690 // navç¹å»å±å¼ 691 $(".ys_phnav_lisbox").click(function () { 692 var $subNav = $(this).siblings("ul"); 693 if ($subNav.length > 0) { 694 $(this).find(".ys_phnav_icon").toggleClass("on"); 695 $subNav.stop().slideToggle(); 696 } 697 $(this).parent().siblings().find("ul").stop().slideUp(); 698 $(this).parent().siblings().find(".ys_phnav_icon").removeClass("on"); 699 }); 700 701 $(".ys_phnav_lisbox a").click(function (e) { 702 e.stopPropagation(); 703 }); 704 } 705 706 function phNavInit2() { 707 // æç´¢ä¸æ 708 $(".ys_phnavss_btn").click(function (e) { 709 e.stopPropagation(); 710 $(".ys_phnavss_xl").stop().slideToggle(); 711 if ($(".ys_phnav_menubtn").hasClass("on")) { 712 $(".ys_phnav_menubtn").trigger("click"); 713 } 714 $(this).toggleClass("on"); 715 }); 716 $(".ys_phnavss_xl").click(function (e) { 717 e.stopPropagation(); 718 }); 719 $("body").click(function () { 720 $(".ys_phnavss_xl").stop().slideUp(); 721 }) 722 // menuæé®ç¹å» 723 $(".ys_phnav_menubtn").click(function (e) { 724 e.stopPropagation(); 725 if ($(".ys_phnavss_btn").hasClass("on")) { 726 $(".ys_phnavss_btn").trigger("click"); 727 } 728 // æ¾ç¤ºéèæ»å¨æ¡ 729 if ($(this).hasClass("on")) { 730 ys.scrollbar.show(); 731 ys.lenisStart(); 732 } else { 733 ys.scrollbar.hide(); 734 ys.lenisStop(); 735 $(".ys_phnav2_lang_modal").removeClass("on"); 736 } 737 // æé®æ ·å¼ 738 $(this).toggleClass("on"); 739 // 䏿å±å¼ 740 $(".ys_phnav_menu").toggleClass("on"); 741 }); 742 743 // navç¹å»å±å¼ 744 $(".ys_phnav_lisbox").click(function () { 745 var $subNav = $(this).siblings("ul"); 746 if ($subNav.length > 0) { 747 $(this).find(".ys_phnav_icon").toggleClass("on"); 748 $subNav.stop().slideToggle(); 749 } 750 $(this).parent().siblings().find("ul").stop().slideUp(); 751 $(this).parent().siblings().find(".ys_phnav_icon").removeClass("on"); 752 }); 753 754 $(".ys_phnav_lisbox a").click(function (e) { 755 e.stopPropagation(); 756 }); 757 758 // è¯è¨å¼¹æ¡ 759 $(".ys_phnav2_lang_btn").click(function () { 760 $(".ys_phnav2_lang_modal").addClass("on"); 761 }); 762 763 $(".ys_phnav2_lang_back").click(function () { 764 $(".ys_phnav2_lang_modal").removeClass("on"); 765 }); 766 } 767 768 function phNavInit3() { 769 // æç´¢å¼¹çª 770 ys.modal(".ys_phnavss_btn", ".ys_phnavss_modal"); 771 // menuæé®ç¹å» 772 $(".ys_phnav_menubtn").click(function () { 773 // éèæ»å¨æ¡ 774 ys.scrollbar.hide(); 775 ys.lenisStop(); 776 // æé®æ ·å¼ 777 $(this).addClass("on"); 778 $(".ys_phnav_menu").addClass("on"); 779 }); 780 //menuå ³éæé®ç¹å» 781 $(".ys_phmenu_close").click(function () { 782 // æ¾ç¤ºæ»å¨æ¡ 783 ys.scrollbar.show(); 784 ys.lenisStart(); 785 // æé®æ ·å¼ 786 $(".ys_phnav_menubtn").removeClass("on"); 787 $(".ys_phnav_menu").removeClass("on"); 788 }); 789 790 // navç¹å»å±å¼ 791 $(".ys_phnav_lisbox").click(function () { 792 var $subNav = $(this).siblings(".ys_phsubnav_modal"); 793 if ($subNav.length > 0) { 794 $subNav.addClass("on"); 795 } 796 }); 797 798 $('.ys_phnav_lisbox a').click(function (e) { 799 e.stopPropagation(); 800 }); 801 802 // navè¿åç¹å» 803 $(".ys_phsubnav_close").click(function () { 804 $(this).parents(".ys_phsubnav_modal").eq(0).removeClass("on"); 805 }); 806 807 // è¯è¨ä¸æ 808 $(".ys_phnav3_lang_hd").click(function () { 809 $(this).toggleClass("on"); 810 $(".ys_phnav3_lang_bd").stop().slideToggle(); 811 }); 812 813 $('.ys_phnav3_lang_hd a').click(function (e) { 814 e.stopPropagation(); 815 }); 816 817 } 818 819 function phNavInit4() { 820 // æç´¢å¼¹çª 821 ys.modal(".ys_phnavss_btn", ".ys_phnavss_modal") 822 // menuæé®ç¹å» 823 $(".ys_phnav_menubtn").click(function () { 824 // æ¾ç¤ºéèæ»å¨æ¡ 825 if ($(this).hasClass("on")) { 826 ys.scrollbar.show(); 827 ys.lenisStart(); 828 } else { 829 ys.scrollbar.hide(); 830 ys.lenisStop(); 831 } 832 // æé®æ ·å¼ 833 $(this).toggleClass("on"); 834 // 䏿å±å¼ 835 $(".ys_phnav_menu").stop().slideToggle(); 836 }); 837 838 // navç¹å»å±å¼ 839 $(".ys_phnav_lisbox").click(function () { 840 var $subNav = $(this).siblings("ul"); 841 if ($subNav.length > 0) { 842 $(this).find(".ys_phnav_icon").toggleClass("on"); 843 $subNav.stop().slideToggle(); 844 } 845 $(this).parent().siblings().find("ul").stop().slideUp(); 846 $(this).parent().siblings().find(".ys_phnav_icon").removeClass("on"); 847 }); 848 849 $(".ys_phnav_lisbox a").click(function (e) { 850 e.stopPropagation(); 851 }); 852 } 853 854 } 855 ys.phNavInit = phNavInit; 856 857 /** 858 *
859 * @description éè¿jsè°ç¨animate.cssçå¨ç» 860 * @param {String} ele - å¨ç»çå ç´ 861 * @param {String} animate - å¨ç»çåå 862 * @param {Function} callback - å¨ç»æ§è¡å®çåè°å½æ° 863 * 864 */ 865 function animateCss(ele, animate, callback) { 866 var $ele = $(ele); 867 var duration = $ele.css("animation-duration"); 868 duration == '0s' ? duration = 1000 : duration = parseFloat(duration) * 1000; 869 $ele.addClass('animated ' + animate); 870 if (callback == "show") { 871 $ele.stop().show(); 872 }; 873 setTimeout(function () { 874 if (callback == "hide") { 875 $ele.stop().hide(); 876 } else if (callback != "show" && callback) { 877 callback(); 878 } 879 $ele.removeClass(animate); 880 }, duration); 881 882 }; 883 ys.animateCss = animateCss; 884 885 //æ£æ¥é¡µé¢æ¯å¦ç¼©æ¾ 886 function checkViewport() { 887 //FF è°·æ 888 if (window.devicePixelRatio > 1 || window.devicePixelRatio < 1) { 889 alert('å½å页é¢ç¼©æ¾æ¯ä¾å¼å¸¸ï¼è¯·è®¾ç½®æ100%') 890 } 891 //IE 892 if (window.screen.deviceXDPI != window.screen.logicalXDPI) { 893 alert('å½å页é¢ç¼©æ¾æ¯ä¾å¼å¸¸ï¼è¯·è®¾ç½®æ100%') 894 } 895 } 896 ys.checkViewport = checkViewport; 897 898 // éæ°å è½½main.cssåmidea.css 899 function reloadCss() { 900 $("link").each(function () { 901 var href = $(this).attr("href"); 902 if (href.indexOf("main.css") > 0 || href.indexOf("media.css") > 0) { 903 $(this).attr("href", href + '?' + new Date().getTime()); 904 } 905 }); 906 } 907 ys.reloadCss = reloadCss; 908 909 // æåææslickè½®æ 910 function stopSlick() { 911 $(".slick-slider").slick("pause"); 912 } 913 ys.stopSlick = stopSlick; 914 915 /** 916 * 917 * @description éç¹å®ä½ 918 * @param {String} reg - è·¯ç±æ¼æ¥ 919 * @param {Number} navHeight - pc导èªé«åº¦ 920 * @param {Number} time - æ»å¨çæ¶é´ 921 */ 922 function yxtop(reg, navHeight, time) { 923 $(window).on("load", function () { 924 init(reg, navHeight, time); 925 }); 926 927 function init(reg, navHeight, time) { 928 var reg = reg || "tp="; 929 var navHeight = navHeight || $(".ys_hd_pc").height() || 0; 930 var time = time || 500; 931 if ($(window).width() < 1200) { 932 navHeight = 64; 933 } 934 var strArr = (window.location.href).split(reg); 935 if (!isNaN(strArr[1])) { 936 $("html,body").animate({ 937 scrollTop: $('[data-page="' + strArr[1] + '"]').offset().top - navHeight 938 }, time); 939 } 940 } 941 } 942 ys.yxtop = yxtop; 943 944 // 页é¢å¹³æ»æ»å¨ 945 function yxlenis() { 946 lenis = new Lenis() 947 948 lenis.on('scroll', (e) => { 949 // console.log(e) 950 }) 951 952 function raf(time) { 953 lenis.raf(time) 954 requestAnimationFrame(raf) 955 } 956 957 requestAnimationFrame(raf) 958 } 959 ys.yxlenis = yxlenis; 960 961 function lenisStop() { 962 lenis.stop(); 963 } 964 ys.lenisStop = lenisStop; 965 966 function lenisStart() { 967 lenis.start(); 968 } 969 ys.lenisStart = lenisStart; 970 971 /** 972 * @description 夿æ¯å¦ä¸ºIEæµè§å¨ 973 * 974 */ 975 function isIE() { 976 if (!!window.ActiveXObject || "ActiveXObject" in window) { 977 return true; 978 } else { 979 return false; 980 } 981 } 982 ys.isIE = isIE; 983 984 // a龿¥æ¼æ¥å符串 985 function concatHref(str, selector) { 986 var $ele = selector ? $(selector) : $("a"); 987 $ele.each(function () { 988 var oldHref = $(this).attr("href"); 989 if (oldHref && oldHref != undefined) { 990 if (oldHref.indexOf("javascript") == -1) { 991 if (oldHref.indexOf("?") == -1) { 992 oldHref = oldHref + "?"; 993 } 994 $(this).attr("href", oldHref + str) 995 } 996 } 997 }) 998 } 999 ys.concatHref = concatHref; 1000 1001 // slickæ»å¨å°èªå¨è½®æ 1002 function slickAuto(accy) { 1003 var accy = accy || 0; 1004 $(this).appear(function () { 1005 $(this).slick("play"); 1006 }, { 1007 accY: accy 1008 }) 1009 } 1010 $.fn.slickAuto = slickAuto; 1011 1012 window.ys = ys; 1013}(window));
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.