1$(function() { 2 window.ltAnalytics.init('wd') 3 page.init() 4 modal.init() 5 // modal.open('.picture-modal') 6}) 7 8// 页é¢åå§å 9var page = { 10 setOssData() { 11 if(typeof(ossData) !== 'undefined') { 12 if($('#payBall a').attr('href') == 'javascript:;') { 13 $('#payBall a').attr('href', ossData.payBall.href); 14 } 15 } 16 }, 17 addActive(el) { 18 // 为å ç´ æ·»å activeç±»ï¼å¹¶ç§»é¤siblingsçactive 19 el.addClass('active').siblings().removeClass('active') 20 }, 21 init() { 22 this.setOssData() 23 page1.init() 24 page2.init() 25 page3.init() 26 page4.init() 27 page5.init() 28 page6.init() 29 } 30} 31 32// é¦é¡µ 33var page1 = { 34 init() { 35 // æ¬æµ®ç 36 $('#payBall a').on('click', function() { 37 leitingweb.track('click_official_topup',{ 38 Game: 'wd', 39 Acts: 'home' 40 }) 41 }) 42 // kv 43 if($('.page1 .kv-more .kv-swiper').find('.swiper-slide').length > 0) { 44 this.kvSwiper = new Swiper('.kv-swiper', { 45 loop: $('.kv-swiper').find('.swiper-slide').length > 1, 46 watchOverflow: true, 47 spaceBetween: 2, 48 autoplay: { 49 delay: 5000, 50 stopOnLastSlide: false, 51 disableOnInteraction: false, 52 } 53 }) 54 } 55 // èæ¯è§é¢ 56 var userAgentInfo = navigator.userAgent.toLowerCase(); 57 var isMobile = userAgentInfo.match(/(iphone|ipod|android|ios|ipad|backerry|webos|symbian|windows phone|phone|mobile|webos|incognito|webmate|bada|nokia|lg|ucweb|skyfire)/i); 58 var fixIpad = navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1; // å ¼å®¹ï¼iPad-设置-Safaræµè§å¨-è¯·æ±æ¡é¢ç½ç«-ææç½ç«ï¼å¼å¯ï¼ 59 if(isMobile || fixIpad) { 60 $('.page1 .kv-one .kv-video').remove(); 61 } 62 63 var showRight = $('.page2').offset().top - $(window).height() / 2 64 $(window).scroll(function() { 65 dealRight() 66 }); 67 function dealRight() { 68 var o = $(window).scrollTop(); 69 if(o >= showRight) { 70 $('.side-bar').removeClass('opacity0') 71 } else { 72 $('.side-bar').addClass('opacity0') 73 } 74 } 75 dealRight() 76 } 77} 78 79// æ°é»é¡µ 80var page2 = { 81 init() { 82 var _this = this 83 // åç¹å¾ 84 if($('.news-swiper').find('.swiper-slide').length > 0) { 85 this.page3Swiper = new Swiper('.news-swiper', { 86 loop: $('.news-swiper').find('.swiper-slide').length > 1, 87 watchOverflow: true, 88 spaceBetween: 2, 89 autoplay: { 90 delay: 3000, 91 stopOnLastSlide: false, 92 disableOnInteraction: false, 93 }, 94 pagination: { 95 el: '.news-swiper-pagination', 96 clickable: true 97 } 98 }) 99 $('.news-swiper-wrap .swiper-pagination').on('mouseenter', '.swiper-pagination-bullet', function() { 100 _this.page3Swiper.slideTo($(this).index() + 1) 101 }) 102 } 103 104 // ç±»å忢 105 $('#p2TypeList').on('click', '.item', function() { 106 if($(this).hasClass('active')) return 107 var type = $(this).attr('data') 108 page.addActive($(this)) 109 page.addActive($("#p2NewsList .news-list[data='" + type + "']")) 110 }) 111 } 112} 113 114// ä¸åºå ¥å£ 115var page3 = { 116 init() { 117 // ç±»å忢 118 $('#p3TypeList').on('click', '.item', function() { 119 if($(this).hasClass('active')) return 120 var type = $(this).attr('data') 121 page.addActive($(this)) 122 page.addActive($("#p3ConList .project-list[data='" + type + "']")) 123 }) 124 125 // 龿¥è·³è½¬ 126 $('#p3ConList').on('click', '.jump', function() { 127 var url = $(this).attr('data') 128 if(url === '' || url === undefined) { 129 alert('æ¬è¯·æå¾ ï¼') 130 } else { 131 window.open(url) 132 } 133 }) 134 } 135} 136 137// é®éå¾é´ 138var page4 = { 139 role: { 140 attrIndex: 1, 141 genderIndex: 1 142 }, 143 roleEvent() { 144 /* ç»å ¸èä¸ */ 145 var _this = this 146 147 // 屿§åæ¢ 148 $('#p4RoleAttrList').on('click', '.item', function() { 149 if($(this).hasClass('active')) return 150 page.addActive($(this)) 151 _this.updateRoleData() 152 }) 153 154 // æ§å«åæ¢ 155 $('#p4RoleGenderList').on('click', '.item', function() { 156 if($(this).hasClass('active')) return 157 page.addActive($(this)) 158 _this.updateRoleData() 159 }) 160 161 // ä»ç»å 容忢 162 $('#p4RoleDetailList').on('mouseenter', '.type-list .item', function() { 163 if($(this).hasClass('active')) return 164 page.addActive($(this)) 165 var index = $(this).index() 166 page.addActive($(this).closest('.detail-item').find('.detail-list').children().eq(index)) 167 }) 168 169 // ä»ç»å 容忢å页忢 170 $('#p4RoleDetailList').on('mouseenter', '.detail-list .circle span', function() { 171 if($(this).hasClass('active')) return 172 page.addActive($(this)) 173 var index = $(this).index() 174 page.addActive($(this).closest('.sub-page').children('.text').eq(index)) 175 }) 176 }, 177 updateRoleData() { 178 // æ´æ°è§è²ä¿¡æ¯ 179 this.role.attrIndex = $('#p4RoleAttrList .item.active').attr('data') 180 this.role.genderIndex = $('#p4RoleGenderList .item.active').attr('data') 181 page.addActive($("#p4RoleImgList .img[data='" + this.role.attrIndex + this.role.genderIndex + "']")) 182 page.addActive($("#p4RoleBg .video-wrap[data='" + this.role.attrIndex + "']")) 183 page.addActive($("#p4RoleDetailList .detail-item[data='" + this.role.attrIndex + "']")) 184 }, 185 pet: { 186 init: false, 187 swiper: '', 188 scrollX: 0, // ä½ç§»è·ç¦» 189 timer: '', // æ»å¨è®¡æ¶å¨ 190 wrapW: 0, // 容å¨å®½åº¦ 191 pauseArea: 16 // ä¸é´åæ¢åºåæå ç¾åæ¯ 192 }, 193 petScrollTimer(type, percent) { 194 // æ»å¨å®æ¶å¨ 195 if(this.pet.timer !== '') { 196 clearInterval(this.pet.timer) 197 console.log('æ¸ é¤å®æ¶å¨') 198 } 199 this.pet.scrollX = this.pet.swiper.translate 200 var _this = this 201 console.log(this.pet.scrollX + $('.pet-swiper').width()) 202 this.pet.timer = setInterval(function() { 203 if(type === 'left') { 204 _this.pet.scrollX++ 205 if(_this.pet.scrollX >= 0) { 206 _this.pet.scrollX = -1 * (_this.pet.swiper.slides.length / 3 * $('.pet-swiper .swiper-slide').width()) 207 } 208 _this.pet.swiper.setTranslate(_this.pet.scrollX) 209 } else if(type === 'right') { 210 _this.pet.scrollX-- 211 if(_this.pet.scrollX <= (-2 * (_this.pet.swiper.slides.length / 3 * $('.pet-swiper .swiper-slide').width()))) { 212 _this.pet.scrollX = -1 * (_this.pet.swiper.slides.length / 3 * $('.pet-swiper .swiper-slide').width()) 213 } 214 _this.pet.swiper.setTranslate(_this.pet.scrollX) 215 } 216 }, 2 * (5 - Math.abs(5 - (percent / 10)))) // è¶é è¿è¾¹ç¼ç§»å¨è¶å¿« 217 }, 218 petEvent() { 219 /* ç»å ¸å® ç© */ 220 var _this = this 221 this.pet.swiper = new Swiper('.pet-swiper', { 222 loop: $('.pet-swiper').find('.swiper-slide').length > 5, 223 watchOverflow: true, 224 slidesPerView: 'auto', 225 touchRatio: 0 226 }) 227 if($('.pet-swiper .swiper-slide').length > 5) { 228 $('.pet-swiper-wrap').on('mouseover', function(e) { 229 var wrapW = $('.pet-swiper').width() 230 var percent = parseInt(e.clientX / wrapW * 100) 231 console.log(percent) 232 if(percent >= 0 && percent < (50 - _this.pet.pauseArea / 2)) { 233 // 左侧åºå 234 _this.petScrollTimer('left', percent) 235 } else if(percent > (50 + _this.pet.pauseArea / 2) && percent <= 100) { 236 // å³ä¾§åºå 237 _this.petScrollTimer('right', percent) 238 } else { 239 _this.petScrollTimer() 240 } 241 }) 242 $('.pet-swiper-wrap').on('mouseout', function() { 243 _this.petScrollTimer() 244 }) 245 } 246 }, 247 clothEvent() { 248 /* ç»å ¸æ¶è£ */ 249 // æ¶è£ 忢 250 $('#p4ClothTypeList').on('mouseenter', '.item', function() { 251 if($(this).hasClass('active')) return 252 page.addActive($(this)) 253 var index = $(this).index() 254 page.addActive($('#p4ClothDetailList .item').eq(index)) 255 page.addActive($('#p4ClothImg .item').eq(index)) 256 }) 257 }, 258 init() { 259 // ç±»å忢 260 var _this = this 261 $('#p4TypeList').on('click', '.item', function() { 262 if($(this).hasClass('active')) return 263 var type = $(this).attr('data') 264 page.addActive($(this)) 265 page.addActive($("#p4ConList .con-item[data='" + type + "']")) 266 if(type === 'type2' && !_this.pet.init) { 267 _this.pet.init = true 268 _this.petEvent() 269 } 270 }) 271 272 this.roleEvent() 273 this.clothEvent() 274 } 275} 276 277// æ»ç¥ä¸å¿ 278var page5 = { 279 accordion: '', // æé£ç´å¯¹è±¡ 280 init() { 281 this.accordion = new cwAccordion() 282 this.accordion.init($('#page5Accordion1')) 283 } 284} 285 286// å½±é³å人 287var page6 = { 288 init() { 289 // ç±»å忢 290 $('#p6TypeList').on('click', '.item', function() { 291 if($(this).hasClass('active')) return 292 var type = $(this).attr('data') 293 page.addActive($(this)) 294 page.addActive($("#p6MediaWrap .list[data='" + type + "']")) 295 if(type === 'img') { 296 $('#p6ComNav .btn-more').removeClass('active') 297 $('#p6MoreBtn1').addClass('active') 298 } else if(type === 'video') { 299 $('#p6ComNav .btn-more').removeClass('active') 300 $('#p6MoreBtn2').addClass('active') 301 } 302 }) 303 304 // å丽ç¾å¾ 305 $('#p6PictureList').on('click', '.item', function() { 306 var src = $(this).attr('data-src') 307 var alt = $(this).attr('data-alt') 308 $('#p6PmImg').attr({'src': src, 'alt': alt}) 309 modal.open('.p6-picture-modal') 310 }) 311 312 // ç²¾ç¾è§é¢ 313 $('#p6VideoList').on('click', '.item', function() { 314 var src = $(this).attr('data') 315 $('#p6VmVideo').attr('src', src) 316 modal.openWithVideo('.p6-video-modal', 'p6VmVideo', src) 317 }) 318 } 319} 320 321/* æé£ç´ç»ä»¶ */ 322var cwAccordion = function() { 323 return { 324 wrapper: "", 325 introW: 0, 326 detailW: 0, 327 init: function(wrap) { 328 this.wrapper = wrap; 329 this.introW = parseInt(this.wrapper.attr("data-intro-w")); 330 this.detailW = parseInt(this.wrapper.attr("data-detail-w")); 331 var that = this; 332 333 that.wrapper.on("mouseenter", ".accordion-item", function() { 334 if ($(this).hasClass("active")) { 335 return; 336 } 337 $(this).addClass('active').siblings().removeClass('active'); 338 var item = that.wrapper.children(); 339 var active = $(this).index(); 340 for (var i = 0, len = item.length; i < len; i++) { 341 if (i > active) { 342 item.eq(i).css("transform","translate3d(" +(that.introW * i + that.detailW)/100 + "rem,0," + i + "rem)"); 343 } 344 if (i <= active) { 345 item.eq(i).css("transform", "translate3d(" + that.introW * i/100 + "rem,0," + i + "rem)"); 346 } 347 } 348 }); 349 } 350 } 351} 352 353/*æ¨¡ææ¡ç¸å ³*/ 354var modal = { 355 preModal: '', // å½å\ä¸ä¸ä¸ªå¼å¯çæ¨¡ææ¡çç±»å 356 scrollWidth: '', // æµè§å¨æ»å¨æ¡å®½åº¦ 357 scrollTop: 0, // å¼å¯æ¨¡ææ¡æ¶é¡µé¢æ»å¨è·ç¦» 358 needCloseModal: '', // éè¦å ³éçæ¨¡ææ¡ç±»å 359 closeIng: false, // æ¯å¦æ£å¨å ³éæ¨¡ææ¡ 360 delayTime: 300, // æ¨¡ææ¡å ³éæéæ¶é´ 361 preVideo: '', // ä¿å'video-data'ä¸éè¦èªå¨ææ¾çvideoçId 362 focusEl: '', // å¼å¯æ¨¡ææ¡åè·åå°ç¦ç¹çå ç´ 363 opening: false, // å½åæ¯å¦æå¼å¯çæ¨¡ææ¡ 364 scrollThrough: false,// æ¯å¦é»æ¢æ»å¨ç©¿é 365 open: function(className) { 366 var that = this; 367 368 // è¥å½åæå¼å¯çæ¨¡ææ¡ï¼åå ³éå½åæ¨¡ææ¡ååå¼å¯éè¦å¼å¯çæ¨¡ææ¡ 369 if(that.opening) { 370 that.hide(that.preModal); 371 setTimeout(function() { 372 that.open(className); 373 }, that.delayTime); 374 return; 375 } 376 that.opening = true; 377 378 var openDalyTime = 0; 379 if (that.closeIng) { 380 openDalyTime = that.delayTime; 381 } 382 setTimeout(function() { 383 that.preModal = className; 384 that.focusEl = document.activeElement; 385 that.scrollWidth = window.innerWidth - document.body.clientWidth; 386 that.scrollTop = parseInt(that.getScrollTop()); 387 388 $('body').css('padding-right', that.scrollWidth + 'px'); 389 if(that.scrollThrough) { 390 document.body.style.top = -that.scrollTop + 'px'; 391 $('body').addClass('modal-open'); 392 } else { 393 $('body').addClass('modal-open-scroll-through'); 394 } 395 396 $(that.preModal).css('display', 'flex').addClass('modal-active'); 397 $(that.needCloseModal).removeClass('modal-hide'); 398 399 /* å¼å¯æ¨¡ææ¡å为å½åæ¨¡ææ¡çå ³éæé®è·åç¦ç¹ */ 400 $(className + " [data='close']").focus(); 401 }, openDalyTime) 402 }, 403 hide: function(className) { 404 var that = this; 405 that.needCloseModal = className; 406 that.closeIng = true; 407 408 $(that.needCloseModal).removeClass('modal-active').addClass('modal-hide'); 409 410 setTimeout(function() { 411 $(that.focusEl).focus(); 412 $(that.needCloseModal).css('display', 'none'); 413 that.scrollTo(that.scrollTop); 414 415 if(that.scrollThrough) { 416 $('body').removeClass('modal-open'); 417 } else { 418 $('body').removeClass('modal-open-scroll-through'); 419 } 420 421 $(that.preModal).css('overflow', ''); 422 $('body').css('padding-right', ''); 423 that.closeIng = false;
424 that.opening = false; 425 }, that.delayTime); 426 427 /*if you need auto play video*/ 428 if(document.getElementById(that.preVideo) != null) { 429 document.getElementById(that.preVideo).pause(); 430 } 431 }, 432 scrollTo: function(num){ 433 document.body.scrollTop = document.documentElement.scrollTop = num; 434 }, 435 getScrollTop: function(){ 436 return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; 437 }, 438 openWithVideo(modal, videoId, videoSrc) { 439 // å¼å¯å¸¦è§é¢çå¼¹çª 440 $('#' + videoId).attr('src', videoSrc) 441 this.preVideo = videoId 442 document.getElementById(this.preVideo).play() 443 this.open(modal) 444 }, 445 init: function() { 446 var that = this; 447 $('.modal').css('display', 'none'); 448 $('.modal-hide, .modal-hide .modal-wrapper').css('animation-duration', that.delayTime + 'ms'); 449 // ç¹å»å ³éæé®æé®ç½©å±å ³éå½åæ¨¡ææ¡ 450 $("[data='close'], .modal:not([data-click-mask='false'])").on('click', function() { 451 that.hide(that.preModal); 452 }); 453 // 黿¢ç¹å»è§¦åå ³éæ¨¡ææ¡ 454 $(".modal:not([data-click-mask='false']) .modal-wrapper").on('click', function(e) { 455 e.stopPropagation(); 456 }); 457 // ç¹å»è§¦åå¼å¯æ¨¡ææ¡ 458 $("[data-type='modal']").on('click', function() { 459 var target = $(this).attr('data'); 460 461 /*if you need auto play video*/ 462 that.preVideo = $(this).attr('video-data'); 463 if(that.preVideo != null) { 464 document.getElementById(that.preVideo).play(); 465 } 466 467 that.open(target); 468 }); 469 } 470}
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.