mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-23 21:02:15 +00:00
46 lines
4.5 KiB
JavaScript
Executable file
46 lines
4.5 KiB
JavaScript
Executable file
/*
|
|
* metismenu - v2.0.2
|
|
* A jQuery menu plugin
|
|
* https://github.com/onokumus/metisMenu
|
|
*
|
|
* Made by Osman Nuri Okumus
|
|
* Under MIT License
|
|
*/
|
|
|
|
!function(a){"use strict";function b(){var a=document.createElement("mm"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}function c(b){return this.each(function(){var c=a(this),d=c.data("mm"),f=a.extend({},e.DEFAULTS,c.data(),"object"==typeof b&&b);d||c.data("mm",d=new e(this,f)),"string"==typeof b&&d[b]()})}a.fn.emulateTransitionEnd=function(b){var c=!1,e=this;a(this).one("mmTransitionEnd",function(){c=!0});var f=function(){c||a(e).trigger(d.end)};return setTimeout(f,b),this};var d=b();d&&(a.event.special.mmTransitionEnd={bindType:d.end,delegateType:d.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}});var e=function(b,c){this.$element=a(b),this.options=a.extend({},e.DEFAULTS,c),this.transitioning=null,this.init()};e.TRANSITION_DURATION=350,e.DEFAULTS={toggle:!0,doubleTapToGo:!1,activeClass:"active",collapseClass:"collapse",collapseInClass:"in",collapsingClass:"collapsing"},e.prototype.init=function(){var b=this,c=this.options.activeClass,d=this.options.collapseClass,e=this.options.collapseInClass;this.$element.find("li."+c).has("ul").children("ul").addClass(d+" "+e),this.$element.find("li").not("."+c).has("ul").children("ul").addClass(d),this.options.doubleTapToGo&&this.$element.find("li."+c).has("ul").children("a").addClass("doubleTapToGo"),this.$element.find("li").has("ul").children("a").on("click.metisMenu",function(d){var e=a(this),f=e.parent("li"),g=f.children("ul");return d.preventDefault(),f.hasClass(c)?b.hide(g):b.show(g),b.options.doubleTapToGo&&b.doubleTapToGo(e)&&"#"!==e.attr("href")&&""!==e.attr("href")?(d.stopPropagation(),void(document.location=e.attr("href"))):void 0})},e.prototype.doubleTapToGo=function(a){var b=this.$element;return a.hasClass("doubleTapToGo")?(a.removeClass("doubleTapToGo"),!0):a.parent().children("ul").length?(b.find(".doubleTapToGo").removeClass("doubleTapToGo"),a.addClass("doubleTapToGo"),!1):void 0},e.prototype.show=function(b){var c=this.options.activeClass,f=this.options.collapseClass,g=this.options.collapseInClass,h=this.options.collapsingClass,i=a(b),j=i.parent("li");if(!this.transitioning&&!i.hasClass(g)){j.addClass(c),this.options.toggle&&this.hide(j.siblings().children("ul."+g)),i.removeClass(f).addClass(h).height(0),this.transitioning=1;var k=function(){i.removeClass(h).addClass(f+" "+g).height(""),this.transitioning=0};return d?void i.one("mmTransitionEnd",a.proxy(k,this)).emulateTransitionEnd(e.TRANSITION_DURATION).height(i[0].scrollHeight):k.call(this)}},e.prototype.hide=function(b){var c=this.options.activeClass,f=this.options.collapseClass,g=this.options.collapseInClass,h=this.options.collapsingClass,i=a(b);if(!this.transitioning&&i.hasClass(g)){i.parent("li").removeClass(c),i.height(i.height())[0].offsetHeight,i.addClass(h).removeClass(f).removeClass(g),this.transitioning=1;var j=function(){this.transitioning=0,i.removeClass(h).addClass(f)};return d?void i.height(0).one("mmTransitionEnd",a.proxy(j,this)).emulateTransitionEnd(e.TRANSITION_DURATION):j.call(this)}};var f=a.fn.metisMenu;a.fn.metisMenu=c,a.fn.metisMenu.Constructor=e,a.fn.metisMenu.noConflict=function(){return a.fn.metisMenu=f,this}}(jQuery);
|
|
|
|
|
|
$(function() {
|
|
$('#side-menu').metisMenu();
|
|
});
|
|
|
|
//Loads the correct sidebar on window load,
|
|
//collapses the sidebar on window resize.
|
|
// Sets the min-height of #page-wrapper to window size
|
|
$(function() {
|
|
$(window).bind("load resize", function() {
|
|
topOffset = 50;
|
|
width = (this.window.innerWidth > 0) ? this.window.innerWidth : this.screen.width;
|
|
if (width < 768) {
|
|
$('div.navbar-collapse').addClass('collapse');
|
|
topOffset = 100; // 2-row-menu
|
|
} else {
|
|
$('div.navbar-collapse').removeClass('collapse');
|
|
}
|
|
|
|
height = ((this.window.innerHeight > 0) ? this.window.innerHeight : this.screen.height) - 1;
|
|
height = height - topOffset;
|
|
if (height < 1) height = 1;
|
|
if (height > topOffset) {
|
|
$("#page-wrapper").css("min-height", (height) + "px");
|
|
}
|
|
});
|
|
|
|
var url = window.location;
|
|
var element = $('ul.nav a').filter(function() {
|
|
return this.href == url || url.href.indexOf(this.href) == 0;
|
|
}).addClass('active').parent().parent().addClass('in').parent();
|
|
if (element.is('li')) {
|
|
element.addClass('active');
|
|
}
|
|
});
|