(function () { // Define breakpoints for mobile, tablet, and desktop const mobileBreakpoint = 767; const tabletBreakpoint = 1024; let previousDeviceCategory = ""; // To store the previous window size category // Function to detect device size category function getDeviceCategory() { const width = window.innerWidth; if (width <= mobileBreakpoint) { return "mobile"; } else if (width > mobileBreakpoint && width <= tabletBreakpoint) { return "tablet"; } else { return "desktop"; } } // Function to check for window resize and refresh if needed function checkWindowSize() { const currentDeviceCategory = getDeviceCategory(); // Compare with the previous device category if (currentDeviceCategory !== previousDeviceCategory) { previousDeviceCategory = currentDeviceCategory; // Update the previous category location.reload(); } } document.addEventListener("DOMContentLoaded", function () { let resizeTimeout; function checkWindowSizeDebounced() { clearTimeout(resizeTimeout); resizeTimeout = setTimeout(checkWindowSize, 200); // 200ms delay } // Initial detection when the page loads previousDeviceCategory = getDeviceCategory(); window.addEventListener("resize", checkWindowSizeDebounced); }); })(); ; jQuery(document).ready(function(a){"use strict";function b(){var b=a(".site-header__banner").outerHeight(!0),c=a("#wpadminbar").outerHeight(!0);a(".ht-global-overlay").css({top:b+c}),a(".nav-header__menuwrapper").css({top:b})}function c(){var b=a(".site-header").outerHeight(!0),c=a(".ht-pageheader").outerHeight(!0),d=a(".site-footer").outerHeight(!0),e=a("#wpadminbar").outerHeight(!0),f=a(".ht-page"),g=f.css("padding-top").replace(/[^-\d.]/g,""),h=f.css("padding-bottom").replace(/[^-\d.]/g,"");g=parseInt(g),h=parseInt(h);var i=a(".hkb-article").outerHeight(!0),j=a(".sidebar--sticky").outerHeight(!0),k=a(".hkb-article__lastupdated").outerHeight(!0),l=a(".hkb-article-attachments").outerHeight(!0),m=a(".hkb-article-tags").outerHeight(!0),n=a(".hkb-feedback").outerHeight(!0),o=a(".hkb-article-author").outerHeight(!0),p=a(".hkb-article-related").outerHeight(!0),q=a(".ht-commentslist").outerHeight(!0);a(".sidebar--sticky").each(function(){var b=a(this),c=b.width();a(this).children().attr("style","width: "+c+"px")}),i>j&&a(".sidebar__innercontainer--affix").affix({offset:{top:b+c+g-e,bottom:k+l+m+n+o+p+q+h+d+44}})}function d(){if(a(".hkb-archive--style1 .hkb-archive--style3 .hkb-archive--style4 .hkb-archive--style5 .hkb-archive--style6").length){var b=-1;a(".hkb-archive li").each(function(){b=b>a(this).height()?b:a(this).height()}),a(".hkb-archive li").each(function(){a(".hkb-archive .hkb-category.hkb-category--hasdesc a").css("min-height",b)})}}a(function(){a('a[href*="#"]:not([href="#"])').on("click",function(b){if(location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname){var c=a(this.hash)||"",d="";try{d=this.hash.slice(1)}catch(a){}if(c=c.length?c:a("[name="+this.hash.slice(1)+"]"),c.length)return a("html,body").animate({scrollTop:c.offset().top},1e3,"swing",function(){window.location.hash=d}),!1}})}),a("#ht-navtoggle").on("click",function(b){a("#ht-navtoggle, .ht-global-overlay").toggleClass("active"),b.preventDefault()}),a(".hkb-site-search__field").keypress(function(){a("body").addClass("htevent-hkb-searching")}),a(".hkb-site-search__field").blur(function(){a("body").removeClass("htevent-hkb-searching")}),a(window).load(function(){b(),d(),c()}),a(window).resize(function(){b(),d(),c()}),a(".hkb-article-attachments__title").click(function(){a(this).parent(".hkb-article-attachments").toggleClass("hkb-article-attachments--active")});a(document.body).on("ht.nav.process",function(){a("#navtoc li.active").length<1&&a("#navtoc li").first().addClass("active")})});; /* ======================================================================== * Bootstrap: affix.js v3.3.7 * http://getbootstrap.com/javascript/#affix * ======================================================================== * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // AFFIX CLASS DEFINITION // ====================== var Affix = function (element, options) { this.options = $.extend({}, Affix.DEFAULTS, options) this.$target = $(this.options.target) .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) this.$element = $(element) this.affixed = null this.unpin = null this.pinnedOffset = null this.checkPosition() } Affix.VERSION = '3.3.7' Affix.RESET = 'affix affix-top affix-bottom' Affix.DEFAULTS = { offset: 0, target: window } Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { var scrollTop = this.$target.scrollTop() var position = this.$element.offset() var targetHeight = this.$target.height() if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false if (this.affixed == 'bottom') { if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' } var initializing = this.affixed == null var colliderTop = initializing ? scrollTop : position.top var colliderHeight = initializing ? targetHeight : height if (offsetTop != null && scrollTop <= offsetTop) return 'top' if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' return false } Affix.prototype.getPinnedOffset = function () { if (this.pinnedOffset) return this.pinnedOffset this.$element.removeClass(Affix.RESET).addClass('affix') var scrollTop = this.$target.scrollTop() var position = this.$element.offset() return (this.pinnedOffset = position.top - scrollTop) } Affix.prototype.checkPositionWithEventLoop = function () { setTimeout($.proxy(this.checkPosition, this), 1) } Affix.prototype.checkPosition = function () { if (!this.$element.is(':visible')) return var height = this.$element.height() var offset = this.options.offset var offsetTop = offset.top var offsetBottom = offset.bottom var scrollHeight = Math.max($(document).height(), $(document.body).height()) if (typeof offset != 'object') offsetBottom = offsetTop = offset if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) if (this.affixed != affix) { if (this.unpin != null) this.$element.css('top', '') var affixType = 'affix' + (affix ? '-' + affix : '') var e = $.Event(affixType + '.bs.affix') this.$element.trigger(e) if (e.isDefaultPrevented()) return this.affixed = affix this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null this.$element .removeClass(Affix.RESET) .addClass(affixType) .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') } if (affix == 'bottom') { this.$element.offset({ top: scrollHeight - height - offsetBottom }) } } // AFFIX PLUGIN DEFINITION // ======================= function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.affix') var options = typeof option == 'object' && option if (!data) $this.data('bs.affix', (data = new Affix(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.affix $.fn.affix = Plugin $.fn.affix.Constructor = Affix // AFFIX NO CONFLICT // ================= $.fn.affix.noConflict = function () { $.fn.affix = old return this } // AFFIX DATA-API // ============== $(window).on('load', function () { $('[data-spy="affix"]').each(function () { var $spy = $(this) var data = $spy.data() data.offset = data.offset || {} if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom if (data.offsetTop != null) data.offset.top = data.offsetTop Plugin.call($spy, data) }) }) }(jQuery);; /* ======================================================================== * Bootstrap: scrollspy.js v3.3.7 * http://getbootstrap.com/javascript/#scrollspy * ======================================================================== * Copyright 2011-2016 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // SCROLLSPY CLASS DEFINITION // ========================== function ScrollSpy(element, options) { this.$body = $(document.body) this.$scrollElement = $(element).is(document.body) ? $(window) : $(element) this.options = $.extend({}, ScrollSpy.DEFAULTS, options) this.selector = (this.options.target || '') + ' .nav li > a' this.offsets = [] this.targets = [] this.activeTarget = null this.scrollHeight = 0 this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)) this.refresh() this.process() } ScrollSpy.VERSION = '3.3.7' ScrollSpy.DEFAULTS = { offset: 10 } ScrollSpy.prototype.getScrollHeight = function () { return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) } ScrollSpy.prototype.refresh = function () { var that = this var offsetMethod = 'offset' var offsetBase = 0 this.offsets = [] this.targets = [] this.scrollHeight = this.getScrollHeight() if (!$.isWindow(this.$scrollElement[0])) { offsetMethod = 'position' offsetBase = this.$scrollElement.scrollTop() } this.$body .find(this.selector) .map(function () { var $el = $(this) var href = $el.data('target') || $el.attr('href') var $href = /^#./.test(href) && $(href) return ($href && $href.length && $href.is(':visible') && [[$href[offsetMethod]().top + offsetBase, href]]) || null }) .sort(function (a, b) { return a[0] - b[0] }) .each(function () { that.offsets.push(this[0]) that.targets.push(this[1]) }) } ScrollSpy.prototype.process = function () { var scrollTop = this.$scrollElement.scrollTop() + this.options.offset var scrollHeight = this.getScrollHeight() var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() var offsets = this.offsets var targets = this.targets var activeTarget = this.activeTarget var i if (this.scrollHeight != scrollHeight) { this.refresh() } if (scrollTop >= maxScroll) { return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) } if (activeTarget && scrollTop < offsets[0]) { this.activeTarget = null return this.clear() } //ht custom code this.$body.trigger('ht.nav.process') for (i = offsets.length; i--;) { activeTarget != targets[i] && scrollTop >= offsets[i] && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) && this.activate(targets[i]) } } ScrollSpy.prototype.activate = function (target) { this.activeTarget = target this.clear() var selector = this.selector + '[data-target="' + target + '"],' + this.selector + '[href="' + target + '"]' var active = $(selector) .parents('li') .addClass('active') if (active.parent('.dropdown-menu').length) { active = active .closest('li.dropdown') .addClass('active') } active.trigger('activate.bs.scrollspy') } ScrollSpy.prototype.clear = function () { $(this.selector) .parentsUntil(this.options.target, '.active') .removeClass('active') } // SCROLLSPY PLUGIN DEFINITION // =========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.scrollspy') var options = typeof option == 'object' && option if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.scrollspy $.fn.scrollspy = Plugin $.fn.scrollspy.Constructor = ScrollSpy // SCROLLSPY NO CONFLICT // ===================== $.fn.scrollspy.noConflict = function () { $.fn.scrollspy = old return this } // SCROLLSPY DATA-API // ================== $(window).on('load.bs.scrollspy.data-api', function () { $('[data-spy="scroll"]').each(function () { var $spy = $(this) Plugin.call($spy, $spy.data()) }) }) }(jQuery);;