File "mad.sidebar-hidden.min.js"
Full Path: /var/www/vhosts/hogsandbbqs.co.uk/httpdocs/js/css/modules/mad.sidebar-hidden.min.js
File size: 2.81 KB
MIME-type: text/plain
Charset: utf-8
var MadSidebarHidden=function(c){function d(a){this.config=c.isPlainObject(a)?c.extend(!0,{},h,a):h;Object.defineProperties(this,{sidebarClass:{get:function(){return this.config.cssPrefix+this.config.classMap.sidebar}},sidebarSelector:{get:function(){return"."+this.sidebarClass}},invokerClass:{get:function(){return this.config.cssPrefix+this.config.classMap.invoker}},invokerSelector:{get:function(){return"."+this.invokerClass}},niceScrolledClass:{get:function(){return this.config.cssPrefix+this.config.classMap.niceScrolled}},
niceScrolledSelector:{get:function(){return"."+this.niceScrolledClass}},closeClass:{get:function(){return this.config.cssPrefix+this.config.classMap.close}},closeSelector:{get:function(){return"."+this.closeClass}},activeClass:{get:function(){return this.config.cssPrefix+this.config.classMap.active}}});this.initialize()}var f=c("body"),g,h={cssPrefix:"",classMap:{sidebar:"sidebar-hidden",invoker:"sidebar-hidden-btn",close:"sidebar-hidden-close",pushedContainer:"page-wrapper",active:"body--hidden-sidebar-opened",
niceScrolled:"-nice-scrolled"}};d.prototype.initialize=function(){var a=this;f.off("click.MadSidebarHidden").on("click.MadSidebarHidden",a.invokerSelector,function(b){var e=c(this);c(e.data("sidebar-hidden")).length&&(a.toggle(e),b.preventDefault())}).on("click.MadSidebarHidden",a.closeSelector,function(b){var e=c(this);c(e.data("sidebar-hidden")).length&&(a.hide(e),b.preventDefault())});c(document).off("keydown.MadSidebarHidden").on("keydown.MadSidebarHidden",function(b){b.keyCode&&
27==b.keyCode&&a.hideAll()}).off("click.MadSidebarHidden").on("click.MadSidebarHidden",function(b){c(b.target).closest(a.sidebarSelector+","+a.invokerSelector+", .fancybox-container").length||a.hideAll()})};d.prototype.toggle=function(a){this.isOpened()?this.hide(a):this.show(a)};d.prototype.isOpened=function(){return f.hasClass(this.activeClass)};d.prototype.hide=function(a){var b=a.data("sidebar-hidden");a=c(b);var e=a.closest(this.niceScrolledSelector).add(a.find(this.niceScrolledSelector));
b=c('[data-sidebar-hidden="'+b+'"]');var d=1E3*parseFloat(a.css("transition-duration"),10);f.removeClass(this.activeClass);b.attr("aria-expanded","false");a.attr("aria-hidden","true");e.length&&(g=setInterval(function(){e.getNiceScroll().resize()},4),setTimeout(function(){clearInterval(g)},d))};d.prototype.show=function(a){var b=a.data("sidebar-hidden");a=c(b);var e=a.closest(this.niceScrolledSelector);b=c('[data-sidebar-hidden="'+b+'"]');var d=1E3*parseFloat(a.css("transition-duration"),10);f.addClass(this.activeClass);
b.attr("aria-expanded","true");a.attr("aria-hidden","false");e.length&&(g=setInterval(function(){e.getNiceScroll().resize()},4),setTimeout(function(){clearInterval(g)},d))};d.prototype.hideAll=function(){var a=c(this.invokerSelector),b=this;a.length&&a.each(function(a,d){b.hide(c(d))})};return d}(window.jQuery);