1window.requestAnimFrame = (function(callback) { 2 return window.requestAnimationFrame || 3 window.webkitRequestAnimationFrame || 4 window.mozRequestAnimationFrame || 5 window.oRequestAnimationFrame || 6 window.msRequestAnimationFrame || 7 function(callback) { 8 return window.setTimeout(callback, 1000 / 60); 9 }; 10})(); 11 12window.cancelAnimFrame = (function(_id) { 13 return window.cancelAnimationFrame || 14 window.cancelRequestAnimationFrame || 15 window.webkitCancelAnimationFrame || 16 window.webkitCancelRequestAnimationFrame || 17 window.mozCancelAnimationFrame || 18 window.mozCancelRequestAnimationFrame || 19 window.msCancelAnimationFrame || 20 window.msCancelRequestAnimationFrame || 21 window.oCancelAnimationFrame || 22 window.oCancelRequestAnimationFrame || 23 function(_id) { window.clearTimeout(id); }; 24})(); 25 26function closest(el, selector) { 27 // type el -> Object 28 // type select -> String 29 var matchesFn; 30 // find vendor prefix 31 ['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'].some(function(fn) { 32 if (typeof document.body[fn] == 'function') { 33 matchesFn = fn; 34 return true; 35 } 36 return false; 37 }) 38 var parent; 39 // traverse parents 40 while (el) { 41 parent = el.parentElement; 42 if (parent && parent[matchesFn](selector)) { 43 return parent; 44 } 45 el = parent; 46 } 47 return null; 48} 49 50function getCssProperty(elem, property) { 51 return window.getComputedStyle(elem, null).getPropertyValue(property); 52} 53var easingEquations = { 54 easeOutSine: function(pos) { 55 return Math.sin(pos * (Math.PI / 2)); 56 }, 57 easeInOutSine: function(pos) { 58 return (-0.5 * (Math.cos(Math.PI * pos) - 1)); 59 }, 60 easeInOutQuint: function(pos) { 61 if ((pos /= 0.5) < 1) { 62 return 0.5 * Math.pow(pos, 5); 63 } 64 return 0.5 * (Math.pow((pos - 2), 5) + 2); 65 } 66}; 67 68function isPartiallyVisible(el) { 69 var elementBoundary = el.getBoundingClientRect(); 70 var top = elementBoundary.top; 71 var bottom = elementBoundary.bottom; 72 var height = elementBoundary.height; 73 return ((top + height >= 0) && (height + window.innerHeight >= bottom)); 74} 75 76function isFullyVisible(el) { 77 var elementBoundary = el.getBoundingClientRect(); 78 var top = elementBoundary.top; 79 var bottom = elementBoundary.bottom; 80 return ((top >= 0) && (bottom <= window.innerHeight)); 81} 82 83function CreateElementWithClass(elementName, className) { 84 var el = document.createElement(elementName); 85 el.className = className; 86 return el; 87} 88 89function createElementWithId(elementName, idName) { 90 var el = document.createElement(elementName); 91 el.id = idName; 92 return el; 93} 94 95function detectIE() { 96 var ua = window.navigator.userAgent; 97 var msie = ua.indexOf('MSIE '); 98 var trident = ua.indexOf('Trident/'); 99 if (msie > 0 || trident > 0) { 100 // IE 10 or older => return version number 101 // return 'ie'+parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); 102 return 'ie'; 103 } 104 return false; 105} 106 107 108var Base = function() { 109 ! function Base() { 110 new Menu(); 111 new Sticky(); 112 new PageTop(); 113 new Anchor(); 114 new ObjFit(); 115 }(); 116 return Base; 117}; 118 119window.addEventListener('DOMContentLoaded', function() { 120 if (window.jQuery) window.Velocity = window.jQuery.fn.velocity; 121 if (detectIE()) { 122 document.body.classList.add(detectIE()); 123 } 124 new Base(); 125}); 126 127var Sticky = function() { 128 function Sticky() { 129 var s = this; 130 this._target = document.getElementById('header'); 131 this._basic_height = this._target.clientHeight; 132 this._mobile = document.getElementById('bHeader__bottom'); 133 this._for_sp = function(top) { 134 s._target.style.left = 0; 135 document.body.style.paddingTop = s._target.clientHeight + 'px'; 136 if (top > 0) { 137 s._target.classList.add('fixed'); 138 document.body.style.paddingTop = s._target.clientHeight + 'px'; 139 } else { 140 s._target.classList.remove('fixed'); 141 document.body.style.paddingTop = 0; 142 } 143 } 144 this._for_pc = function(top, _left) { 145 s._mobile.style.top = 0; 146 var offset = s._target.querySelector('.bHeader__top').clientHeight; 147 if (top > offset) { 148 s._target.classList.add('fixed'); 149 s._mobile.style.left = -_left + 'px'; 150 document.body.style.paddingTop = s._mobile.clientHeight + parseInt(getCssProperty(s._mobile, 'border-top-width')) + 'px'; 151 } else { 152 document.body.style.paddingTop = 0; 153 s._target.classList.remove('fixed'); 154 s._mobile.style.left = 0; 155 } 156 }; 157 this.handling = function() { 158 var _top = document.documentElement.scrollTop || document.body.scrollTop; 159 var _left = document.documentElement.scrollLeft || document.body.scrollLeft; 160 if (window.innerWidth < 769) { 161 s._for_sp(_top); 162 } else { 163 s._for_pc(_top, _left); 164 } 165 }; 166 window.addEventListener('scroll', s.handling, false); 167 window.addEventListener('resize', s.handling, false); 168 window.addEventListener('load', s.handling, false); 169 } 170 return Sticky; 171}(); 172 173var Menu = (function() { 174 function Menu() { 175 var m = this; 176 this._target = document.getElementById('icon_nav'); 177 this._mobile = document.getElementById('nav'); 178 this._header = document.getElementById('header'); 179 this._target.addEventListener('click', function() { 180 if (this.classList.contains('open')) { 181 this.classList.remove('open'); 182 m._mobile.classList.remove('open'); 183 m._mobile.style.height = 0; 184 document.body.style.overflow = 'inherit'; 185 } else { 186 this.classList.add('open'); 187 m._mobile.classList.add('open'); 188 document.body.style.overflow = 'hidden'; 189 m._mobile.style.height = window.innerHeight + 'px'; 190 m._mobile.style.top = 0; 191 } 192 }) 193 this._reset = function() { 194 if (m._target.classList.contains('open')) { 195 if (window.innerWidth > 768) { 196 m._target.classList.remove('open'); 197 m._mobile.classList.remove('open'); 198 document.body.style.overflow = 'auto'; 199 m._mobile.style.height = 'auto'; 200 document.body.style.paddingTop = m._header.clientHeight + 'px'; 201 m._mobile.style.height = 'auto'; 202 } else { 203 m._mobile.style.height = window.innerHeight + 'px'; 204 m._mobile.style.top = 0; 205 } 206 } else { 207 if (window.innerWidth < 769) { 208 m._mobile.style.height = 0; 209 } else { 210 m._mobile.style.height = 'auto'; 211 } 212 } 213 } 214 this._reset(); 215 window.addEventListener('resize', m._reset, false); 216 }
217 return Menu; 218})(); 219 220var PageTop = (function() { 221 function PageTop() { 222 var pa = this; 223 this._target = document.getElementById('pagetop'); 224 this.flag_start = false; 225 this.stopEverything = function() { 226 pa.flag_start = false; 227 } 228 this.scrollToY = function(scrollTargetY, speed, easing) { 229 var scrollY = window.scrollY || window.pageYOffset, 230 scrollTargetY = scrollTargetY || 0, 231 speed = speed || 2000, 232 easing = easing || 'easeOutSine', 233 currentTime = 0; 234 var time = Math.max(.1, Math.min(Math.abs(scrollY - scrollTargetY) / speed, .8)); 235 236 function tick() { 237 if (pa.flag_start) { 238 currentTime += 1 / 60; 239 var p = currentTime / time; 240 var t = easingEquations[easing](p); 241 if (p < 1) { 242 requestAnimFrame(tick); 243 window.scrollTo(0, scrollY + ((scrollTargetY - scrollY) * t)); 244 } else { 245 window.scrollTo(0, scrollTargetY); 246 } 247 } 248 } 249 tick(); 250 } 251 this._target.addEventListener('click', function(e) { 252 e.preventDefault(); 253 pa.flag_start = true; 254 pa.scrollToY(0, 1000, 'easeOutSine'); 255 }) 256 document.querySelector("body").addEventListener('mousewheel', pa.stopEverything, false); 257 document.querySelector("body").addEventListener('DOMMouseScroll', pa.stopEverything, false); 258 } 259 return PageTop; 260})(); 261 262var Anchor = (function() { 263 function Anchor() { 264 var a = this; 265 this._target = '.anchor'; 266 this._headerBt = document.getElementById('bHeader__bottom'); 267 this._header = document.getElementById('header'); 268 this._icon_nav = document.getElementById('icon_nav'); 269 this._nav = document.getElementById('nav'); 270 this.timer; 271 this.flag_start = false; 272 this.iteration; 273 this.eles = document.querySelectorAll(this._target); 274 this.stopEverything = function() { a.flag_start = false; } 275 this._getbuffer = function() { 276 var _buffer; 277 if (window.innerWidth < 769) { 278 _buffer = a._header.clientHeight; 279 } else { 280 _buffer = a._headerBt.clientHeight; 281 } 282 return _buffer; 283 } 284 285 this.scrollToY = function(scrollTargetY, speed, easing) { 286 var scrollY = window.scrollY || window.pageYOffset, 287 scrollTargetY = scrollTargetY || 0, 288 speed = speed || 2000, 289 easing = easing || 'easeOutSine', 290 currentTime = 0; 291 var time = Math.max(.1, Math.min(Math.abs(scrollY - scrollTargetY) / speed, .8)); 292 293 function tick() { 294 if (a.flag_start) { 295 currentTime += 1 / 60; 296 var p = currentTime / time; 297 var t = easingEquations[easing](p); 298 if (p < 1) { 299 requestAnimFrame(tick); 300 window.scrollTo(0, scrollY + ((scrollTargetY - scrollY) * t)); 301 } else { window.scrollTo(0, scrollTargetY); } 302 } 303 } 304 tick(); 305 } 306 Array.prototype.forEach.call(this.eles, function(el, i) { 307 el.addEventListener('click', function(e) { 308 var next = el.getAttribute('href').split('#')[1]; 309 if (document.getElementById(next)) { 310 a.flag_start = true; 311 e.preventDefault(); 312 a.scrollToY((document.getElementById(next).offsetTop - a._getbuffer()), 1500, 'easeOutSine'); 313 if (window.innerWidth < 769) { 314 a._icon_nav.classList.remove('open'); 315 a._nav.classList.remove('open'); 316 document.body.style.overflow = "inherit"; 317 } 318 } 319 }) 320 }); 321 this._start = function() { 322 var next = window.location.hash.split('#')[1]; 323 a.flag_start = true; 324 if (next) { a.scrollToY((document.getElementById(next).offsetTop - a._getbuffer()), 1500, 'easeOutSine'); } 325 } 326 window.addEventListener('load', a._start, false); 327 document.querySelector("body").addEventListener('mousewheel', a.stopEverything, false); 328 document.querySelector("body").addEventListener('DOMMouseScroll', a.stopEverything, false); 329 } 330 return Anchor; 331})(); 332 333var ObjFit = (function() { 334 function ObjFit() { 335 var o = this; 336 this._els = document.querySelectorAll('.wrap_obj'); 337 this._handling = function() { 338 Array.prototype.forEach.call(o._els, function(el) { 339 var _src = el.querySelector('img').src; 340 el.style.backgroundImage = "url(" + _src + ")"; 341 }) 342 } 343 if (detectIE()) { 344 o._handling(); 345 } 346 } 347 return ObjFit; 348})(); 349 350 351/* images pc <---> sp */ 352(function() { 353 var PicturePolyfill = (function() { 354 function PicturePolyfill() { 355 var _this = this; 356 this.pictures = []; 357 this.onResize = function() { 358 var width = document.body.clientWidth; 359 for (var i = 0; i < _this.pictures.length; i = (i + 1)) { 360 _this.pictures[i].update(width); 361 }; 362 }; 363 if ([].includes) return; 364 var picture = Array.prototype.slice.call(document.getElementsByTagName('picture')); 365 for (var i = 0; i < picture.length; i = (i + 1)) {
366 this.pictures.push(new Picture(picture[i])); 367 }; 368 window.addEventListener("resize", this.onResize, false); 369 this.onResize(); 370 } 371 return PicturePolyfill; 372 }()); 373 var Picture = (function() { 374 function Picture(node) { 375 var _this = this; 376 this.update = function(width) { 377 width <= _this.breakPoint ? _this.toSP() : _this.toPC(); 378 }; 379 this.toSP = function() { 380 if (_this.isSP) return; 381 _this.isSP = true; 382 _this.changeSrc(); 383 }; 384 this.toPC = function() { 385 if (!_this.isSP) return; 386 _this.isSP = false; 387 _this.changeSrc(); 388 }; 389 this.changeSrc = function() { 390 var toSrc = _this.isSP ? _this.srcSP : _this.srcPC; 391 _this.img.setAttribute('src', toSrc); 392 }; 393 this.img = node.getElementsByTagName('img')[0]; 394 this.srcPC = this.img.getAttribute('src'); 395 var source = node.getElementsByTagName('source')[0]; 396 this.srcSP = source.getAttribute('srcset'); 397 this.breakPoint = Number(source.getAttribute('media').match(/(\d+)px/)[1]); 398 this.isSP = !document.body.clientWidth <= this.breakPoint; 399 this.update(); 400 } 401 return Picture; 402 }()); 403 new PicturePolyfill(); 404}());
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.