https://greencentralbanking.com/wp-content/themes/greencentralbanking/assets/js/plugins.js?ver=2.0.6
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 var scrollBar = { 228 init: function (wrapper) { 229 var self = this; 230 231 self._scrollWrap = document.querySelector(wrapper); 232 233 if (self._scrollWrap === null) { 234 return; 235 } 236 237 self._scrollInner = self._scrollWrap.querySelector('.scrollable'); 238 self._scrollContent = self._scrollWrap.querySelector('.scrollable-content'); 239 self.scrollIndicatorBar = self._scrollWrap.querySelector('.sc-scroll-indicator-bar'); 240 241 self.scrollBarWidth = 1; 242 self.scrollBarOffset = 0; 243 self.mouseActive = false; 244 self.mouseX = 0; 245 246 self.calculate(); 247 self._scrollInner.addEventListener('scroll', self.scrollHandler, {passive: true}); 248 window.addEventListener('resize', self.calculate, {passive: true}); 249 //self.scrollIndicatorBar.addEventListener('mousedown', self.mouseClickHandler); 250 //self.scrollIndicatorBar.addEventListener('mouseup', self.mouseClickHandler); 251 //self.scrollIndicatorBar.addEventListener('mousemove', self.mouseMoveHandler); 252 }, 253 254 calculate: function () { 255 var self = scrollBar; 256 257 self.scrollBarWidth = self._scrollInner.offsetWidth / self._scrollContent.offsetWidth; 258 259 if (self.scrollBarWidth > 1) { 260 self.scrollBarWidth = 1; 261 } 262 263 if ((self._scrollContent.offsetWidth - self._scrollInner.offsetWidth) <= 0) { 264 self._scrollWrap.classList.add('disabled'); 265 } else { 266 self._scrollWrap.classList.remove('disabled'); 267 } 268 269 self.setStyle(); 270 }, 271 272 setStyle: function () { 273 var self = scrollBar; 274 275 self.scrollBarOffset = (self._scrollInner.scrollLeft / self._scrollInner.offsetWidth) * 100; 276 self.scrollIndicatorBar.style.transform = `scaleX(${self.scrollBarWidth}) translateX(${self.scrollBarOffset}%)`; 277 }, 278 279 scrollHandler: function () { 280 var self = scrollBar; 281 282 self.setStyle(); 283 }, 284 285 mouseClickHandler: function (e) { 286 var self = scrollBar; 287 288 if (typeof e !== 'object') { 289 return false; 290 } 291 292 if (e.type === 'mousedown' && e.button === 0) { 293 self.mouseX = e.clientX; 294 self.mouseActive = true; 295 } else { 296 self.mouseActive = false;
297 } 298 }, 299 300 mouseMoveHandler: function (e) { 301 var self = scrollBar, 302 scrollBarPos = 0; 303 304 if (self.mouseActive) { 305 scrollBarPos = e.clientX - self.mouseX; 306 self._scrollInner.scrollLeft = scrollBarPos; 307 self.setStyle(); 308 } 309 } 310 }; 311 312 $.fn.scrollBar = scrollBar; 313 314})(jQuery); 315 316// Function from David Walsh: http://davidwalsh.name/css-animation-callback 317function whichTransitionEvent() { 318 var t, 319 el = document.createElement("fakeelement"); 320 321 var transitions = { 322 "transition": "transitionend", 323 "OTransition": "oTransitionEnd", 324 "MozTransition": "transitionend", 325 "WebkitTransition": "webkitTransitionEnd" 326 } 327 328 for (t in transitions) { 329 if (el.style[t] !== undefined) { 330 return transitions[t]; 331 } 332 } 333} 334 335function whichAnimationEvent(type) { 336 var t, 337 el = document.createElement("fakeelement"); 338 339 var animations = { 340 "animation": "animationend", 341 "OAnimation": "oAnimationEnd", 342 "MozAnimation": "animationend", 343 "WebkitAnimation": "webkitAnimationEnd" 344 }; 345 346 for (t in animations) { 347 if (el.style[t] !== undefined) { 348 return animations[t]; 349 } 350 } 351} 352 353var transitionEvent = whichTransitionEvent(); 354var animationEvent = whichAnimationEvent(); 355 356setCssStyles = function (el, styles) { 357 var keys = {}, i, prop; 358 359 if (typeof el[0] !== 'undefined') { 360 el = el.get(0); 361 } 362 363 keys = Object.keys(styles); 364 365 for (i = 0; i < keys.length; i++) { 366 prop = keys[i]; 367 368 if (prop === 'transition' || prop === 'transform') { 369 el.style['-webkit-' + prop] = styles[prop]; 370 el.style['-ms-' + prop] = styles[prop]; 371 el.style['-moz-' + prop] = styles[prop]; 372 el.style['-o-' + prop] = styles[prop]; 373 } 374 375 el.style[prop] = styles[prop]; 376 } 377} 378 379function getQueryStringParameter(uri, key) { 380 if (uri.indexOf('?') === -1) { 381 return false; 382 } 383 384 var params = uri.split("?")[1].split("&"), 385 value = false; 386 387 for (var i = 0; i < params.length; i = i + 1) { 388 var singleParam = params[i].split("="); 389 if (singleParam[0] === key && false === value) { 390 value = singleParam[1]; 391 } 392 } 393 394 return value; 395} 396 397function updateQueryStringParameter(uri, key, value) { 398 var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); 399 var separator = uri.indexOf('?') !== -1 ? "&" : "?"; 400 if (uri.match(re)) { 401 return uri.replace(re, '$1' + key + "=" + value + '$2'); 402 } else { 403 return uri + separator + key + "=" + value; 404 } 405} 406 407function removeURLParameter(url, key) { 408 //prefer to use l.search if you have a location/link object 409 var urlparts = url.split('?'); 410 if (urlparts.length >= 2) { 411 412 var prefix = encodeURIComponent(key) + '='; 413 var pars = urlparts[1].split(/[&;]/g); 414 415 //reverse iteration as may be destructive 416 for (var i = pars.length; i-- > 0;) { 417 //idiom for string.startsWith 418 if (pars[i].lastIndexOf(prefix, 0) !== -1) { 419 pars.splice(i, 1); 420 } 421 } 422 423 url = urlparts[0] + '?' + pars.join('&'); 424 return url; 425 } else { 426 return url; 427 } 428} 429 430isElementInViewport = function (element) { 431 const rect = element.getBoundingClientRect(); 432 433 return ( 434 rect.top >= 0 && 435 rect.left >= 0 && 436 rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && 437 rect.right <= (window.innerWidth || document.documentElement.clientWidth) 438 ); 439} 440 441isElementPartInViewport = function (element, shiftTop = 0) { 442 const rect = element.getBoundingClientRect(), 443 windowHeight = (window.innerHeight || document.documentElement.clientHeight), 444 percentVisible = 0; 445 446 return !( 447 Math.floor(100 - ((((rect.top - shiftTop) >= 0 ? 0 : (rect.top - shiftTop)) / +-rect.height) * 100)) < percentVisible ||
448 Math.floor(100 - (((rect.bottom - shiftTop) - windowHeight) / rect.height) * 100) < percentVisible 449 ); 450 451 /*return ( 452 rect.top >= -windowHeight && 453 rect.left >= -element.offsetWidth && 454 rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) + element.offsetHeight && 455 rect.right <= (window.innerWidth || document.documentElement.clientWidth) + element.offsetWidth 456 );*/ 457} 458 459/** 460 * Minified by jsDelivr using Terser v3.14.1. 461 * Original file: /npm/[email protected]/src/js.cookie.js 462 * 463 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files 464 */ 465!function (e) { 466 var n; 467 if ("function" == typeof define && define.amd && (define(e), n = !0), "object" == typeof exports && (module.exports = e(), n = !0), !n) { 468 var t = window.Cookies, o = window.Cookies = e(); 469 o.noConflict = function () { 470 return window.Cookies = t, o 471 } 472 } 473}(function () { 474 function e() { 475 for (var e = 0, n = {}; e < arguments.length; e++) { 476 var t = arguments[e]; 477 for (var o in t) n[o] = t[o] 478 } 479 return n 480 } 481 482 function n(e) { 483 return e.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent) 484 } 485 486 return function t(o) { 487 function r() { 488 } 489 490 function i(n, t, i) { 491 if ("undefined" != typeof document) { 492 "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() : ""; 493 try { 494 var c = JSON.stringify(t); 495 /^[\{\[]/.test(c) && (t = c) 496 } catch (e) { 497 } 498 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); 499 var f = ""; 500 for (var u in i) i[u] && (f += "; " + u, !0 !== i[u] && (f += "=" + i[u].split(";")[0])); 501 return document.cookie = n + "=" + t + f 502 } 503 } 504 505 function c(e, t) { 506 if ("undefined" != typeof document) { 507 for (var r = {}, i = document.cookie ? document.cookie.split("; ") : [], c = 0; c < i.length; c++) { 508 var f = i[c].split("="), u = f.slice(1).join("="); 509 t || '"' !== u.charAt(0) || (u = u.slice(1, -1)); 510 try { 511 var a = n(f[0]); 512 if (u = (o.read || o)(u, a) || n(u), t) try { 513 u = JSON.parse(u) 514 } catch (e) { 515 } 516 if (r[a] = u, e === a) break 517 } catch (e) { 518 } 519 } 520 return e ? r[e] : r 521 } 522 } 523 524 return r.set = i, r.get = function (e) { 525 return c(e, !1) 526 }, r.getJSON = function (e) { 527 return c(e, !0) 528 }, r.remove = function (n, t) { 529 i(n, "", e(t, {expires: -1})) 530 }, r.defaults = {}, r.withConverter = t, r 531 }(function () { 532 }) 533}); 534 535/** 536 * imagesLoaded PACKAGED v4.1.4 537 * JavaScript is all like "You images are done yet or what?" 538 * MIT License 539 */ 540!function (e, t) { 541 "function" == typeof define && define.amd ? define("ev-emitter/ev-emitter", t) : "object" == typeof module && module.exports ? module.exports = t() : e.EvEmitter = t() 542}("undefined" != typeof window ? window : this, function () { 543 function e() { 544 } 545 546 var t = e.prototype; 547 return t.on = function (e, t) { 548 if (e && t) { 549 var i = this._events = this._events || {}, n = i[e] = i[e] || []; 550 return n.indexOf(t) == -1 && n.push(t), this 551 } 552 }, t.once = function (e, t) { 553 if (e && t) { 554 this.on(e, t); 555 var i = this._onceEvents = this._onceEvents || {}, n = i[e] = i[e] || {}; 556 return n[t] = !0, this 557 } 558 }, t.off = function (e, t) { 559 var i = this._events && this._events[e]; 560 if (i && i.length) { 561 var n = i.indexOf(t); 562 return n != -1 && i.splice(n, 1), this 563 } 564 }, t.emitEvent = function (e, t) { 565 var i = this._events && this._events[e]; 566 if (i && i.length) { 567 i = i.slice(0), t = t || []; 568 for (var n = this._onceEvents && this._onceEvents[e], o = 0; o < i.length; o++) { 569 var r = i[o], s = n && n[r]; 570 s && (this.off(e, r), delete n[r]), r.apply(this, t) 571 } 572 return this 573 } 574 }, t.allOff = function () { 575 delete this._events, delete this._onceEvents 576 }, e 577}), function (e, t) { 578 "use strict"; 579 "function" == typeof define && define.amd ? define(["ev-emitter/ev-emitter"], function (i) { 580 return t(e, i) 581 }) : "object" == typeof module && module.exports ? module.exports = t(e, require("ev-emitter")) : e.imagesLoaded = t(e, e.EvEmitter) 582}("undefined" != typeof window ? window : this, function (e, t) { 583 function i(e, t) { 584 for (var i in t) e[i] = t[i]; 585 return e 586 } 587 588 function n(e) { 589 if (Array.isArray(e)) return e; 590 var t = "object" == typeof e && "number" == typeof e.length; 591 return t ? d.call(e) : [e] 592 } 593 594 function o(e, t, r) { 595 if (!(this instanceof o)) return new o(e, t, r); 596 var s = e; 597 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)) 598 } 599 600 function r(e) { 601 this.img = e 602 } 603 604 function s(e, t) { 605 this.url = e, this.element = t, this.img = new Image 606 } 607 608 var h = e.jQuery, a = e.console, d = Array.prototype.slice; 609 o.prototype = Object.create(t.prototype), o.prototype.options = {}, o.prototype.getImages = function () {
610 this.images = [], this.elements.forEach(this.addElementImages, this) 611 }, o.prototype.addElementImages = function (e) { 612 "IMG" == e.nodeName && this.addImage(e), this.options.background === !0 && this.addElementBackgroundImages(e); 613 var t = e.nodeType; 614 if (t && u[t]) { 615 for (var i = e.querySelectorAll("img"), n = 0; n < i.length; n++) { 616 var o = i[n]; 617 this.addImage(o) 618 } 619 if ("string" == typeof this.options.background) { 620 var r = e.querySelectorAll(this.options.background); 621 for (n = 0; n < r.length; n++) { 622 var s = r[n]; 623 this.addElementBackgroundImages(s) 624 } 625 } 626 } 627 }; 628 var u = {1: !0, 9: !0, 11: !0}; 629 return o.prototype.addElementBackgroundImages = function (e) { 630 var t = getComputedStyle(e); 631 if (t) for (var i = /url\((['"])?(.*?)\1\)/gi, n = i.exec(t.backgroundImage); null !== n;) { 632 var o = n && n[2]; 633 o && this.addBackground(o, e), n = i.exec(t.backgroundImage) 634 } 635 }, o.prototype.addImage = function (e) { 636 var t = new r(e); 637 this.images.push(t) 638 }, o.prototype.addBackground = function (e, t) { 639 var i = new s(e, t); 640 this.images.push(i) 641 }, o.prototype.check = function () { 642 function e(e, i, n) { 643 setTimeout(function () { 644 t.progress(e, i, n) 645 }) 646 } 647 648 var t = this; 649 return this.progressedCount = 0, this.hasAnyBroken = !1, this.images.length ? void this.images.forEach(function (t) { 650 t.once("progress", e), t.check() 651 }) : void this.complete() 652 }, o.prototype.progress = function (e, t, i) { 653 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) 654 }, o.prototype.complete = function () { 655 var e = this.hasAnyBroken ? "fail" : "done"; 656 if (this.isComplete = !0, this.emitEvent(e, [this]), this.emitEvent("always", [this]), this.jqDeferred) { 657 var t = this.hasAnyBroken ? "reject" : "resolve"; 658 this.jqDeferred[t](this) 659 } 660 }, r.prototype = Object.create(t.prototype), r.prototype.check = function () { 661 var e = this.getIsImageComplete(); 662 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)) 663 }, r.prototype.getIsImageComplete = function () { 664 return this.img.complete && this.img.naturalWidth 665 }, r.prototype.confirm = function (e, t) { 666 this.isLoaded = e, this.emitEvent("progress", [this, this.img, t]) 667 }, r.prototype.handleEvent = function (e) { 668 var t = "on" + e.type; 669 this[t] && this[t](e) 670 }, r.prototype.onload = function () { 671 this.confirm(!0, "onload"), this.unbindEvents() 672 }, r.prototype.onerror = function () { 673 this.confirm(!1, "onerror"), this.unbindEvents() 674 }, r.prototype.unbindEvents = function () { 675 this.proxyImage.removeEventListener("load", this), this.proxyImage.removeEventListener("error", this), this.img.removeEventListener("load", this), this.img.removeEventListener("error", this) 676 }, s.prototype = Object.create(r.prototype), s.prototype.check = function () { 677 this.img.addEventListener("load", this), this.img.addEventListener("error", this), this.img.src = this.url; 678 var e = this.getIsImageComplete(); 679 e && (this.confirm(0 !== this.img.naturalWidth, "naturalWidth"), this.unbindEvents()) 680 }, s.prototype.unbindEvents = function () { 681 this.img.removeEventListener("load", this), this.img.removeEventListener("error", this) 682 }, s.prototype.confirm = function (e, t) { 683 this.isLoaded = e, this.emitEvent("progress", [this, this.element, t]) 684 }, o.makeJQueryPlugin = function (t) { 685 t = t || e.jQuery, t && (h = t, h.fn.imagesLoaded = function (e, t) { 686 var i = new o(this, e, t); 687 return i.jqDeferred.promise(h(this)) 688 }) 689 }, o.makeJQueryPlugin(), o 690}); 691 692/** 693 * sticky-sidebar - A JavaScript plugin for making smart and high performance. 694 * @version v3.3.1 695 * @link https://github.com/abouolia/sticky-sidebar 696 * @author Ahmed Bouhuolia 697 * @license The MIT License (MIT) 698 **/ 699!function (t, e) { 700 "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : t.StickySidebar = e() 701}(this, function () { 702 "use strict"; 703 "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self && self; 704 705 function t(t) { 706 return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t 707 } 708 709 function e(t, e) { 710 return t(e = {exports: {}}, e.exports), e.exports 711 } 712 713 var i = e(function (t, e) { 714 (function (t) { 715 Object.defineProperty(t, "__esModule", {value: !0}); 716 var l, n, e = function () { 717 function n(t, e) { 718 for (var i = 0; i < e.length; i++) { 719 var n = e[i]; 720 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) 721 } 722 } 723 724 return function (t, e, i) { 725 return e && n(t.prototype, e), i && n(t, i), t 726 } 727 }(), i = (l = ".stickySidebar", n = { 728 topSpacing: 0, 729 bottomSpacing: 0, 730 containerSelector: !1, 731 innerWrapperSelector: ".inner-wrapper-sticky", 732 stickyClass: "is-affixed", 733 resizeSensor: !0, 734 minWidth: !1 735 }, function () { 736 function c(t) { 737 var e = this, i = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; 738 if (function (t, e) { 739 if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") 740 }(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."); 741 this.sidebarInner = !1, this.container = this.sidebar.parentElement, this.affixedType = "STATIC", this.direction = "down", this.support = { 742 transform: !1, 743 transform3d: !1 744 }, this._initialized = !1, this._reStyle = !1, this._breakpoint = !1, this.dimensions = { 745 translateY: 0, 746 maxTranslateY: 0, 747 topSpacing: 0, 748 lastTopSpacing: 0, 749 bottomSpacing: 0, 750 lastBottomSpacing: 0, 751 sidebarHeight: 0, 752 sidebarWidth: 0, 753 containerTop: 0, 754 containerHeight: 0,
vendor: 1,284 bytes, lines 755-773
755 viewportHeight: 0, 756 viewportTop: 0, 757 lastViewportTop: 0 758 }, ["handleEvent"].forEach(function (t) { 759 e[t] = e[t].bind(e) 760 }), this.initialize() 761 } 762 763 return e(c, [{ 764 key: "initialize", value: function () { 765 var i = this; 766 if (this._setSupportFeatures(), this.options.innerWrapperSelector && (this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector), null === this.sidebarInner && (this.sidebarInner = !1)), !this.sidebarInner) { 767 var t = document.createElement("div"); 768 for (t.setAttribute("class", "inner-wrapper-sticky"), this.sidebar.appendChild(t); this.sidebar.firstChild != t;) t.appendChild(this.sidebar.firstChild); 769 this.sidebarInner = this.sidebar.querySelector(".inner-wrapper-sticky") 770 } 771 if (this.options.containerSelector) { 772 var e = document.querySelectorAll(this.options.containerSelector); 773 if ((e = Array.prototype.slice.call(e)).forEac
773h(function (t, e) { 774 t.contains(i.sidebar) && (i.container = t) 775 }), !e.length) throw new Error("The container does not contains on the sidebar.") 776 } 777 "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 778 } 779 }, { 780 key: "bindEvents", value: function () { 781 window.addEventListener("resize", this, { 782 passive: !0, 783 capture: !1 784 }), window.addEventListener("scroll", this, { 785 passive: !0, 786 capture: !1 787 }), this.sidebar.addEventListener("update" + l, this), this.options.resizeSensor && "undefined" != typeof ResizeSensor && (new ResizeSensor(this.sidebarInner, this.handleEvent), new ResizeSensor(this.container, this.handleEvent)) 788 } 789 }, { 790 key: "handleEvent", value: function (t) { 791 this.updateSticky(t) 792 } 793 }, { 794 key: "calcDimensions", value: function () { 795 if (!this._breakpoint) { 796 var t = this.dimensions; 797 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() 798 } 799 } 800 }, { 801 key: "_calcDimensionsWithScroll", value: function () { 802 var t = this.dimensions; 803 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 804 } 805 }, { 806 key: "isSidebarFitsViewport", value: function () { 807 var t = this.dimensions, e = "down" === this.scrollDirection ? t.lastBottomSpacing : t.lastTopSpacing; 808 return this.dimensions.sidebarHeight + e < this.dimensions.viewportHeight 809 } 810 }, { 811 key: "observeScrollDir", value: function () { 812 var t = this.dimensions; 813 if (t.lastViewportTop !== t.viewportTop) { 814 var e = "down" === this.direction ? Math.min : Math.max; 815 t.viewportTop === e(t.viewportTop, t.lastViewportTop) && (this.direction = "down" === this.direction ? "up" : "down") 816 } 817 } 818 }, { 819 key: "getAffixType", value: function () { 820 this._calcDimensionsWithScroll(); 821 var t = this.dimensions, e = t.viewportTop + t.topSpacing, i = this.affixedType; 822 return e <= t.containerTop || t.containerHeight <= t.sidebarHeight ? (t.translateY = 0, i = "STATIC") : i = "up" === this.direction ? this._getAffixT
vendor: 4,700 bytes, lines 822-890
822ypeScrollingUp() : 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 823 } 824 }, { 825 key: "_getAffixTypeScrollingDown", value: function () { 826 var t = this.dimensions, e = t.sidebarHeight + t.containerTop, i = t.viewportTop + t.topSpacing, 827 n = t.viewportBottom - t.bottomSpacing, o = this.affixedType; 828 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 829 } 830 }, { 831 key: "_getAffixTypeScrollingUp", value: function () { 832 var t = this.dimensions, e = t.sidebarHeight + t.containerTop, i = t.viewportTop + t.topSpacing, 833 n = t.viewportBottom - t.bottomSpacing, o = this.affixedType; 834 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 835 } 836 }, { 837 key: "_getStyle", value: function (t) { 838 if (void 0 !== t) { 839 var e = {inner: {}, outer: {}}, i = this.dimensions; 840 switch (t) { 841 case"VIEWPORT-TOP": 842 e.inner = { 843 position: "fixed", 844 top: i.topSpacing, 845 left: i.sidebarLeft - i.viewportLeft, 846 width: i.sidebarWidth 847 }; 848 break; 849 case"VIEWPORT-BOTTOM": 850 e.inner = { 851 position: "fixed", 852 top: "auto", 853 left: i.sidebarLeft, 854 bottom: i.bottomSpacing, 855 width: i.sidebarWidth 856 }; 857 break; 858 case"CONTAINER-BOTTOM": 859 case"VIEWPORT-UNBOTTOM": 860 var n = this._getTranslate(0, i.translateY + "px"); 861 e.inner = n ? {transform: n} : { 862 position: "absolute", 863 top: i.translateY, 864 width: i.sidebarWidth 865 } 866 } 867 switch (t) { 868 case"VIEWPORT-TOP": 869 case"VIEWPORT-BOTTOM": 870 case"VIEWPORT-UNBOTTOM": 871 case"CONTAINER-BOTTOM": 872 e.outer = {height: i.sidebarHeight, position: "relative"} 873 } 874 return e.outer = c.extend({ 875 height: "", 876 position: "" 877 }, e.outer), e.inner = c.extend({ 878 position: "relative", 879 top: "", 880 left: "", 881 bottom: "", 882 width: "", 883 transform: "" 884 }, e.inner), e 885 } 886 } 887 }, { 888 key: "stickyPosition", value: function (t) { 889 if (!this._breakpoint) { 890 t = this._reStyle || t || !1, this.options.topSpacing, this.options.bottomSpacing;
891 var e = this.getAffixType(), i = this._getStyle(e); 892 if ((this.affixedType != e || t) && e) { 893 var n = "affix." + e.toLowerCase().replace("viewport-", "") + l; 894 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) { 895 var s = "number" == typeof i.outer[o] ? "px" : ""; 896 this.sidebar.style[o] = i.outer[o] + s 897 } 898 for (var r in i.inner) { 899 var a = "number" == typeof i.inner[r] ? "px" : ""; 900 this.sidebarInner.style[r] = i.inner[r] + a 901 } 902 var p = "affixed." + e.toLowerCase().replace("viewport-", "") + l; 903 c.eventTrigger(this.sidebar, p) 904 } else this._initialized && (this.sidebarInner.style.left = i.inner.left); 905 this.affixedType = e 906 } 907 } 908 }, { 909 key: "_widthBreakpoint", value: function () { 910 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 911 } 912 }, { 913 key: "updateSticky", value: function () { 914 var t, e = this, i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; 915 this._running || (this._running = !0, t = i.type, requestAnimationFrame(function () { 916 switch (t) { 917 case"scroll": 918 e._calcDimensionsWithScroll(), e.observeScrollDir(), e.stickyPosition(); 919 break; 920 case"resize": 921 default: 922 e._widthBreakpoint(), e.calcDimensions(), e.stickyPosition(!0) 923 } 924 e._running = !1 925 })) 926 } 927 }, { 928 key: "_setSupportFeatures", value: function () { 929 var t = this.support; 930 t.transform = c.supportTransform(), t.transform3d = c.supportTransform(!0) 931 } 932 }, { 933 key: "_getTranslate", value: function () { 934 var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0, 935 e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, 936 i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0; 937 return this.support.transform3d ? "translate3d(" + t + ", " + e + ", " + i + ")" : !!this.support.translate && "translate(" + t + ", " + e + ")" 938 } 939 }, { 940 key: "destroy", value: function () { 941 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); 942 var t = {inner: {}, outer: {}}; 943 for (var e in t.inner = { 944 position: "", 945 top: "", 946 left: "", 947 bottom: "", 948 width: "", 949 transform: "" 950 }, t.outer = {height: "", position: ""}, t.outer) this.sidebar.style[e] = t.outer[e]; 951 for (var i in t.inner) this.sidebarInner.style[i] = t.inner[i]; 952 this.options.resizeSensor && "undefined" != typeof ResizeSensor && (ResizeSensor.detach(this.sidebarInner, this.handleEvent), ResizeSensor.detach(this.container, this.handleEvent)) 953 } 954 }], [{
vendor: 1,263 bytes, lines 955-978
955 key: "supportTransform", value: function (t) { 956 var i = !1, e = t ? "perspective" : "transform", n = e.charAt(0).toUpperCase() + e.slice(1), 957 o = document.createElement("support").style; 958 return (e + " " + ["Webkit", "Moz", "O", "ms"].join(n + " ") + n).split(" ").forEach(function (t, e) { 959 if (void 0 !== o[t]) return i = t, !1 960 }), i 961 } 962 }, { 963 key: "eventTrigger", value: function (t, e, i) { 964 try { 965 var n = new CustomEvent(e, {detail: i}) 966 } catch (t) { 967 (n = document.createEvent("CustomEvent")).initCustomEvent(e, !0, !0, i) 968 } 969 t.dispatchEvent(n) 970 } 971 }, { 972 key: "extend", value: function (t, e) { 973 var i = {}; 974 for (var n in t) void 0 !== e[n] ? i[n] = e[n] : i[n] = t[n]; 975 return i 976 } 977 }, { 978 key: "offsetRelative", value: function (t) {
979 var e = {left: 0, top: 0}; 980 do { 981 var i = t.offsetTop, n = t.offsetLeft; 982 isNaN(i) || (e.top += i), isNaN(n) || (e.left += n), t = "BODY" === t.tagName ? t.parentElement : t.offsetParent 983 } while (t); 984 return e 985 } 986 }, { 987 key: "addClass", value: function (t, e) { 988 c.hasClass(t, e) || (t.classList ? t.classList.add(e) : t.className += " " + e) 989 } 990 }, { 991 key: "removeClass", value: function (t, e) { 992 c.hasClass(t, e) && (t.classList ? t.classList.remove(e) : t.className = t.className.replace(new RegExp("(^|\\b)" + e.split(" ").join("|") + "(\\b|$)", "gi"), " ")) 993 } 994 }, { 995 key: "hasClass", value: function (t, e) { 996 return t.classList ? t.classList.contains(e) : new RegExp("(^| )" + e + "( |$)", "gi").test(t.className) 997 } 998 }, { 999 key: "defaults", get: function () { 1000 return n 1001 } 1002 }]), c 1003 }()); 1004 t.default = i, window.StickySidebar = i 1005 })(e) 1006 }); 1007 return t(i), t(e(function (t, e) { 1008 (function (t) { 1009 var e, s = (e = t) && e.__esModule ? e : {default: e}; 1010 !function () { 1011 if ("undefined" != typeof window) { 1012 var n = window.$ || window.jQuery || window.Zepto, o = "stickySidebar"; 1013 if (n) { 1014 n.fn.stickySidebar = function (i) { 1015 return this.each(function () { 1016 var t = n(this), e = n(this).data(o); 1017 if (e || (e = new s.default(this, "object" == typeof i && i), t.data(o, e)), "string" == typeof i) { 1018 if (void 0 === e[i] && -1 === ["destroy", "updateSticky"].indexOf(i)) throw new Error('No method named "' + i + '"'); 1019 e[i]() 1020 } 1021 }) 1022 }, n.fn.stickySidebar.Constructor = s.default; 1023 var t = n.fn.stickySidebar; 1024 n.fn.stickySidebar.noConflict = function () { 1025 return n.fn.stickySidebar = t, this 1026 } 1027 } 1028 } 1029 }() 1030 })(i) 1031 })) 1032});
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.