1/** 2 * detect mobile devices function 3 * @returns {boolean} 4 */ 5function is_mobile() { 6 return (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); 7} 8 9/** 10 * Bind on resize window 11 */ 12(function ($) { 13 $.fn.CustomResize = function (settings) { 14 var timer = 0; 15 16 settings = $.extend({ 17 resize: function () { 18 }, 19 timeout: false 20 }, settings); 21 22 function is_mobile() { 23 return (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); 24 } 25 26 function resize() { 27 if (settings.timeout) { 28 clearTimeout(timer); 29 30 timer = setTimeout(function () { 31 settings.resize(); 32 }, settings.timeout); 33 } else { 34 settings.resize(); 35 } 36 } 37 38 if (is_mobile()) { 39 $(window).on("orientationchange", function () { 40 resize(); 41 }); 42 } else { 43 $(window).on("resize", function () { 44 resize(); 45 }); 46 } 47 48 }; 49 50 var modal = { 51 52 init: function () { 53 $(document.body).on('click', '[data-toggle="modal"]', function (e) { 54 e.preventDefault(); 55 modal.showModal(this.getAttribute('data-target'), this); 56 }); 57 58 $(document.body).on('keyup', function (e) { 59 if (e.keyCode === 27 && document.querySelector('div.modal.show') !== null) { 60 modal.hideModal('#' + document.querySelector('div.modal.show').getAttribute('id')); 61 } 62 }); 63 }, 64 65 showModal: function (targetId, _button) { 66 if (targetId === null) { 67 return false; 68 } 69 70 var $target = $(targetId); 71 72 if ($target.length === 0) { 73 return false; 74 } 75 76 document.body.classList.add('modal-open'); 77 $target.addClass('show'); 78 79 $target.trigger($.Event('show_modal', { 80 relatedTarget: _button 81 })); 82 83 $(document.body).append('<div class="modal-backdrop fade"></div>');
84 var $overlay = $('.modal-backdrop'); 85 86 setTimeout(function () { 87 $target.addClass('slide'); 88 $overlay.addClass('show'); 89 90 $target.one(transitionEvent, function () { 91 $target.trigger($.Event('shown_modal', { 92 relatedTarget: _button 93 })); 94 }); 95 }, 100); 96 97 $target.find('[data-dismiss="modal"]').one('click', function () { 98 modal.hideModal(targetId); 99 }); 100 101 $target.on('click', function (e) { 102 if ($(e.target).closest('.modal-content').length === 0) { 103 modal.hideModal(targetId); 104 } 105 }); 106 }, 107 108 hideModal: function (targetId) { 109 if (targetId === null) { 110 return false; 111 } 112 113 var $target = $(targetId), 114 $overlay = $('.modal-backdrop'); 115 116 if ($target.length === 0) { 117 return false; 118 } 119 120 $target.removeClass('slide'); 121 $target.trigger('hide_modal'); 122 $overlay.removeClass('show'); 123 124 $target.off('click'); 125 $target.find('[data-dismiss="modal"]').off('click'); 126 127 setTimeout(function () { 128 $target.find('.modal-dialog').one(transitionEvent, function () { 129 document.body.classList.remove('modal-open'); 130 $target.removeClass('show'); 131 $target.trigger('hidden_modal'); 132 $overlay.remove(); 133 }); 134 }, 100); 135 } 136 137 }; 138 139 var sidebarModal = { 140 141 init: function () { 142 $(document.body).on('click', '[data-toggle="sidebar-modal"]', function (e) { 143 e.preventDefault(); 144 sidebarModal.showModal(this.getAttribute('data-target'), this); 145 }); 146 }, 147 148 showModal: function (targetId, _button) { 149 if (targetId === null) { 150 return false; 151 } 152 153 var $target = $(targetId); 154 155 if ($target.length === 0) { 156 return false; 157 } 158 159 document.body.classList.add('sidebar-modal-open'); 160 $target.addClass('show'); 161 162 $target.trigger($.Event('show_sidebar_modal', { 163 relatedTarget: _button 164 })); 165 166 $(document.body).append('<div class="modal-backdrop fade"></div>');
167 var $overlay = $('.modal-backdrop'); 168 169 setTimeout(function () { 170 $target.addClass('slide'); 171 $overlay.addClass('show'); 172 173 $target.one(transitionEvent, function () { 174 $target.trigger($.Event('shown_sidebar_modal', { 175 relatedTarget: _button 176 })); 177 }); 178 }, 100); 179 180 $target.find('[data-dismiss="sidebar-modal"]').one('click', function () { 181 sidebarModal.hideModal(targetId); 182 }); 183 184 $target.on('click', function (e) { 185 if ($(e.target).closest('.sidebar-modal-content').length === 0) { 186 sidebarModal.hideModal(targetId); 187 } 188 }); 189 }, 190 191 hideModal: function (targetId) { 192 if (targetId === null) { 193 return false; 194 } 195 196 var $target = $(targetId), 197 $overlay = $('.modal-backdrop'); 198 199 if ($target.length === 0) { 200 return false; 201 } 202 203 $target.removeClass('slide'); 204 $target.trigger('hide_sidebar_modal'); 205 $overlay.removeClass('show'); 206 207 $target.off('click'); 208 $target.find('[data-dismiss="sidebar-modal"]').off('click'); 209 210 setTimeout(function () { 211 $target.one(transitionEvent, function () { 212 document.body.classList.remove('sidebar-modal-open'); 213 $target.removeClass('show'); 214 $target.trigger('hidden_modal'); 215 $overlay.remove(); 216 }); 217 }, 100); 218 } 219 }; 220 221 $.fn.modal = modal; 222 modal.init(); 223 224 $.fn.sidebarModal = sidebarModal; 225 sidebarModal.init(); 226 227 $.fn.scrollBar = function () { 228 const self = {}; 229 230 self._scrollWrap = $(this).get(0); 231 if (self._scrollWrap === undefined || self._scrollWrap === null) { 232 return; 233 } 234 235 function init() { 236 self._scrollInner = self._scrollWrap.querySelector('.scrollable'); 237 self._scrollContent = self._scrollWrap.querySelector('.scrollable-content'); 238 self.scrollIndicatorBar = self._scrollWrap.querySelector('.sc-scroll-indicator-bar'); 239 240 self.scrollBarWidth = 1; 241 self.scrollBarOffset = 0; 242 self.mouseActive = false; 243 self.mouseX = 0; 244 245 calculate(); 246 self._scrollInner.addEventListener('scroll', scrollHandler, {passive: true}); 247 window.addEventListener('resize', calculate, {passive: true}); 248 //self.scrollIndicatorBar.addEventListener('mousedown', self.mouseClickHandler); 249 //self.scrollIndicatorBar.addEventListener('mouseup', self.mouseClickHandler); 250 //self.scrollIndicatorBar.addEventListener('mousemove', self.mouseMoveHandler); 251 } 252 253 function calculate() { 254 self.scrollBarWidth = self._scrollInner.offsetWidth / self._scrollContent.offsetWidth; 255 256 if (self.scrollBarWidth > 1) { 257 self.scrollBarWidth = 1; 258 } 259 260 if ((self._scrollContent.offsetWidth - self._scrollInner.offsetWidth) <= 0) { 261 self._scrollWrap.classList.add('disabled'); 262 } else { 263 self._scrollWrap.classList.remove('disabled'); 264 } 265 266 setStyle(); 267 } 268 269 function setStyle() { 270 self.scrollBarOffset = (self._scrollInner.scrollLeft / self._scrollInner.offsetWidth) * 100; 271 self.scrollIndicatorBar.style.transform = 'scaleX(' + self.scrollBarWidth + ') translateX(' + self.scrollBarOffset + '%)'; 272 } 273 274 function scrollHandler() { 275 setStyle(); 276 } 277 278 function mouseClickHandler(e) { 279 var self = scrollBar; 280 281 if (typeof e !== 'object') { 282 return false; 283 } 284 285 if (e.type === 'mousedown' && e.button === 0) { 286 self.mouseX = e.clientX; 287 self.mouseActive = true; 288 } else { 289 self.mouseActive = false;
290 } 291 } 292 293 function mouseMoveHandler(e) { 294 var self = scrollBar, 295 scrollBarPos = 0; 296 297 if (self.mouseActive) { 298 scrollBarPos = e.clientX - self.mouseX; 299 self._scrollInner.scrollLeft = scrollBarPos; 300 self.setStyle(); 301 } 302 } 303 304 init(); 305 }; 306 307 308})(jQuery); 309 310// Function from David Walsh: http://davidwalsh.name/css-animation-callback 311function whichTransitionEvent() { 312 var t, 313 el = document.createElement("fakeelement"); 314 315 var transitions = { 316 "transition": "transitionend", 317 "OTransition": "oTransitionEnd", 318 "MozTransition": "transitionend", 319 "WebkitTransition": "webkitTransitionEnd" 320 } 321 322 for (t in transitions) { 323 if (el.style[t] !== undefined) { 324 return transitions[t]; 325 } 326 } 327} 328 329function whichAnimationEvent(type) { 330 var t, 331 el = document.createElement("fakeelement"); 332 333 var animations = { 334 "animation": "animationend", 335 "OAnimation": "oAnimationEnd", 336 "MozAnimation": "animationend", 337 "WebkitAnimation": "webkitAnimationEnd" 338 }; 339 340 for (t in animations) { 341 if (el.style[t] !== undefined) { 342 return animations[t]; 343 } 344 } 345} 346 347var transitionEvent = whichTransitionEvent(); 348var animationEvent = whichAnimationEvent(); 349 350setCssStyles = function (el, styles) { 351 var keys = {}, i, prop; 352 353 if (typeof el[0] !== 'undefined') { 354 el = el.get(0); 355 } 356 357 keys = Object.keys(styles); 358 359 for (i = 0; i < keys.length; i++) { 360 prop = keys[i]; 361 362 if (prop === 'transition' || prop === 'transform') { 363 el.style['-webkit-' + prop] = styles[prop]; 364 el.style['-ms-' + prop] = styles[prop]; 365 el.style['-moz-' + prop] = styles[prop]; 366 el.style['-o-' + prop] = styles[prop]; 367 } 368 369 el.style[prop] = styles[prop]; 370 } 371} 372 373function getQueryStringParameter(uri, key) { 374 if (uri.indexOf('?') === -1) { 375 return false; 376 } 377 378 var params = uri.split("?")[1].split("&"); 379 for (var i = 0; i < params.length; i = i + 1) { 380 var singleParam = params[i].split("="); 381 if (singleParam[0] === key) { 382 return singleParam[1]; 383 } 384 } 385} 386 387function updateQueryStringParameter(uri, key, value) { 388 var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); 389 var separator = uri.indexOf('?') !== -1 ? "&" : "?"; 390 if (uri.match(re)) { 391 return uri.replace(re, '$1' + key + "=" + value + '$2'); 392 } else { 393 return uri + separator + key + "=" + value; 394 } 395} 396 397function removeURLParameter(url, key) { 398 //prefer to use l.search if you have a location/link object 399 var urlparts = url.split('?'); 400 if (urlparts.length >= 2) { 401 402 var prefix = encodeURIComponent(key) + '='; 403 var pars = urlparts[1].split(/[&;]/g); 404 405 //reverse iteration as may be destructive 406 for (var i = pars.length; i-- > 0;) { 407 //idiom for string.startsWith 408 if (pars[i].lastIndexOf(prefix, 0) !== -1) { 409 pars.splice(i, 1); 410 } 411 } 412 413 url = urlparts[0] + '?' + pars.join('&'); 414 return url; 415 } else { 416 return url; 417 } 418} 419 420isElementInViewport = function (element) { 421 const rect = element.getBoundingClientRect(); 422 423 return ( 424 rect.top >= 0 && 425 rect.left >= 0 && 426 rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && 427 rect.right <= (window.innerWidth || document.documentElement.clientWidth) 428 ); 429} 430 431function isElementInCenterOfViewport(selector) { 432 const elementToDetect = document.querySelector(selector); 433 const elementRect = elementToDetect.getBoundingClientRect(); 434 435 // Get the center coordinates of the element 436 const elementCenterY = elementRect.top + elementRect.height / 2; 437 438 // Get the dimensions of the viewport (the visible area of the document) 439 const viewportHeight = window.innerHeight || document.documentElement.clientHeight; 440 441 // Calculate the center coordinates of the viewport
442 const viewportCenterY = viewportHeight / 2; 443 444 // Check if the element's center is close to the viewport's center 445 const tolerance = 50; // You can adjust this value 446 return Math.abs(elementCenterY - viewportCenterY) < tolerance; 447} 448 449isElementPartInViewport = function (element, shiftTop) { 450 const rect = element.getBoundingClientRect(), 451 windowHeight = (window.innerHeight || document.documentElement.clientHeight), 452 percentVisible = 0; 453 454 if (!shiftTop) { 455 shiftTop = 0; 456 } 457 458 return !( 459 Math.floor(100 - ((((rect.top - shiftTop) >= 0 ? 0 : (rect.top - shiftTop)) / +-rect.height) * 100)) < percentVisible || 460 Math.floor(100 - (((rect.bottom - shiftTop) - windowHeight) / rect.height) * 100) < percentVisible 461 ); 462 463 /*return ( 464 rect.top >= -windowHeight && 465 rect.left >= -element.offsetWidth && 466 rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) + element.offsetHeight && 467 rect.right <= (window.innerWidth || document.documentElement.clientWidth) + element.offsetWidth 468 );*/ 469} 470 471/** 472 * Minified by jsDelivr using Terser v3.14.1. 473 * Original file: /npm/[email protected]/src/js.cookie.js 474 * 475 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files 476 */ 477!function (e) { 478 var n; 479 if ("function" == typeof define && define.amd && (define(e), n = !0), "object" == typeof exports && (module.exports = e(), n = !0), !n) { 480 var t = window.Cookies, o = window.Cookies = e(); 481 o.noConflict = function () { 482 return window.Cookies = t, o 483 } 484 } 485}(function () { 486 function e() { 487 for (var e = 0, n = {}; e < arguments.length; e++) { 488 var t = arguments[e]; 489 for (var o in t) n[o] = t[o] 490 } 491 return n 492 } 493 494 function n(e) { 495 return e.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent) 496 } 497 498 return function t(o) { 499 function r() { 500 } 501 502 function i(n, t, i) { 503 if ("undefined" != typeof document) { 504 "number" == typeof (i = e({path: "/"}, r.defaults, i)).expires && (i.expires = new Date(1 * new Date + 864e5 * i.expires)), i.expires = i.expires ? i.expires.toUTCString() : ""; 505 try { 506 var c = JSON.stringify(t); 507 /^[\{\[]/.test(c) && (t = c) 508 } catch (e) { 509 } 510 t = o.write ? o.write(t, n) : encodeURIComponent(String(t)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent), n = encodeURIComponent(String(n)).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/[\(\)]/g, escape); 511 var f = ""; 512 for (var u in i) i[u] && (f += "; " + u, !0 !== i[u] && (f += "=" + i[u].split(";")[0])); 513 return document.cookie = n + "=" + t + f 514 } 515 } 516 517 function c(e, t) { 518 if ("undefined" != typeof document) { 519 for (var r = {}, i = document.cookie ? document.cookie.split("; ") : [], c = 0; c < i.length; c++) { 520 var f = i[c].split("="), u = f.slice(1).join("="); 521 t || '"' !== u.charAt(0) || (u = u.slice(1, -1)); 522 try { 523 var a = n(f[0]); 524 if (u = (o.read || o)(u, a) || n(u), t) try { 525 u = JSON.parse(u) 526 } catch (e) { 527 } 528 if (r[a] = u, e === a) break 529 } catch (e) { 530 } 531 } 532 return e ? r[e] : r 533 } 534 } 535 536 return r.set = i, r.get = function (e) { 537 return c(e, !1) 538 }, r.getJSON = function (e) { 539 return c(e, !0) 540 }, r.remove = function (n, t) { 541 i(n, "", e(t, {expires: -1})) 542 }, r.defaults = {}, r.withConverter = t, r 543 }(function () { 544 }) 545}); 546 547/** 548 * imagesLoaded PACKAGED v4.1.4 549 * JavaScript is all like "You images are done yet or what?" 550 * MIT License 551 */ 552!function (e, t) { 553 "function" == typeof define && define.amd ? define("ev-emitter/ev-emitter", t) : "object" == typeof module && module.exports ? module.exports = t() : e.EvEmitter = t() 554}("undefined" != typeof window ? window : this, function () { 555 function e() { 556 } 557 558 var t = e.prototype; 559 return t.on = function (e, t) { 560 if (e && t) { 561 var i = this._events = this._events || {}, n = i[e] = i[e] || []; 562 return n.indexOf(t) == -1 && n.push(t), this 563 } 564 }, t.once = function (e, t) { 565 if (e && t) { 566 this.on(e, t); 567 var i = this._onceEvents = this._onceEvents || {}, n = i[e] = i[e] || {}; 568 return n[t] = !0, this 569 } 570 }, t.off = function (e, t) { 571 var i = this._events && this._events[e]; 572 if (i && i.length) { 573 var n = i.indexOf(t); 574 return n != -1 && i.splice(n, 1), this 575 } 576 }, t.emitEvent = function (e, t) { 577 var i = this._events && this._events[e]; 578 if (i && i.length) { 579 i = i.slice(0), t = t || []; 580 for (var n = this._onceEvents && this._onceEvents[e], o = 0; o < i.length; o++) { 581 var r = i[o], s = n && n[r]; 582 s && (this.off(e, r), delete n[r]), r.apply(this, t) 583 } 584 return this 585 } 586 }, t.allOff = function () { 587 delete this._events, delete this._onceEvents 588 }, e 589}), function (e, t) { 590 "use strict"; 591 "function" == typeof define && define.amd ? define(["ev-emitter/ev-emitter"], function (i) { 592 return t(e, i) 593 }) : "object" == typeof module && module.exports ? module.exports = t(e, require("ev-emitter")) : e.imagesLoaded = t(e, e.EvEmitter) 594}("undefined" != typeof window ? window : this, function (e, t) { 595 function i(e, t) { 596 for (var i in t) e[i] = t[i]; 597 return e 598 } 599 600 function n(e) { 601 if (Array.isArray(e)) return e; 602 var t = "object" == typeof e && "number" == typeof e.length; 603 return t ? d.call(e) : [e] 604 } 605 606 function o(e, t, r) { 607 if (!(this instanceof o)) return new o(e, t, r); 608 var s = e; 609 return "string" == typeof e && (s = document.querySelectorAll(e)), s ? (this.elements = n(s), this.options = i({}, this.options), "function" == typeof t ? r = t : i(this.options, t), r && this.on("always", r), this.getImages(), h && (this.jqDeferred = new h.Deferred), void setTimeout(this.check.bind(this))) : void a.error("Bad element for imagesLoaded " + (s || e)) 610 } 611 612 function r(e) { 613 this.img = e 614 } 615 616 function s(e, t) { 617 this.url = e, this.element = t, this.img = new Image 618 } 619 620 var h = e.jQuery, a = e.console, d = Array.prototype.slice; 621 o.prototype = Object.create(t.prototype), o.prototype.options = {}, o.prototype.getImages = function () {
622 this.images = [], this.elements.forEach(this.addElementImages, this) 623 }, o.prototype.addElementImages = function (e) { 624 "IMG" == e.nodeName && this.addImage(e), this.options.background === !0 && this.addElementBackgroundImages(e); 625 var t = e.nodeType; 626 if (t && u[t]) { 627 for (var i = e.querySelectorAll("img"), n = 0; n < i.length; n++) { 628 var o = i[n]; 629 this.addImage(o) 630 } 631 if ("string" == typeof this.options.background) { 632 var r = e.querySelectorAll(this.options.background); 633 for (n = 0; n < r.length; n++) { 634 var s = r[n]; 635 this.addElementBackgroundImages(s) 636 } 637 } 638 } 639 }; 640 var u = {1: !0, 9: !0, 11: !0}; 641 return o.prototype.addElementBackgroundImages = function (e) { 642 var t = getComputedStyle(e); 643 if (t) for (var i = /url\((['"])?(.*?)\1\)/gi, n = i.exec(t.backgroundImage); null !== n;) { 644 var o = n && n[2]; 645 o && this.addBackground(o, e), n = i.exec(t.backgroundImage) 646 } 647 }, o.prototype.addImage = function (e) { 648 var t = new r(e); 649 this.images.push(t) 650 }, o.prototype.addBackground = function (e, t) { 651 var i = new s(e, t); 652 this.images.push(i) 653 }, o.prototype.check = function () { 654 function e(e, i, n) { 655 setTimeout(function () { 656 t.progress(e, i, n) 657 }) 658 } 659 660 var t = this; 661 return this.progressedCount = 0, this.hasAnyBroken = !1, this.images.length ? void this.images.forEach(function (t) { 662 t.once("progress", e), t.check() 663 }) : void this.complete() 664 }, o.prototype.progress = function (e, t, i) { 665 this.progressedCount++, this.hasAnyBroken = this.hasAnyBroken || !e.isLoaded, this.emitEvent("progress", [this, e, t]), this.jqDeferred && this.jqDeferred.notify && this.jqDeferred.notify(this, e), this.progressedCount == this.images.length && this.complete(), this.options.debug && a && a.log("progress: " + i, e, t) 666 }, o.prototype.complete = function () { 667 var e = this.hasAnyBroken ? "fail" : "done"; 668 if (this.isComplete = !0, this.emitEvent(e, [this]), this.emitEvent("always", [this]), this.jqDeferred) { 669 var t = this.hasAnyBroken ? "reject" : "resolve"; 670 this.jqDeferred[t](this) 671 } 672 }, r.prototype = Object.create(t.prototype), r.prototype.check = function () { 673 var e = this.getIsImageComplete(); 674 return e ? void this.confirm(0 !== this.img.naturalWidth, "naturalWidth") : (this.proxyImage = new Image, this.proxyImage.addEventListener("load", this), this.proxyImage.addEventListener("error", this), this.img.addEventListener("load", this), this.img.addEventListener("error", this), void (this.proxyImage.src = this.img.src)) 675 }, r.prototype.getIsImageComplete = function () { 676 return this.img.complete && this.img.naturalWidth 677 }, r.prototype.confirm = function (e, t) { 678 this.isLoaded = e, this.emitEvent("progress", [this, this.img, t]) 679 }, r.prototype.handleEvent = function (e) { 680 var t = "on" + e.type; 681 this[t] && this[t](e) 682 }, r.prototype.onload = function () { 683 this.confirm(!0, "onload"), this.unbindEvents() 684 }, r.prototype.onerror = function () { 685 this.confirm(!1, "onerror"), this.unbindEvents() 686 }, r.prototype.unbindEvents = function () { 687 this.proxyImage.removeEventListener("load", this), this.proxyImage.removeEventListener("error", this), this.img.removeEventListener("load", this), this.img.removeEventListener("error", this) 688 }, s.prototype = Object.create(r.prototype), s.prototype.check = function () { 689 this.img.addEventListener("load", this), this.img.addEventListener("error", this), this.img.src = this.url; 690 var e = this.getIsImageComplete(); 691 e && (this.confirm(0 !== this.img.naturalWidth, "naturalWidth"), this.unbindEvents()) 692 }, s.prototype.unbindEvents = function () { 693 this.img.removeEventListener("load", this), this.img.removeEventListener("error", this) 694 }, s.prototype.confirm = function (e, t) { 695 this.isLoaded = e, this.emitEvent("progress", [this, this.element, t]) 696 }, o.makeJQueryPlugin = function (t) { 697 t = t || e.jQuery, t && (h = t, h.fn.imagesLoaded = function (e, t) { 698 var i = new o(this, e, t); 699 return i.jqDeferred.promise(h(this)) 700 }) 701 }, o.makeJQueryPlugin(), o 702}); 703 704/** 705 * sticky-sidebar - A JavaScript plugin for making smart and high performance. 706 * @version v3.3.1 707 * @link https://github.com/abouolia/sticky-sidebar 708 * @author Ahmed Bouhuolia 709 * @license The MIT License (MIT) 710 **/ 711!function (t, e) { 712 "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : t.StickySidebar = e() 713}(this, function () { 714 "use strict"; 715 "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self && self; 716 717 function t(t) { 718 return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t 719 } 720 721 function e(t, e) { 722 return t(e = {exports: {}}, e.exports), e.exports 723 } 724 725 var i = e(function (t, e) { 726 (function (t) { 727 Object.defineProperty(t, "__esModule", {value: !0}); 728 var l, n, e = function () { 729 function n(t, e) { 730 for (var i = 0; i < e.length; i++) { 731 var n = e[i]; 732 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) 733 } 734 } 735 736 return function (t, e, i) { 737 return e && n(t.prototype, e), i && n(t, i), t 738 } 739 }(), i = (l = ".stickySidebar", n = { 740 topSpacing: 0, 741 bottomSpacing: 0, 742 containerSelector: !1, 743 innerWrapperSelector: ".inner-wrapper-sticky", 744 stickyClass: "is-affixed", 745 resizeSensor: !0, 746 minWidth: !1 747 }, function () { 748 function c(t) { 749 var e = this, i = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; 750 if (function (t, e) { 751 if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") 752 }(this, c), this.options = c.extend(n, i), this.sidebar = "string" == typeof t ? document.querySelector(t) : t, void 0 === this.sidebar) throw new Error("There is no specific sidebar element."); 753 this.sidebarInner = !1, this.container = this.sidebar.parentElement, this.affixedType = "STATIC", this.direction = "down", this.support = { 754 transform: !1, 755 transform3d: !1 756 }, this._initialized = !1, this._reStyle = !1, this._breakpoint = !1, this.dimensions = { 757 translateY: 0, 758 maxTranslateY: 0, 759 topSpacing: 0, 760 lastTopSpacing: 0, 761 bottomSpacing: 0, 762 lastBottomSpacing: 0, 763 sidebarHeight: 0, 764 sidebarWidth: 0, 765 containerTop: 0, 766 containerHeight: 0,
vendor: 1,284 bytes, lines 767-785
767 viewportHeight: 0, 768 viewportTop: 0, 769 lastViewportTop: 0 770 }, ["handleEvent"].forEach(function (t) { 771 e[t] = e[t].bind(e) 772 }), this.initialize() 773 } 774 775 return e(c, [{ 776 key: "initialize", value: function () { 777 var i = this; 778 if (this._setSupportFeatures(), this.options.innerWrapperSelector && (this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector), null === this.sidebarInner && (this.sidebarInner = !1)), !this.sidebarInner) { 779 var t = document.createElement("div"); 780 for (t.setAttribute("class", "inner-wrapper-sticky"), this.sidebar.appendChild(t); this.sidebar.firstChild != t;) t.appendChild(this.sidebar.firstChild); 781 this.sidebarInner = this.sidebar.querySelector(".inner-wrapper-sticky") 782 } 783 if (this.options.containerSelector) { 784 var e = document.querySelectorAll(this.options.containerSelector); 785 if ((e = Array.prototype.slice.call(e)).forEac
785h(function (t, e) { 786 t.contains(i.sidebar) && (i.container = t) 787 }), !e.length) throw new Error("The container does not contains on the sidebar.") 788 } 789 "function" != typeof this.options.topSpacing && (this.options.topSpacing = parseInt(this.options.topSpacing) || 0), "function" != typeof this.options.bottomSpacing && (this.options.bottomSpacing = parseInt(this.options.bottomSpacing) || 0), this._widthBreakpoint(), this.calcDimensions(), this.stickyPosition(), this.bindEvents(), this._initialized = !0 790 } 791 }, { 792 key: "bindEvents", value: function () { 793 window.addEventListener("resize", this, { 794 passive: !0, 795 capture: !1 796 }), window.addEventListener("scroll", this, { 797 passive: !0, 798 capture: !1 799 }), this.sidebar.addEventListener("update" + l, this), this.options.resizeSensor && "undefined" != typeof ResizeSensor && (new ResizeSensor(this.sidebarInner, this.handleEvent), new ResizeSensor(this.container, this.handleEvent)) 800 } 801 }, { 802 key: "handleEvent", value: function (t) { 803 this.updateSticky(t) 804 } 805 }, { 806 key: "calcDimensions", value: function () { 807 if (!this._breakpoint) { 808 var t = this.dimensions; 809 t.containerTop = c.offsetRelative(this.container).top, t.containerHeight = this.container.clientHeight, t.containerBottom = t.containerTop + t.containerHeight, t.sidebarHeight = this.sidebarInner.offsetHeight, t.sidebarWidth = this.sidebarInner.offsetWidth, t.viewportHeight = window.innerHeight, t.maxTranslateY = t.containerHeight - t.sidebarHeight, this._calcDimensionsWithScroll() 810 } 811 } 812 }, { 813 key: "_calcDimensionsWithScroll", value: function () { 814 var t = this.dimensions; 815 t.sidebarLeft = c.offsetRelative(this.sidebar).left, t.viewportTop = document.documentElement.scrollTop || document.body.scrollTop, t.viewportBottom = t.viewportTop + t.viewportHeight, t.viewportLeft = document.documentElement.scrollLeft || document.body.scrollLeft, t.topSpacing = this.options.topSpacing, t.bottomSpacing = this.options.bottomSpacing, "function" == typeof t.topSpacing && (t.topSpacing = parseInt(t.topSpacing(this.sidebar)) || 0), "function" == typeof t.bottomSpacing && (t.bottomSpacing = parseInt(t.bottomSpacing(this.sidebar)) || 0), "VIEWPORT-TOP" === this.affixedType ? t.topSpacing < t.lastTopSpacing && (t.translateY += t.lastTopSpacing - t.topSpacing, this._reStyle = !0) : "VIEWPORT-BOTTOM" === this.affixedType && t.bottomSpacing < t.lastBottomSpacing && (t.translateY += t.lastBottomSpacing - t.bottomSpacing, this._reStyle = !0), t.lastTopSpacing = t.topSpacing, t.lastBottomSpacing = t.bottomSpacing 816 } 817 }, { 818 key: "isSidebarFitsViewport", value: function () { 819 var t = this.dimensions, e = "down" === this.scrollDirection ? t.lastBottomSpacing : t.lastTopSpacing; 820 return this.dimensions.sidebarHeight + e < this.dimensions.viewportHeight 821 } 822 }, { 823 key: "observeScrollDir", value: function () { 824 var t = this.dimensions; 825 if (t.lastViewportTop !== t.viewportTop) { 826 var e = "down" === this.direction ? Math.min : Math.max; 827 t.viewportTop === e(t.viewportTop, t.lastViewportTop) && (this.direction = "down" === this.direction ? "up" : "down") 828 } 829 } 830 }, { 831 key: "getAffixType", value: function () { 832 this._calcDimensionsWithScroll(); 833 var t = this.dimensions, e = t.viewportTop + t.topSpacing, i = this.affixedType; 834 return e <= t.containerTop || t.containerHeight <= t.sidebarHeight ? (t.translateY = 0, i = "STATIC") : i = "up" === this.direction ? this._getAffixT
vendor: 4,700 bytes, lines 834-902
834ypeScrollingUp() : this._getAffixTypeScrollingDown(), t.translateY = Math.max(0, t.translateY), t.translateY = Math.min(t.containerHeight, t.translateY), t.translateY = Math.round(t.translateY), t.lastViewportTop = t.viewportTop, i 835 } 836 }, { 837 key: "_getAffixTypeScrollingDown", value: function () { 838 var t = this.dimensions, e = t.sidebarHeight + t.containerTop, i = t.viewportTop + t.topSpacing, 839 n = t.viewportBottom - t.bottomSpacing, o = this.affixedType; 840 return this.isSidebarFitsViewport() ? t.sidebarHeight + i >= t.containerBottom ? (t.translateY = t.containerBottom - e, o = "CONTAINER-BOTTOM") : i >= t.containerTop && (t.translateY = i - t.containerTop, o = "VIEWPORT-TOP") : t.containerBottom <= n ? (t.translateY = t.containerBottom - e, o = "CONTAINER-BOTTOM") : e + t.translateY <= n ? (t.translateY = n - e, o = "VIEWPORT-BOTTOM") : t.containerTop + t.translateY <= i && 0 !== t.translateY && t.maxTranslateY !== t.translateY && (o = "VIEWPORT-UNBOTTOM"), o 841 } 842 }, { 843 key: "_getAffixTypeScrollingUp", value: function () { 844 var t = this.dimensions, e = t.sidebarHeight + t.containerTop, i = t.viewportTop + t.topSpacing, 845 n = t.viewportBottom - t.bottomSpacing, o = this.affixedType; 846 return i <= t.translateY + t.containerTop ? (t.translateY = i - t.containerTop, o = "VIEWPORT-TOP") : t.containerBottom <= n ? (t.translateY = t.containerBottom - e, o = "CONTAINER-BOTTOM") : this.isSidebarFitsViewport() || t.containerTop <= i && 0 !== t.translateY && t.maxTranslateY !== t.translateY && (o = "VIEWPORT-UNBOTTOM"), o 847 } 848 }, { 849 key: "_getStyle", value: function (t) { 850 if (void 0 !== t) { 851 var e = {inner: {}, outer: {}}, i = this.dimensions; 852 switch (t) { 853 case"VIEWPORT-TOP": 854 e.inner = { 855 position: "fixed", 856 top: i.topSpacing, 857 left: i.sidebarLeft - i.viewportLeft, 858 width: i.sidebarWidth 859 }; 860 break; 861 case"VIEWPORT-BOTTOM": 862 e.inner = { 863 position: "fixed", 864 top: "auto", 865 left: i.sidebarLeft, 866 bottom: i.bottomSpacing, 867 width: i.sidebarWidth 868 }; 869 break; 870 case"CONTAINER-BOTTOM": 871 case"VIEWPORT-UNBOTTOM": 872 var n = this._getTranslate(0, i.translateY + "px"); 873 e.inner = n ? {transform: n} : { 874 position: "absolute", 875 top: i.translateY, 876 width: i.sidebarWidth 877 } 878 } 879 switch (t) { 880 case"VIEWPORT-TOP": 881 case"VIEWPORT-BOTTOM": 882 case"VIEWPORT-UNBOTTOM": 883 case"CONTAINER-BOTTOM": 884 e.outer = {height: i.sidebarHeight, position: "relative"} 885 } 886 return e.outer = c.extend({ 887 height: "", 888 position: "" 889 }, e.outer), e.inner = c.extend({ 890 position: "relative", 891 top: "", 892 left: "", 893 bottom: "", 894 width: "", 895 transform: "" 896 }, e.inner), e 897 } 898 } 899 }, { 900 key: "stickyPosition", value: function (t) { 901 if (!this._breakpoint) { 902 t = this._reStyle || t || !1, this.options.topSpacing, this.options.bottomSpacing;
903 var e = this.getAffixType(), i = this._getStyle(e); 904 if ((this.affixedType != e || t) && e) { 905 var n = "affix." + e.toLowerCase().replace("viewport-", "") + l; 906 for (var o in c.eventTrigger(this.sidebar, n), "STATIC" === e ? c.removeClass(this.sidebar, this.options.stickyClass) : c.addClass(this.sidebar, this.options.stickyClass), i.outer) { 907 var s = "number" == typeof i.outer[o] ? "px" : ""; 908 this.sidebar.style[o] = i.outer[o] + s 909 } 910 for (var r in i.inner) { 911 var a = "number" == typeof i.inner[r] ? "px" : ""; 912 this.sidebarInner.style[r] = i.inner[r] + a 913 } 914 var p = "affixed." + e.toLowerCase().replace("viewport-", "") + l; 915 c.eventTrigger(this.sidebar, p) 916 } else this._initialized && (this.sidebarInner.style.left = i.inner.left); 917 this.affixedType = e 918 } 919 } 920 }, { 921 key: "_widthBreakpoint", value: function () { 922 window.innerWidth <= this.options.minWidth ? (this._breakpoint = !0, this.affixedType = "STATIC", this.sidebar.removeAttribute("style"), c.removeClass(this.sidebar, this.options.stickyClass), this.sidebarInner.removeAttribute("style")) : this._breakpoint = !1 923 } 924 }, { 925 key: "updateSticky", value: function () { 926 var t, e = this, i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; 927 this._running || (this._running = !0, t = i.type, requestAnimationFrame(function () { 928 switch (t) { 929 case"scroll": 930 e._calcDimensionsWithScroll(), e.observeScrollDir(), e.stickyPosition(); 931 break; 932 case"resize": 933 default: 934 e._widthBreakpoint(), e.calcDimensions(), e.stickyPosition(!0) 935 } 936 e._running = !1 937 })) 938 } 939 }, { 940 key: "_setSupportFeatures", value: function () { 941 var t = this.support; 942 t.transform = c.supportTransform(), t.transform3d = c.supportTransform(!0) 943 } 944 }, { 945 key: "_getTranslate", value: function () { 946 var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0, 947 e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, 948 i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0; 949 return this.support.transform3d ? "translate3d(" + t + ", " + e + ", " + i + ")" : !!this.support.translate && "translate(" + t + ", " + e + ")" 950 } 951 }, { 952 key: "destroy", value: function () { 953 window.removeEventListener("resize", this, {capture: !1}), window.removeEventListener("scroll", this, {capture: !1}), this.sidebar.classList.remove(this.options.stickyClass), this.sidebar.style.minHeight = "", this.sidebar.removeEventListener("update" + l, this); 954 var t = {inner: {}, outer: {}}; 955 for (var e in t.inner = { 956 position: "", 957 top: "", 958 left: "", 959 bottom: "", 960 width: "", 961 transform: "" 962 }, t.outer = {height: "", position: ""}, t.outer) this.sidebar.style[e] = t.outer[e]; 963 for (var i in t.inner) this.sidebarInner.style[i] = t.inner[i]; 964 this.options.resizeSensor && "undefined" != typeof ResizeSensor && (ResizeSensor.detach(this.sidebarInner, this.handleEvent), ResizeSensor.detach(this.container, this.handleEvent)) 965 } 966 }], [{
vendor: 1,263 bytes, lines 967-990
967 key: "supportTransform", value: function (t) { 968 var i = !1, e = t ? "perspective" : "transform", n = e.charAt(0).toUpperCase() + e.slice(1), 969 o = document.createElement("support").style; 970 return (e + " " + ["Webkit", "Moz", "O", "ms"].join(n + " ") + n).split(" ").forEach(function (t, e) { 971 if (void 0 !== o[t]) return i = t, !1 972 }), i 973 } 974 }, { 975 key: "eventTrigger", value: function (t, e, i) { 976 try { 977 var n = new CustomEvent(e, {detail: i}) 978 } catch (t) { 979 (n = document.createEvent("CustomEvent")).initCustomEvent(e, !0, !0, i) 980 } 981 t.dispatchEvent(n) 982 } 983 }, { 984 key: "extend", value: function (t, e) { 985 var i = {}; 986 for (var n in t) void 0 !== e[n] ? i[n] = e[n] : i[n] = t[n]; 987 return i 988 } 989 }, { 990 key: "offsetRelative", value: function (t) {
991 var e = {left: 0, top: 0}; 992 do { 993 var i = t.offsetTop, n = t.offsetLeft; 994 isNaN(i) || (e.top += i), isNaN(n) || (e.left += n), t = "BODY" === t.tagName ? t.parentElement : t.offsetParent 995 } while (t); 996 return e 997 } 998 }, { 999 key: "addClass", value: function (t, e) { 1000 c.hasClass(t, e) || (t.classList ? t.classList.add(e) : t.className += " " + e) 1001 } 1002 }, { 1003 key: "removeClass", value: function (t, e) { 1004 c.hasClass(t, e) && (t.classList ? t.classList.remove(e) : t.className = t.className.replace(new RegExp("(^|\\b)" + e.split(" ").join("|") + "(\\b|$)", "gi"), " ")) 1005 } 1006 }, { 1007 key: "hasClass", value: function (t, e) { 1008 return t.classList ? t.classList.contains(e) : new RegExp("(^| )" + e + "( |$)", "gi").test(t.className) 1009 } 1010 }, { 1011 key: "defaults", get: function () { 1012 return n 1013 } 1014 }]), c 1015 }()); 1016 t.default = i, window.StickySidebar = i 1017 })(e) 1018 }); 1019 return t(i), t(e(function (t, e) { 1020 (function (t) { 1021 var e, s = (e = t) && e.__esModule ? e : {default: e}; 1022 !function () { 1023 if ("undefined" != typeof window) { 1024 var n = window.$ || window.jQuery || window.Zepto, o = "stickySidebar"; 1025 if (n) { 1026 n.fn.stickySidebar = function (i) { 1027 return this.each(function () { 1028 var t = n(this), e = n(this).data(o); 1029 if (e || (e = new s.default(this, "object" == typeof i && i), t.data(o, e)), "string" == typeof i) { 1030 if (void 0 === e[i] && -1 === ["destroy", "updateSticky"].indexOf(i)) throw new Error('No method named "' + i + '"'); 1031 e[i]() 1032 } 1033 }) 1034 }, n.fn.stickySidebar.Constructor = s.default; 1035 var t = n.fn.stickySidebar; 1036 n.fn.stickySidebar.noConflict = function () { 1037 return n.fn.stickySidebar = t, this 1038 } 1039 } 1040 } 1041 }() 1042 })(i) 1043 })) 1044});
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.