1$(function() { 2 document.createElement("picture"); 3 /*-----------------------------------*/ 4 ///////////// fix iOS bug ///////////// 5 /*-----------------------------------*/ 6 document.documentElement.addEventListener('gesturestart', function(event) { 7 event.preventDefault(); 8 }, false); 9 /*-----------------------------------*/ 10 ///////////////// è®æ¸ //////////////// 11 /*-----------------------------------*/ 12 var _window = $(window), 13 ww = _window.outerWidth(), 14 wh = _window.height(), 15 _body = $('body'), 16 wwNormal = 1400, 17 wwMedium = 992, 18 wwSmall = 768, 19 wwxs = 576; 20 /*-----------------------------------*/ 21 //////////// nojs å ç§»é¤//////////////// 22 /*-----------------------------------*/ 23 $('html').removeClass('no-js'); 24 /*-----------------------------------*/ 25 //////////// nav妿æå ©åé¸å®/////////// 26 /*-----------------------------------*/ 27 var _navLength = $('.navigation ul').length; 28 if (_navLength > 1) { 29 $('.navigation ul:nth-child(1)').addClass('left_nav'); 30 } 31 $('.navigation').has('.language').addClass('have_language'); 32 /*-----------------------------------*/ 33 /////// headeré¸å® tabå fixè¨å®//////// 34 /*-----------------------------------*/ 35 var _menu = $('.menu'); 36 _menu.find('li').has('ul').addClass('hasChild'); 37 _menu.find('li>ul>li').removeClass('hasChild'); 38 var _mh = _menu.height(); 39 var liHasChild = _menu.find('li.hasChild'), 40 liHasChild_level1 = $('.menu ul').children('li.hasChild'), 41 liHasChild_level2 = $('.menu ul ul').children('li.hasChild'), 42 liHasChild_level3 = $('.menu ul ul ul').children('li.hasChild'), 43 subMenuWidth = liHasChild.first().children('ul').outerWidth(), 44 subMenu = liHasChild.find('ul'); 45 //subMenuLengh = subMenu.first().children('li').length; 46 47 /*-----------------------------------*/ 48 ////////////// è¡åçé¸å®åæ//////////// 49 /*-----------------------------------*/ 50 _body.prepend('<aside class="sidebar"><div class="m_area"><button type="button" class="sidebarClose">éé</button></div><div class="menu_overlay"></div></aside>'); 51 $('header .container').prepend('<button type="button" class="sidebarCtrl">å´æ¬é¸å®</button><button type="button" class="searchCtrl">æ¥è©¢</button>'); 52 var menu_status = false; 53 var _sidebar = $('.sidebar'), 54 _search = $('.search'), 55 _nav = $('.navigation'), 56 //_uni = $('.units'), 57 _units = $('.units'), 58 _units_block = $('.units_block'), 59 _sidebarClose = $('.sidebarClose'), 60 _sidebarCtrl = $('.sidebarCtrl'), 61 _overlay = $('.menu_overlay'); 62 _mArea = $('.m_area'); 63 _sidebarCtrl.append('<span></span><span></span><span></span>'); 64 var search_mode = false; 65 // æéé¸å® function 66 function showSidebar() { 67 _sidebar.show(); 68 _mArea.show(); 69 _mArea.animate({ 70 'margin-left': 0 71 }, 400, 'easeOutQuint'); 72 _body.addClass('noscroll'); 73 _overlay.fadeIn(); 74 $('.m_search').hide(); 75 search_mode = false; 76 } 77 // 縮åé¸å® function 78 function hideSidebar() { 79 _mArea.animate({ 'margin-left': _mArea.width() * -1 + 'px' }, 500, 'easeOutQuint', function() { 80 _sidebar.fadeOut(200); 81 _mArea.hide(); 82 }); 83 _body.removeClass('noscroll'); 84 _overlay.fadeOut(); 85 liHasChild.children('ul').hide(); 86 } 87 // æéé¸å®åä½ 88 _sidebarCtrl.click(function(e) { 89 showSidebar(); 90 e.preventDefault(); 91 }); 92 // ééåä½ 93 _overlay.add(_sidebarClose).off().click(function() { 94 hideSidebar(); 95 }); 96 _overlay.off("mouseenter"); 97 // ç¡éç¤tabè¨å® 98 liHasChild.children('a').keyup(function() { 99 $(this).siblings("ul").fadeIn(); 100 $(this).parent("li").siblings().focus(function() { 101 $(this).hide(); 102 }); 103 });
104 _menu.find('li').keyup(function() { 105 $(this).siblings().children('ul').hide(); 106 }); 107 _menu.find('li:last>a').focusout(function() { 108 _menu.find('li ul').hide(); 109 }); 110 // åæPC/Mobile é¸å® 111 function mobileMenu() { 112 ww = _window.outerWidth(); 113 if (ww < wwSmall) { 114 /*-----------------------------------*/ 115 /////////////// ææ©çè¨å® ///////////// 116 /*-----------------------------------*/ 117 menu_status = false; 118 _sidebar.hide(); 119 _overlay.hide(); 120 _nav.prependTo(_mArea); 121 _menu.prependTo(_mArea); 122 _search.prependTo(_body); 123 _search.addClass('m_search'); 124 _mArea.css({ 125 'margin-left': _mArea.width() * -1 + 'px' 126 }); 127 //subMenu.removeClass('twoColumn'); 128 liHasChild_level1.on({ 129 mouseenter: function() { 130 $(this).children('ul').stop(true, true).slideDown('600', 'easeOutQuint'); 131 }, 132 mouseleave: function() { 133 $(this).parent().siblings('ul').hide(); 134 $(this).children('ul').stop(true, true).slideUp('600', 'easeOutQuint'); 135 } 136 }); 137 // å¯é¸å®é»åº 138 liHasChild.off().on('mouseenter,mouseleave'); 139 liHasChild.on('touchstart', function() { 140 $(this).off('mouseenter,mouseleave'); 141 }); 142 // 第ä¸å±¤é¸å® 143 liHasChild_level1.off().on('click', function(e) { 144 $(this).siblings('li').find('ul').stop(true, true).slideUp('600', 'easeOutQuint'); 145 $(this).children('ul').stop(true, true).slideDown('600', 'easeOutQuint'); 146 }); 147 // 第äºå±¤é¸å® 148 liHasChild_level2.off().on('click', function(e) { 149 $(this).siblings('li').children('ul').stop(true, true).slideUp('600', 'easeOutQuint'); 150 $(this).children('ul').stop(true, true).slideDown('600', 'easeOutQuint'); 151 }); 152 // 第ä¸å±¤é¸å® 153 // liHasChild_level3.off().on('click', function(e) { 154 // e.preventDefault(); 155 // }); 156 //ææ©ç第第ä¸å±¤é»äºä¸æé²å ¥å §é ï¼æ¿æç¬¬ä¸å±¤çé£çµç¡ä½ç¨ 157 liHasChild.children('a').off().on('click', function(e) { 158 e.preventDefault(); 159 }); 160 _body.off('touchmove'); 161 $('.m_search').hide(); 162 $('.language').find('ul').hide(); 163 } else { 164 /*-----------------------------------*/
165 /////////////// PCçè¨å® ///////////// 166 /*-----------------------------------*/ 167 hideSidebar(); 168 _body.removeClass('noscroll'); 169 _nav.prependTo('.header .container'); 170 //_units_block.prependTo('.wrapper'); 171 _units.prependTo('.header .container'); 172 _units_block.insertAfter('.header .units'); 173 _search.appendTo('.header .container'); 174 _menu.appendTo('.header .container'); 175 _search.removeClass('m_search'); 176 _search.show(); 177 search_mode = false; 178 $('.language').find('ul').hide(); 179 180 181 182 // $(subMenu).each(function () { 183 // let b = $(this).children().length; 184 // if ( b > 8 && b <= 16) { 185 // $(this).addClass("twoColumn"); 186 // }else if( b > 16){ 187 // $(this).addClass("threeColumn"); 188 // } 189 // }); 190 191 //å¯é¸å®æ»åº 192 liHasChild.on({ 193 mouseenter: function() { 194 $(this).children('ul').stop(true, false).fadeIn(); 195 196 }, 197 mouseleave: function() { 198 $(this).parent().siblings('ul').hide(); 199 $(this).children('ul').stop(true, false).fadeOut(); 200 } 201 }); 202 liHasChild.off('click'); 203 // //妿é»å¨å¤é¢ 204 $(document).on('touchend click', function(e) { 205 var target = e.target; 206 if (!$(target).is('.menu li a')) { 207 $('.menu').find('li ul').hide(); 208 } 209 }); 210 } 211 } 212 //è¨å®resize è¨æå¨ 213 var resizeTimer; 214 _window.bind("load resize", function(event) { 215 clearTimeout(resizeTimer); 216 resizeTimer = setTimeout(function() { 217 search_mode = true; 218 mobileMenu(); 219 }, 50); 220 }); 221 mobileMenu(); 222 // è¡åçæ¥è©¢ 223 var _searchCtrl = $('.searchCtrl'); 224 $('.m_search').hide(); 225 _searchCtrl.off().on('click', function(e) { 226 if (!search_mode) { 227 $('.m_search').stop(true, false).slideDown('400', 'easeOutQuint'); 228 _window.off('resize'); 229 // $('.m_search').find('input[type="text"]').focus(); 230 search_mode = true; 231 } else { 232 $('.m_search').hide(); 233 search_mode = false; 234 } 235 }); 236 // 妿é»å¨å¤é¢ 237 $('.main').off().on('click touchend', function(e) { 238 $('.m_search').hide(); 239 search_mode = false; 240 }); 241 // åºå®çé 242 hh = Math.floor($('.header').outerHeight(true)); 243 if ($('header').has('menu')) { 244 var stickyMenuTop = 200; 245 // console.log(stickyMenuTop); 246 hh = Math.floor($('.header').outerHeight(true)); 247 menuH = Math.floor(_menu.outerHeight(true)); 248 $(window).bind("load scroll resize", function(e) { 249 ww = _window.outerWidth(); 250 if (ww >= wwSmall && $(this).scrollTop() > stickyMenuTop) { 251 $('.header').addClass('fixed'); 252 $('.header').css('margin-top', menuH - hh); 253 $('.main').css('margin-top', hh); 254 } else { 255 $('.header').removeClass('fixed'); 256 $('.header').css('margin-top', 0); 257 $('.main').css('margin-top', 0); 258 } 259 }); 260 } 261 /*-----------------------------------*/ 262 //////////// noticeè¨æ¯åå¡ //////////// 263 /*-----------------------------------*/ 264 $('[class*="notice"] a.close').click(function(e) { 265 $(this).parent('[class*="notice"]').hide(); 266 e.preventDefault(); 267 }); 268 /*-----------------------------------*/ 269 //////////// Accordionè¨å® //////////// 270 /*-----------------------------------*/ 271 $('.accordion').each(function() { 272 $(this).find('.accordion-content').hide(); 273 var _accordionItem = $(this).children('ul').children('li').children('a'); 274 _accordionItem.each(function() { 275 function accordion(e) { 276 $(this).parent('li').siblings().children('a').removeClass('active'); 277 $(this).toggleClass('active'); 278 $(this).parent('li').siblings().children('.accordion-content').slideUp(); 279 $(this).next('.accordion-content').slideToggle(); 280 e.preventDefault(); 281 } 282 $(this).click(accordion); 283 $(this).keyup(accordion); 284 }); 285 });
286 /*-----------------------------------*/ 287 /////////////fatfooteréé///////////// 288 /*-----------------------------------*/ 289 $('.btn-fatfooter').click(function(e) { 290 $(this).parent('.container').find('nav>ul>li>ul').stop(true, true).slideToggle(function() { 291 if ($('html')[0].hasAttribute("lang")) { 292 var weblang = $('html').attr('lang'); 293 if (weblang.substring(0, 2) == 'zh') { 294 $('.btn-fatfooter').attr('aria-label', 'åºé¨é¸å®å塿¶å'); 295 if ($(this).is(':visible')) { 296 $('.btn-fatfooter').html("æ¶å"); 297 $('.btn-fatfooter').attr('name', 'æ¶åé¸å®'); 298 $('.btn-fatfooter').attr('aria-expanded', 'true'); 299 } else { 300 $('.btn-fatfooter').html("å±é"); 301 $('.btn-fatfooter').attr('name', 'å±éé¸å®'); 302 $('.btn-fatfooter').attr('aria-expanded', 'false'); 303 } 304 } else if (weblang.substring(0, 2) !== 'zh') { 305 $('.btn-fatfooter').attr('aria-label', 'Fatfooter menu collapse'); 306 if ($(this).is(':visible')) { 307 $('.btn-fatfooter').html("CLOSE"); 308 $('.btn-fatfooter').attr('name', 'CLOSE'); 309 } else { 310 $('.btn-fatfooter').html("OPEN"); 311 $('.btn-fatfooter').attr('name', 'OPEN'); 312 313 } 314 } 315 } 316 $(this).stop(true, true).toggleClass('close'); 317 }); 318 }); 319 320 /*-----------------------------------*/ 321 //////////////ç¸ç°¿çç®±////////////// 322 /*-----------------------------------*/ 323 //ç¸ç°¿JQè¨å® 324 if ($('.has_lightbox').length > 0) { 325 var lightbox_Status = false; 326 $('.album').append('<div class="lightbox"><a href="#" class="light_close">éé</a><a href="#" class="light_prev">ä¸ä¸å¼µ</a><a href="#" class="light_next">ä¸ä¸å¼µ</a><img src="" alt=""><div class="galler_overlay"></div></div>') 327 $('.album .lightbox').hide(); // lightboxå é±è 328 $('.light_close').click(function(event) { 329 $('.album .lightbox').hide(); // 妿é»å°closeï¼lightboxé±è 330 $('body').removeClass('noscroll'); 331 $('.album .lightbox .caption').html(''); 332 lightbox_Status = false; 333 }); 334 $('.album .lightbox .galler_overlay').click(function(event) { 335 $('.album .lightbox').hide(); // 妿é»å°overlayï¼lightboxé±è 336 $('body').removeClass('noscroll'); 337 $('.album .lightbox .caption').html(''); 338 lightbox_Status = false; 339 }); 340 var PIC_SRC = $('.album .lightbox img').attr('src'); 341 // var THUMB_PIC = $(this).attr('src'); 342 var PIC_INDEX = 0; 343 $('.album a').click(function(e) { 344 e.preventDefault(); 345 lightbox_Status = true; 346 }); 347 $('.album .thumbnail a').each(function(index) { 348 $(this).click(function(e) { 349 var THUMB_H3 = $(this).find('.img-container img').attr('alt'); 350 $('body').addClass('noscroll'); 351 $('.album .lightbox').append('<div class="caption">' + THUMB_H3 + '<div>'); 352 THUMB_PIC = $(this).find('.img-container img').attr('data-src'); 353 $('.album .lightbox img').attr('src', THUMB_PIC); 354 $('.album .lightbox').fadeIn(); 355 $('.album .lightbox .galler_overlay').fadeIn(); 356 PIC_INDEX = index; 357 e.preventDefault(); 358 }); 359 }); 360 //è¨ç®ç¶é ç¸®åæ¸é 361 var PIC_NUM = $('.album .thumbnail').length; 362 // ä¸ä¸å¼µ function 363 function NEXT_MOV() { 364 //pic_index+1 妿尿¼ åçæ¸é 365 if ((PIC_INDEX + 1) < PIC_NUM) { 366 //PIC_INDEX = (PIC_INDEX + 1) % PIC_NUM;//å餿¸ 367 PIC_INDEX++; //pic_index ++ 368 //if(PIC_INDEX >= PIC_NUM){PIC_INDEX=0;} 369 } else {
370 PIC_INDEX = 0 //å¦æçæ¼æå¤§æ¼åçæ¸é pic_index =0 ï¼è·³å°ç¬¬ä¸å¼µ 371 } 372 THUMB_PIC = $('.album .thumbnail').eq(PIC_INDEX).find('.img-container picture source:first').attr('data-srcset'); 373 // æ²å¯«picture 374 // THUMB_PIC = $('.album .thumbnail').eq(PIC_INDEX).find('.img-container img').attr('src'); 375 THUMB_H3 = $('.album .thumbnail').eq(PIC_INDEX).find('.img-container img').attr('alt'); 376 $('.album .lightbox .caption').html(THUMB_H3); 377 $('.album .lightbox img').hide(); 378 $('.album .lightbox img').fadeIn(); 379 $('.album .lightbox img').attr('src', THUMB_PIC); 380 //æ¾å ¥çç®± img src 381 } 382 $('.album .light_next').click(function(e) { 383 NEXT_MOV(); 384 e.preventDefault(); 385 }); 386 // ä¸ä¸å¼µ function 387 function PREV_MOV() { 388 if ((PIC_INDEX + 1) > 1) { //pic_index+1 å¦æå¤§æ¼ 1 389 //PIC_INDEX = (PIC_INDEX + 1) % PIC_NUM;//å餿¸ 390 PIC_INDEX--; //pic_index -- 391 //if(PIC_INDEX >= PIC_NUM){PIC_INDEX=0;} 392 } else { 393 PIC_INDEX = PIC_NUM - 1; //å¦æçæ¼æå°æ¼åçæ¸é pic_index =åçæ¸é-1 ï¼è·³å°æå¾ä¸å¼µ 394 } 395 //å縮å img src 396 THUMB_PIC = $('.album .thumbnail').eq(PIC_INDEX).find('.img-container picture source:first').attr('data-srcset'); 397 // æ²å¯«picture 398 // THUMB_PIC = $('.album .thumbnail').eq(PIC_INDEX).find('.img-container img').attr('src'); 399 THUMB_H3 = $('.album .thumbnail').eq(PIC_INDEX).find('.img-container img').attr('alt'); 400 $('.album .lightbox .caption').html(THUMB_H3); 401 $('.album .lightbox img').hide(); 402 $('.album .lightbox img').fadeIn(); 403 $('.album .lightbox img').attr('src', THUMB_PIC); 404 //æ¾å ¥çç®± img src 405 } 406 $('.album .light_prev').click(function(e) { 407 PREV_MOV(); 408 e.preventDefault(); 409 }); 410 //左峿éµç§»å 411 if (lightbox_Status = true) { 412 $('body').keydown(function(e) { 413 if (e.keyCode == 37) { 414 PREV_MOV(); 415 } else if (e.keyCode == 39) { 416 NEXT_MOV(); 417 } else if (e.keyCode == 27) { 418 $('.album .lightbox').hide(); 419 $('body').removeClass('noscroll'); 420 } 421 }); 422 } 423 } 424 /*-----------------------------------*/ 425 ////////////////å¤çµTab//////////////// 426 /*-----------------------------------*/ 427 var resizeTimer1; 428 _window.resize(function() { 429 clearTimeout(resizeTimer1); 430 resizeTimer1 = setTimeout(function() { 431 ww = _window.outerWidth(); 432 tabSet(); 433 }, 50); 434 }); 435 436 function tabSet() { 437 $('.tabs').each(function() { 438 var _tab = $(this), 439 _tabItem = _tab.find('.tabItem'), 440 _tabItemA = _tabItem.children('a'), 441 _tabContent = _tab.find('.tabContent'), 442 tabwidth = _tab.width(), 443 tabItemHeight = _tabItem.outerHeight(), 444 tabContentHeight = _tab.find('.active').next().innerHeight(), 445 tiGap = 0, 446 tabItemLength = _tabItem.length, 447 tabItemWidth; 448 _tab.find('.active').next('.tabContent').show(); 449 if (ww >= wwSmall) { 450 _tabContent.css('top', tabItemHeight); 451 _tab.height(tabContentHeight + tabItemHeight); 452 tabItemWidth = (tabwidth - (tabItemLength - 1) * tiGap) / tabItemLength; 453 _tabItem.width(tabItemWidth).css('margin-left', tiGap); 454 _tabItem.first().css('margin-left', 0); 455 _tabItem.last().css({ 'position': 'absolute', 'top': 0, 'right': 0 }).width(tabItemWidth);
456 } else { 457 _tab.css('height', 'auto'); 458 _tabItem.width(tabwidth); 459 _tabItem.css('margin-left', 0).last().css('position', 'relative'); 460 } 461 _tabItemA.focus(tabs); 462 _tabItemA.click(tabs); 463 464 function tabs(e) { 465 var _tabItemNow = $(this).parent(), 466 tvp = _tab.offset().top, 467 tabIndex = _tabItemNow.index() / 2, 468 scollDistance = tvp + tabItemHeight * tabIndex - hh; 469 _tabItem.removeClass('active'); 470 _tabItemNow.addClass('active'); 471 if (ww <= wwSmall) { 472 _tabItem.not('.active').next().slideUp(); 473 _tabItemNow.next().slideDown(); 474 $("html,body").stop(true, false).animate({ scrollTop: scollDistance }); 475 } else { 476 _tabItem.not('.active').next().hide(); 477 _tabItemNow.next().show(); 478 tabContentHeight = _tabItemNow.next().innerHeight(); 479 _tab.height(tabContentHeight + tabItemHeight); 480 } 481 e.preventDefault(); 482 } 483 }); 484 } 485 $('.tabs>.tabItem:first-child>a').trigger('click'); 486 tabSet(); 487 /*-----------------------------------*/ 488 ///////////////ç½®é go to top//////////// 489 /*-----------------------------------*/ 490 $(window).bind('scroll', function() { 491 if ($(this).scrollTop() > 200) { 492 $('.scrollToTop').fadeIn(); 493 } else { 494 $('.scrollToTop').fadeOut(); 495 } 496 }); 497 /*-----------------------------------*/ 498 /////click event to scroll to top////// 499 /*-----------------------------------*/ 500 $('.scrollToTop').click(function(e) { 501 $('html, body').animate({ scrollTop: 0 }, 400, 'easeOutExpo'); 502 e.preventDefault(); 503 }); 504 // $('.scrollToTop').keydown(function(e) { 505 // _body.find('a:first').focus(); 506 // e.preventDefault(); 507 // }); 508 /*--------------------------------------------------------*/ 509 /////è¨å®img å¨IE9+ SAFARI FIREFOX CHROME å¯ä»¥object-fit///// 510 /*--------------------------------------------------------*/ 511 var userAgent, ieReg, ie; 512 userAgent = window.navigator.userAgent; 513 ieReg = /msie|Trident.*rv[ :]*11\./gi; 514 ie = ieReg.test(userAgent); 515 if (ie) { 516 $(".img-container").each(function() { 517 var imgUrl = $(this).find('img').attr('data-src'); 518 var $container = $(this); 519 $container.has('.none').addClass('ie-object-none'); 520 $container.has('.none').css('backgroundImage', 'url(' + imgUrl + ')'); 521 $container.has('.cover').addClass('ie-object-cover'); 522 $container.has('.cover').css('backgroundImage', 'url(' + imgUrl + ')'); 523 $container.has('.fill').addClass('ie-object-fill'); 524 $container.has('.fill').css('backgroundImage', 'url(' + imgUrl + ')'); 525 $container.has('.contain').addClass('ie-object-contain'); 526 $container.has('.contain').css('backgroundImage', 'url(' + imgUrl + ')'); 527 }); 528 } 529 /*-----------------------------*/ 530 /////formè¡¨å® placeholderé±è///// 531 /*-----------------------------*/ 532 $('input,textarea').focus(function() { 533 $(this).removeAttr('placeholder'); 534 }); 535 $('input[type="checkbox"]').off().click(function(e) { 536 $(this).blur(); 537 }); 538 /*------------------------------------*/ 539 /////formè¡¨å® å®åæªæ¡ä¸å³+å¤åæªæ¡ä¸å³///// 540 /*------------------------------------*/ 541 $(document).on('change', '.check_file', function() { 542 var names = []; 543 var length = $(this).get(0).files.length; 544 for (var i = 0; i < $(this).get(0).files.length; ++i) { 545 names.push($(this).get(0).files[i].name); 546 } 547 // $('input[name=file]').val(names); 548 if (length > 2) { 549 var fileName = names.join(', '); 550 $(this).closest('.upload_grp').find('.upload_file').attr("value", length + " files selected"); 551 } else { 552 $(this).closest('.upload_grp').find('.upload_file').attr("value", names); 553 } 554 });
555 /*------------------------------------*/ 556 //////////å享æé share dropdwon//////// 557 /*------------------------------------*/ 558 $('.function_panel .share').children('ul').hide(); 559 $('.function_panel .share').prepend('<a href="#" class="shareButton">shareå享æé</a>'); 560 var _shareButton = $('.shareButton'); 561 _shareButton.off().click(function(e) { 562 $(this).siblings('ul').stop(true, true).slideToggle(); 563 e.preventDefault(); 564 }); 565 _shareButton.keyup(function(event) { 566 $(this).siblings('ul').stop(true, true).slideDown(); 567 }); 568 $('.function_panel .share').find('li:last>a').focusout(function(event) { 569 $(this).parent().parent('ul').hide(); 570 }); 571 // é»å¤é¢ééshare 572 $(document).on('touchend click', function(e) { 573 var container = $(".function_panel .share"); 574 if (!container.is(e.target) && container.has(e.target).length === 0) { 575 $('.function_panel .share ul').hide(); 576 } 577 }); 578 /*------------------------------------*/
579 /////////////ååå¤§å° font-size////////// 580 /*------------------------------------*/ 581 $('.font_size').find('.medium').addClass('active'); 582 $('.font_size').find('.small').click(function(e) { 583 $(this).parent('li').siblings('li').find('a').removeClass('active'); 584 $('.cp').removeClass('large_size').addClass('small_size'); 585 $(this).addClass('active'); 586 e.preventDefault(); 587 }); 588 $('.font_size').find('.medium').click(function(e) { 589 $(this).parent('li').siblings('li').find('a').removeClass('active'); 590 $('.cp').removeClass('large_size small_size'); 591 $(this).addClass('active'); 592 e.preventDefault(); 593 }); 594 $('.font_size').find('.large').click(function(e) { 595 $(this).parent('li').siblings('li').find('a').removeClass('active'); 596 $('.cp').removeClass('small_size').addClass('large_size'); 597 $(this).addClass('active'); 598 e.preventDefault(); 599 }); 600 /*-----------------------------------*/ 601 /////////// category active ////////// 602 /*-----------------------------------*/ 603 $('.category').find('a').off().click(function(event) { 604 $(this).parent('li').siblings().find('a').removeClass('active'); 605 $(this).addClass('active'); 606 }); 607 /*-----------------------------------*/ 608 /////////// ç¡éç¤å¿«æ·éµç¤çµå ////////// 609 /*-----------------------------------*/ 610 $(document).on('keydown', function(e) { 611 // alt+S æ¥è©¢ 612 if (e.altKey && e.keyCode == 83) { 613 $('html, body').animate({ scrollTop: 0 }, 200, 'easeOutExpo'); 614 $('.search').find('input[type="text"]').focus(); 615 } 616 // alt+U header 617 if (e.altKey && e.keyCode == 85) { 618 $('html, body').animate({ scrollTop: 0 }, 200, 'easeOutExpo'); 619 $('header').find('.accesskey').focus(); 620 } 621 // alt+C 主è¦å §å®¹å 622 if (e.altKey && e.keyCode == 67) { 623 $('html, body').stop(true, true).animate({ scrollTop: $('.main').find('.accesskey').offset().top - _mh }, 800, 'easeOutExpo'); 624 $('.main').find('.accesskey').focus(); 625 } 626 // alt+B footer 627 if (e.altKey && e.keyCode == 90) { 628 $('html, body').stop(true, true).animate({ scrollTop: $('footer').find('.accesskey').offset().top }, 800, 'easeOutExpo'); 629 $('footer').find('.accesskey').focus(); 630 } 631 }); 632 //ç¡éç¤åæslickç®é èªç³» & fatfooter buttonèªç³» 633 $('.slick-prev').removeAttr('aria-label'); 634 $('.slick-next').removeAttr('aria-label'); 635 if ($('html')[0].hasAttribute("lang")) { 636 var weblang = $('html').attr('lang'); 637 if (weblang.substring(0, 2) == 'zh') { 638 //console.log("䏿"); 639 $('.slick-prev').attr('title', 'ä¸ä¸ç'); 640 $('.slick-next').attr('title', 'ä¸ä¸ç'); 641 $('.slick-prev').html('ä¸ä¸ç'); 642 $('.slick-next').html('ä¸ä¸ç'); 643 $('.btn-fatfooter').attr('aria-label', 'åºé¨é¸å®å塿¶å'); 644 } else if (weblang.substring(0, 2) !== 'zh') { 645 $('.slick-prev').attr('title', 'previous'); 646 $('.slick-next').attr('title', 'next'); 647 $('.btn-fatfooter').attr('aria-label', 'Fatfooter menu collapse'); 648 } 649 } 650 651 // ç¡éç¤é¨é»åæèªç³»ï¼æ´æ¹accesskeyçtitleå稱 652 var weblang = $('html').attr('lang'); 653 if (weblang.substring(0, 2) == 'zh') { 654 $('header').find('.accesskey').attr('title', '䏿¹åè½åå¡'); 655 $('.main').find('.accesskey').attr('title', 'ä¸å¤®å §å®¹åå¡'); 656 $('footer').find('.accesskey').attr('title', '䏿¹åè½åå¡'); 657 $('.search').find('.accesskey').attr('title', 'ééµåæå°ï¼æç« ééµåæå°'); 658 } else if (weblang.substring(0, 2) !== 'zh') { 659 $('header').find('.accesskey').attr('title', 'header'); 660 $('.main').find('.accesskey').attr('title', 'content'); 661 $('footer').find('.accesskey').attr('title', 'footer'); 662 $('.search').find('.accesskey').attr('title', 'search'); 663 } 664 /*------------------------------------*/ 665 /////gotoCenter on focusè·³å° content///// 666 /*------------------------------------*/ 667 $('a.goCenter').keydown(function(e) { 668 if (e.which == 13) { 669 $('#aC').focus(); 670 $('html, body').stop(true, true).animate({ scrollTop: $('.main').find('.accesskey').offset().top - _mh }, 800, 'easeOutExpo'); 671 } 672 });
673 /*-----------------------------------*/ 674 //////// èªè¨æ¨¡çµ ç¡éç¤éèµ°è¨å® //////// 675 /*-----------------------------------*/ 676 $('.language').find('ul').hide(); 677 var openLang = $('.language').children('a'); 678 openLang.off().click(function(e) { 679 $(this).next('ul').stop(true, true).slideToggle(); 680 e.preventDefault(); 681 }); 682 openLang.keyup(function() { 683 $(this).next('ul').stop(true, true).slideDown(); 684 }); 685 $('.language').find('ul li:last>a').focusout(function() { 686 $('.language').find('ul').hide(); 687 }); 688 $(document).on('touchend click', function(e) { 689 var target = e.target; 690 if (!$(target).is('.language a')) { 691 $('.language').find('ul').hide(); 692 } 693 }); 694 // /*------------------------------------*/ 695 // ///////table å ä¸é¿æå¼table wrapper///// 696 // /*------------------------------------*/ 697 $('table').each(function(index, el) { 698 //夿·æ²ætable_list 699 if ($(this).parents('.table_list').length == 0 && $(this).parents('.fix_th_table').length == 0 && $(this).parent('form').length == 0) { 700 $(this).scroltable(); 701 } 702 }); 703 // tablearrow arrowï¼çºäºè¨å®ç®é 704 $('.scroltable-nav-left').append('<div class="tablearrow_left" style="display:none;"></div>'); 705 $('.scroltable-nav-right').append('<div class="tablearrow_right" style="display:none;"></div>'); 706 // åºå®çé 707 function table_Arrow() { 708 if ($('table').parents('.table_list').length == 0 && $('table').parents('.fix_th_table').length == 0 && $(this).parent('form').length == 0) { 709 if ($('.scroltable-wrapper').length > 0) { 710 var stickyArrowTop = Math.floor($('.scroltable-wrapper').offset().top), 711 thisScroll = Math.floor($(this).scrollTop()); 712 if (thisScroll > stickyArrowTop - 230) { 713 $('.scroltable-wrapper .tablearrow_left').css('display', 'block'); 714 $('.scroltable-wrapper .tablearrow_left').css({ "top": thisScroll - stickyArrowTop + 220 }, 100, 'easeOutQuint'); 715 $('.scroltable-wrapper .tablearrow_right').css('display', 'block'); 716 $('.scroltable-wrapper .tablearrow_right').css({ "top": thisScroll - stickyArrowTop + 220 }, 100, 'easeOutQuint'); 717 } else { 718 $('.scroltable-wrapper .tablearrow_left').css({ 719 top: '10px', 720 display: 'none' 721 }); 722 $('.scroltable-wrapper .tablearrow_right').css({ 723 top: '10px', 724 display: 'none' 725 }); 726 } 727 } 728 } 729 } 730 $(window).scroll(function(event) { 731 table_Arrow(); 732 }); 733 var scrollTimer; 734 _window.scroll(function() { 735 clearTimeout(scrollTimer); 736 scrollTimer = setTimeout(function() { 737 table_Arrow(); 738 }, 50); 739 }); 740 // /*------------------------------------*/ 741 // //////////table å ä¸ data-title////////// 742 // /*------------------------------------*/ 743 function rwdTable() { 744 $('.table_list').find('table').each(function() { 745 var $row = $(this).find('tr'); 746 rowCount = $row.length; 747 for (var n = 1; n <= rowCount; n++) { 748 $(this).find('th').each(function(index) { 749 var thText = $(this).text(); 750 $row.eq(n).find('td').eq(index).attr('data-title', thText); 751 }); 752 } 753 }); 754 } 755 rwdTable(); 756 /*-----------------------------------*/ 757 ////////////// lazy load ////////////// 758 /*-----------------------------------*/ 759 if ($('img.lazy').length > 0) { 760 var lazyLoadInstance = new LazyLoad({ 761 elements_selector: "img.lazy", 762 placeholder: '/images/basic/placeholder.gif', 763 effect: "fadeIn", 764 fadeTime: 200, 765 threshold: 0 766 }); 767 } 768 /*-----------------------------------*/
769 ////////////////unimenu//////////////// 770 /*-----------------------------------*/ 771 $('nav.units_block').hide(); 772 773 function openuni() { 774 $('nav.units_block').css('top', '0px'); 775 $('nav.units_block').slideDown(600, 'easeOutQuart'); 776 $(this).hide(); 777 $('body').addClass('noscroll'); 778 } 779 780 function closeuni() { 781 $('nav.units_block').fadeOut(400, function() { 782 $(this).css('top', '-2000px'); 783 }); 784 $('body').removeClass('noscroll'); 785 } 786 $('nav.units_block .close,nav.units_block .overlay').click(function(event) { 787 closeuni(); 788 }); 789 $('nav.units_block>ul>li:last-child>ul>li:last-child a').focusout(function() { 790 closeuni(); 791 }); 792 793 794 $('.units').click(function(event) { 795 openuni(); 796 }); 797 798});
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.