1var _ua = (function(u) { 2 return { 3 Tablet: (u.indexOf("windows") != -1 && u.indexOf("touch") != -1 && u.indexOf("tablet pc") == -1) || 4 u.indexOf("ipad") != -1 || 5 (u.indexOf("android") != -1 && u.indexOf("mobile") == -1) || 6 (u.indexOf("firefox") != -1 && u.indexOf("tablet") != -1) || 7 u.indexOf("kindle") != -1 || 8 u.indexOf("silk") != -1 || 9 u.indexOf("playbook") != -1, 10 Mobile: (u.indexOf("windows") != -1 && u.indexOf("phone") != -1) || 11 u.indexOf("iphone") != -1 || 12 u.indexOf("ipod") != -1 || 13 (u.indexOf("android") != -1 && u.indexOf("mobile") != -1) || 14 (u.indexOf("firefox") != -1 && u.indexOf("mobile") != -1) || 15 u.indexOf("blackberry") != -1, 16 Ipad: u.indexOf("ipad") != -1 17 } 18})(window.navigator.userAgent.toLowerCase()); 19 20 21 22 23 24 25 26(function($) { 27 var lang = $('html').attr('lang'); 28 $.SmartMenus.prototype.old_init = $.SmartMenus.prototype.init; 29 $.SmartMenus.prototype.init = function(refresh) { 30 if (!refresh && !this.$root.hasClass('sm-vertical')) { 31 const txtMore = (lang == 'en') ? "More" : "æ´å¤+"; 32 const selector = `<li ><a href="#" id="more-menu">${txtMore} </a></li>`; 33 var $originalItems = this.$root.children('li'), 34 $moreSub = this.$root.clone().removeAttr('id').removeAttr('class').addClass('dropdown-menu'), 35 $moreSubItems = $moreSub.children('li'), 36 $moreItem = $(selector).append($moreSub).appendTo(this.$root), 37 self = this, 38 vieportW, 39 hiddenItems = [], 40 hiddenMoreItems = []; 41 } 42 43 this.old_init(refresh); 44 45 if (!refresh && !this.$root.hasClass('sm-vertical')) { 46 function handleResize(force) { 47 var curWidth = $(window).width(); 48 if (vieportW !== curWidth || force) { 49 // hide More item 50 $moreItem.detach(); 51 52 // show all main menu items 53 $.each(hiddenItems, function() { 54 $(this).appendTo(self.$root); 55 }); 56 hiddenItems = []; 57 58 // show all More sub items 59 $.each(hiddenMoreItems, function() { 60 $(this).prependTo($moreSub); 61 }); 62 hiddenMoreItems = []; 63 64 // if in desktop view and the last item is wrapped 65 if (!self.$root.hasClass('sm-vertical') && (/^(left|right)$/.test(self.$firstLink.parent().css('float')) || self.$firstLink.parent().css('display') == 'table-cell') && $originalItems.eq(-1)[0].offsetTop != $originalItems.eq(0)[0].offsetTop) { 66 // show More item 67 $moreItem.appendTo(self.$root); 68 69 // while the More item is wrapped 70 while ($moreItem[0].offsetTop != $originalItems.eq(0)[0].offsetTop) { 71 hiddenItems.unshift($moreItem.prev('li').detach()); 72 }; 73 74 // hide proper More sub items 75 $moreSubItems.slice(0, $moreSubItems.length - hiddenItems.length).each(function() { 76 hiddenMoreItems.unshift($(this).detach()); 77 }); 78 } 79 80 // save new viewport width 81 vieportW = curWidth; 82 } 83 } 84 handleResize(); 85 86 $(window).bind({ 87 'load.smartmenus': function() { 88 handleResize(true); 89 }, 90 'resize.smartmenus': handleResize 91 }); 92 } 93 }; 94 95 // Fix isCollapsible method 96 $.SmartMenus.prototype.isCollapsible = function() { 97 return this.$root.find('ul').eq(0).css('position') == 'static'; 98 }; 99 100 101 102 103 // Link slider 104 $('#link-slider').slick({ 105 autoplay: true, 106 autoplaySpeed: 3000, 107 slidesToShow: 8, 108 slidesToScroll: 1, 109 mobileFirst: true, 110 arrows: true, 111 prevArrow: $('.link-prev-button'), 112 nextArrow: $('.link-next-button'), 113 responsive: [{ 114 breakpoint: 1920, 115 settings: { 116 slidesToShow: 6, 117 slidesToScroll: 1, 118 infinite: true, 119 dots: false 120 } 121 }, 122 { 123 breakpoint: 1480, 124 settings: { 125 slidesToShow: 6, 126 slidesToScroll: 1, 127 infinite: true, 128 dots: false 129 } 130 }, 131 132 { 133 breakpoint: 1400, 134 settings: { 135 slidesToShow: 4, 136 slidesToScroll: 1, 137 infinite: true, 138 dots: false 139 } 140 }, 141 { 142 breakpoint: 1024, 143 settings: { 144 slidesToShow: 4, 145 slidesToScroll: 1, 146 infinite: true, 147 dots: false 148 } 149 }, 150 { 151 breakpoint: 800, 152 settings: { 153 slidesToShow: 3, 154 slidesToScroll: 1, 155 infinite: true, 156 } 157 }, 158 { 159 breakpoint: 414, 160 settings: { 161 slidesToShow: 1, 162 slidesToScroll: 1, 163 centerMode: true, 164 infinite: true, 165 // centerPadding: '40px', 166 } 167 }, 168 169 { 170 breakpoint: 280, 171 settings: { 172 slidesToShow: 1, 173 slidesToScroll: 1, 174 centerMode: true, 175 infinite: true, 176 // centerPadding: '40px', 177 } 178 } 179 ] 180 }); 181 182})(jQuery); 183 184 185 186 187// SmartMenus init 188// showTimeout: 0 set show delay time. 189$(function() { 190 var sm = $('#main-menu').smartmenus({
191 mainMenuSubOffsetX: 0, 192 mainMenuSubOffsetY: 0, 193 subMenusSubOffsetX: -2, 194 subMenusSubOffsetY: -8, 195 subMenusMinWidth: '12em', 196 subMenusMaxWidth: '25em', 197 collapsibleShowDuration: 0, 198 collapsibleHideDuration: 0, 199 hideDuration: 0, 200 showDuration: 0, 201 hideTimeout: 200, 202 showTimeout: 0, 203 keepHighlighted: true, 204 showFunction: function($ul, complete) { $ul.fadeIn(250, complete); }, 205 }); 206}); 207 208 209// SmartMenus mobile menu toggle button 210$(function() { 211 // $('span').removeClass('sub-arrow'); 212 var $mainMenuState = $('#main-menu-state'); 213 214 if ($mainMenuState.length) { 215 // animate mobile menu 216 $mainMenuState.change(function(e) { 217 var $menu = $('#main-menu'); 218 if (this.checked) { 219 // $menu.css('display', ''); 220 $menu.hide().slideDown(250, function() {}); 221 } else { 222 $menu.show().slideUp(250, function() {}); 223 } 224 document.getElementsByTagName('body').foucs(); 225 }); 226 // hide mobile menu beforeunload 227 $(window).bind('beforeunload unload', function() { 228 if ($mainMenuState[0].checked) { 229 $mainMenuState[0].click(); 230 } 231 }); 232 233 $(window).on('resize', function() { 234 var win = $(this); //this = window 235 if (win.width() >= 768) { 236 $('#main-menu').show(); 237 } else { 238 $('#main-menu').hide(); 239 if ($mainMenuState[0].checked) { 240 $mainMenuState[0].click(); 241 } 242 } 243 }); 244 } 245}); 246 247$(document).ready(function() { 248 // Mobile Touch 249 if (_ua.Mobile || _ua.Tablet) { 250 $('body').addClass('touchdevice'); 251 } else { 252 $('body').addClass('notouch'); 253 } 254 if (_ua.Mobile) { 255 $('body').addClass('mobile'); 256 } 257 if (_ua.Tablet) { 258 $('body').addClass('tablet'); 259 } 260 261 262 263 264 265 266 267 268 var slideWrapper = $(".top-slider-section"); 269 var iframes = slideWrapper.find('.embed-player'); 270 var lazyImages = slideWrapper.find('.slide-image'); 271 lazyCounter = 0; 272 273 // console.log("slide wrapper", slideWrapper); 274 275 // POST commands to YouTube or Vimeo API 276 function postMessageToPlayer(player, command) { 277 if (player == null || command == null) return; 278 player.contentWindow.postMessage(JSON.stringify(command), "*"); 279 } 280 281 282 // When the slide is changing 283 function playPauseVideo(slick, control) { 284 var currentSlide, slideType, startTime, player, video; 285 286 setTimeout(function() { 287 console.log("refresh"); 288 BackgroundCheck.refresh(); 289 }, 100); 290 291 currentSlide = slick.find(".slick-current"); 292 // console.log("currentSlide", currentSlide.length); 293 if (currentSlide.length > 0) { 294 slideType = currentSlide.attr("class").split(" ")[1]; 295 player = currentSlide.find("iframe").get(0); 296 startTime = currentSlide.data("video-start"); 297 298 if (slideType === "vimeo") { 299 switch (control) { 300 case "play": 301 if ((startTime != null && startTime > 0) && !currentSlide.hasClass('started')) { 302 currentSlide.addClass('started'); 303 postMessageToPlayer(player, { 304 "method": "setCurrentTime", 305 "value": startTime 306 }); 307 } 308 postMessageToPlayer(player, { 309 "method": "play", 310 "value": 1 311 }); 312 break; 313 case "pause": 314 postMessageToPlayer(player, { 315 "method": "pause", 316 "value": 1 317 }); 318 break; 319 } 320 } else if (slideType === "youtube") { 321 // console.log("player ", player); 322 switch (control) { 323 case "play": 324 // postMessageToPlayer(player, { 325 // "event": "command", 326 // "func": "mute" 327 // }); 328 postMessageToPlayer(player, { 329 "event": "command", 330 "func": "playVideo" 331 }); 332 break; 333 case "pause": 334 postMessageToPlayer(player, { 335 "event": "command", 336 "func": "pauseVideo" 337 }); 338 break; 339 } 340 } else if (slideType === "video") { 341 video = currentSlide.children("video").get(0); 342 // console.log("video", video); 343 if (video != null) { 344 if (control === "play") { 345 // video.muted = false;
346 // setTimeout(function() { 347 video.play(); 348 // }, 1000); 349 } else { 350 video.pause(); 351 } 352 } 353 } 354 } 355 356 } 357 358 359 360 slideWrapper.on("init", function(slick, s) { 361 // console.log("slide Wrapper on init", slick, s.slideCount); 362 363 if (s.slideCount == 0) { 364 $("#top-section").remove(); 365 } 366 slick = $(slick.currentTarget); 367 setTimeout(function() { 368 playPauseVideo(slick, "play"); 369 }, 1000); 370 resizePlayer(iframes, 16 / 9); 371 }); 372 slideWrapper.on("beforeChange", function(event, slick) { 373 slick = $(slick.$slider); 374 playPauseVideo(slick, "pause"); 375 }); 376 slideWrapper.on("afterChange", function(event, slick) { 377 slick = $(slick.$slider); 378 playPauseVideo(slick, "play"); 379 }); 380 slideWrapper.on("lazyLoaded", function(event, slick, image, imageSource) { 381 lazyCounter++; 382 if (lazyCounter === lazyImages.length) { 383 lazyImages.addClass('show'); 384 // slideWrapper.slick("slickPlay"); 385 } 386 }); 387 388 $(".mute-btn").click(function() { 389 var id = $(this).attr('rel'); 390 var muteStatus = $(this).attr('data-mute'); 391 if (muteStatus == 'mute') { 392 $(this).attr('data-mute', 'unmute'); 393 postMessageToPlayer(iframes[id], { 394 "event": "command", 395 "func": "mute" 396 }); 397 $(this).find('.fa').remove(); 398 $(this).find('.btn').append('<i class="fa fa-volume-off"></i>'); 399 } else { 400 $(this).attr('data-mute', 'mute'); 401 $(this).find('.fa').remove(); 402 $(this).find('.btn').append('<i class="fa fa-volume-up"></i>'); 403 404 // console.log('iframes[id]', iframes[id]); 405 postMessageToPlayer(iframes[id], { 406 "event": "command", 407 "func": "unMute" 408 }); 409 } 410 }); 411 412 413 $(".mp4-mute-btn").click(function() { 414 var id = $(this).attr('rel'); 415 var muteStatus = $(this).attr('data-mute'); 416 // console.log("mute status", muteStatus); 417 var video = $(this).siblings('.slide-video').get(0); 418 if (muteStatus == 'mute') { 419 $(this).attr('data-mute', 'mute'); 420 $(this).find('.fa').remove(); 421 $(this).find('.btn').append('<i class="fa fa-volume-off"></i>'); 422 video.muted = false; 423 } else { 424 $(this).attr('data-mute', 'unmute'); 425 $(this).find('.fa').remove(); 426 $(this).find('.btn').append('<i class="fa fa-volume-up"></i>'); 427 video.muted = true; 428 } 429 }); 430 431 432 //è¨å®ææ¾æé 433 var speed = 300; 434 var attr = slideWrapper.attr('data-speed'); 435 if (typeof attr !== typeof undefined && attr !== false) { 436 speed = parseInt(attr) * 100; 437 } 438 439 slideWrapper.slick({ 440 autoplay: true, 441 speed: speed, 442 autoplaySpeed: 4000, 443 // centerMode: true, 444 lazyLoad: "progressive", 445 dots: false, 446 arrows: true, 447 prevArrow: '#prev-button', 448 nextArrow: '#next-button', 449 cssEase: "cubic-bezier(0.87, 0.03, 0.41, 0.9)", 450 451 responsive: [{ 452 breakpoint: 480, 453 settings: { 454 adaptiveHeight: true, 455 // centerMode: false, 456 // width: 1280, 457 // height:500, 458 // dots: false, 459 } 460 }] 461 }); 462 463 464 465 466 467 // Resize player 468 function resizePlayer(iframes, ratio) { 469 // console.log("iframes ", iframes); 470 if (!iframes[0]) return; 471 472 473 var win = $(".top-slider-section"), 474 width = win.width(), 475 playerWidth, 476 height = win.height(), 477 playerHeight, 478 ratio = ratio || 16 / 9; 479 480 iframes.each(function() { 481 var current = $(this); 482 if (width / ratio < height) { 483 playerWidth = Math.ceil(height * ratio); 484 current.width(playerWidth).height(height).css({ 485 left: (width - playerWidth) / 2, 486 top: 0 487 }); 488 } else {
489 playerHeight = Math.ceil(width / ratio); 490 current.width(width).height(playerHeight).css({ 491 left: 0, 492 top: (height - playerHeight) / 2 493 }); 494 } 495 }); 496 } 497 498 499 // Go Top 500 $('.go_page_top').on('click', function() { 501 $('html,body').animate({ scrollTop: 0 }, 10); 502 }); 503 504 505 // Resize event 506 $(window).on("resize.slickVideoPlayer", function() { 507 resizePlayer(iframes, 16 / 9); 508 }); 509 510 511 512 513 /* magnificPopup video popup */ 514 $('.video-popup').magnificPopup({ 515 type: 'iframe', 516 iframe: { 517 markup: '<div class="mfp-iframe-scaler">' + 518 '<div class="mfp-close"></div>' + 519 '<iframe class="mfp-iframe" frameborder="0" allowfullscreen="true" autoplay="true" style="border:none;overflow:hidden" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share;" ></iframe>' + 520 '</div>', // HTML 521 patterns: { 522 youtube: { 523 index: 'youtube.com/', // String that detects type of video (in this case YouTube). Simply via url.indexOf(index). 524 id: function(url) { 525 var m = url.match(/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/); 526 // console.log("youtube id", m); 527 if (m !== null) { 528 if (m[7] !== undefined) { 529 var r = m[7]; 530 // console.log('//www.youtube.com/embed/' + r + '?autoplay=0&rel=0&mute=0'); 531 return m[7] + "?playlist=" + m[7]; 532 } 533 return m[2]; 534 } 535 return null; 536 }, 537 src: 'https://www.youtube.com/embed/%id%&autoplay=1&mute=0&loop=1&vq=hd1080&rel=0&showinfo=0&color=white&iv_load_policy=3&hd=1', 538 }, 539 // facebook: { 540 // index: 'facebook.com', 541 // id: function(url) { 542 // url = url.substring(0, url.lastIndexOf('/') - 1); 543 // console.log("facebook opened", url); 544 // // https: //www.facebook.com/plugins/video.php?href=https://www.facebook.com%2{PAGE_NAME}/videos/{VIDEO_ID}/ 545 // return url; 546 // }, 547 // src: encodeURI('https: //www.facebook.com/plugins/video.php?href=%id%') 548 // }, 549 mp4: { 550 index: 'mp4', 551 src: '%id%?autoplay=1&mute=0' 552 } 553 }, 554 555 srcAction: 'iframe_src', // Templating object key. First part defines CSS selector, second attribute. "iframe_src" means: find "iframe" and set attribute "src". 556 } 557 }); 558 559 560 561 // $('.main-menu-btn').on('click', function() { 562 // $('html,body').animate({ scrollTop: 0 }, 10); 563 // }); 564 565 566 // When using fixed header the mobile menu scrolling function will be disabled, so we have to add scrolling by ourselves. 567 // var el = $('#main-menu'); 568 // var elpos = el.offset().top; 569 // $(window).scroll(function() { 570 // var width = $(window).width(); 571 // if (width <= 769) { 572 // var y = $(this).scrollTop(); 573 // if (y < elpos) { 574 // el.stop().animate({ 'top': 0 }, 10); 575 // } else { 576 // el.stop().animate({ 'bottom': y - elpos }, 0); 577 // } 578 // } 579 // }); 580}); 581 582 583 584 585 586 587 588 589function showTab(evt, label) { 590 var i, tabcontent, tablinks; 591 showCate = label; 592 label = "cat_" + label; 593 tabcontent = document.getElementsByClassName("grid-item"); 594 // set all items display to none. 595 for (i = 0; i < tabcontent.length; i++) { 596 tabcontent[i].style.display = "none"; 597 } 598 599 tablinks = document.getElementsByClassName("list-item"); 600 for (i = 0; i < tablinks.length; i++) { 601 var linkEle = tablinks[i].getElementsByClassName("item-link")[0]; 602 linkEle.classList.remove("active"); 603 } 604 605 for (i = 0; i < tablinks.length; i++) { 606 if (tablinks[i].id != label) { 607 var linkEle = tablinks[i].getElementsByClassName("item-link")[0]; 608 linkEle.className = linkEle.className.replace('item-link active'); 609 } 610 } 611 612 if (showCate != 'all') { 613 var filtered = document.getElementsByClassName(showCate); 614 for (i = 0; i < filtered.length; i++) { 615 filtered[i].style.display = "block"; 616 } 617 } else { 618 for (i = 0; i < tabcontent.length; i++) { 619 tabcontent[i].style.display = "block"; 620 } 621 } 622 623 evt.currentTarget.classList.add("active"); 624} 625 626 627 628var audio = document.getElementById("school-song"); 629var big = document.getElementById('big-round');
630var roundBG = document.getElementById('round-bg'); 631var wave = document.getElementById('wave'); 632var myWave = null; 633if (wave) { 634 var myWave = wavify(wave, { 635 height: 80, 636 bones: 30, 637 amplitude: 50, 638 color: '#a4a4ff', 639 speed: .25 640 }); 641 myWave.pause(); 642} 643 644function playSchoolSong() { 645 if (audio.paused) { 646 audio.play(); 647 big.classList.add("anim_circle"); 648 roundBG.classList.add("anim_circle"); 649 myWave.play(); 650 } else { 651 audio.pause(); 652 big.classList.remove("anim_circle"); 653 roundBG.classList.remove("anim_circle"); 654 myWave.pause(); 655 } 656}
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.