diff --git a/css/plugins/metisMenu/metisMenu.css b/css/plugins/metisMenu/metisMenu.css index 77cdfa2980739e620ad54ec7bb0f1e6e3924e902..76376c39aeecc061869c16f251bd56ba11aea828 100644 --- a/css/plugins/metisMenu/metisMenu.css +++ b/css/plugins/metisMenu/metisMenu.css @@ -1,13 +1,14 @@ /* - * metismenu - v1.0.3 + * metismenu - v1.1.3 * Easy menu jQuery plugin for Twitter Bootstrap 3 * https://github.com/onokumus/metisMenu * - * Made by Osman Nuri OkumuÅŸ + * Made by Osman Nuri Okumus * Under MIT License */ .arrow { float: right; + line-height: 1.42857; } .glyphicon.arrow:before { diff --git a/css/plugins/metisMenu/metisMenu.min.css b/css/plugins/metisMenu/metisMenu.min.css index 6df69bdfb7c92aaa033e0fd04591909ce2b0e981..a1d0ef399422cd24224912afc3e3230feb69b3a1 100644 --- a/css/plugins/metisMenu/metisMenu.min.css +++ b/css/plugins/metisMenu/metisMenu.min.css @@ -1 +1,10 @@ -.arrow{float:right}.glyphicon.arrow:before{content:"\e079"}.active>a>.glyphicon.arrow:before{content:"\e114"}.fa.arrow:before{content:"\f104"}.active>a>.fa.arrow:before{content:"\f107"}.plus-times{float:right}.fa.plus-times:before{content:"\f067"}.active>a>.fa.plus-times{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.plus-minus{float:right}.fa.plus-minus:before{content:"\f067"}.active>a>.fa.plus-minus:before{content:"\f068"} \ No newline at end of file +/* + * metismenu - v1.1.3 + * Easy menu jQuery plugin for Twitter Bootstrap 3 + * https://github.com/onokumus/metisMenu + * + * Made by Osman Nuri Okumus + * Under MIT License + */ + +.arrow{float:right;line-height:1.42857}.glyphicon.arrow:before{content:"\e079"}.active>a>.glyphicon.arrow:before{content:"\e114"}.fa.arrow:before{content:"\f104"}.active>a>.fa.arrow:before{content:"\f107"}.plus-times{float:right}.fa.plus-times:before{content:"\f067"}.active>a>.fa.plus-times{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.plus-minus{float:right}.fa.plus-minus:before{content:"\f067"}.active>a>.fa.plus-minus:before{content:"\f068"} \ No newline at end of file diff --git a/js/plugins/metisMenu/metisMenu.js b/js/plugins/metisMenu/metisMenu.js index 9f8d62798fd06459f0c55b798077aa37086dac17..3785904513eb6b0b0f49633d99567e6506450f72 100644 --- a/js/plugins/metisMenu/metisMenu.js +++ b/js/plugins/metisMenu/metisMenu.js @@ -1,20 +1,21 @@ /* - * metismenu - v1.0.3 + * metismenu - v1.1.3 * Easy menu jQuery plugin for Twitter Bootstrap 3 * https://github.com/onokumus/metisMenu * - * Made by Osman Nuri OkumuÅŸ + * Made by Osman Nuri Okumus * Under MIT License */ -;(function ($, window, document, undefined) { +;(function($, window, document, undefined) { var pluginName = "metisMenu", defaults = { - toggle: true + toggle: true, + doubleTapToGo: false }; - + function Plugin(element, options) { - this.element = element; + this.element = $(element); this.settings = $.extend({}, defaults, options); this._defaults = defaults; this._name = pluginName; @@ -22,10 +23,11 @@ } Plugin.prototype = { - init: function () { + init: function() { - var $this = $(this.element), - $toggle = this.settings.toggle; + var $this = this.element, + $toggle = this.settings.toggle, + obj = this; if (this.isIE() <= 9) { $this.find("li.active").has("ul").children("ul").collapse("show"); @@ -35,18 +37,35 @@ $this.find("li").not(".active").has("ul").children("ul").addClass("collapse"); } - $this.find("li").has("ul").children("a").on("click", function (e) { + //add the "doubleTapToGo" class to active items if needed + if (obj.settings.doubleTapToGo) { + $this.find("li.active").has("ul").children("a").addClass("doubleTapToGo"); + } + + $this.find("li").has("ul").children("a").on("click" + "." + pluginName, function(e) { e.preventDefault(); + //Do we need to enable the double tap + if (obj.settings.doubleTapToGo) { + + //if we hit a second time on the link and the href is valid, navigate to that url + if (obj.doubleTapToGo($(this)) && $(this).attr("href") !== "#" && $(this).attr("href") !== "") { + e.stopPropagation(); + document.location = $(this).attr("href"); + return; + } + } + $(this).parent("li").toggleClass("active").children("ul").collapse("toggle"); if ($toggle) { $(this).parent("li").siblings().removeClass("active").children("ul.in").collapse("hide"); } + }); }, - isIE: function() {//https://gist.github.com/padolsey/527683 + isIE: function() { //https://gist.github.com/padolsey/527683 var undef, v = 3, div = document.createElement("div"), @@ -58,15 +77,44 @@ ) { return v > 4 ? v : undef; } + }, + + //Enable the link on the second click. + doubleTapToGo: function(elem) { + var $this = this.element; + + //if the class "doubleTapToGo" exists, remove it and return + if (elem.hasClass("doubleTapToGo")) { + elem.removeClass("doubleTapToGo"); + return true; + } + + //does not exists, add a new class and return false + if (elem.parent().children("ul").length) { + //first remove all other class + $this.find(".doubleTapToGo").removeClass("doubleTapToGo"); + //add the class on the current element + elem.addClass("doubleTapToGo"); + return false; + } + }, + + remove: function() { + this.element.off("." + pluginName); + this.element.removeData(pluginName); } + }; - $.fn[ pluginName ] = function (options) { - return this.each(function () { - if (!$.data(this, "plugin_" + pluginName)) { - $.data(this, "plugin_" + pluginName, new Plugin(this, options)); + $.fn[pluginName] = function(options) { + this.each(function () { + var el = $(this); + if (el.data(pluginName)) { + el.data(pluginName).remove(); } + el.data(pluginName, new Plugin(this, options)); }); + return this; }; -})(jQuery, window, document); +})(jQuery, window, document); \ No newline at end of file diff --git a/js/plugins/metisMenu/metisMenu.min.js b/js/plugins/metisMenu/metisMenu.min.js index 03ac02b4a44cf9b6d785fbba1499357fe81618b5..8a590e75ffcc43489593b8b115edc3d6fb79d98b 100644 --- a/js/plugins/metisMenu/metisMenu.min.js +++ b/js/plugins/metisMenu/metisMenu.min.js @@ -1,9 +1,9 @@ /* - * metismenu - v1.0.3 + * metismenu - v1.1.3 * Easy menu jQuery plugin for Twitter Bootstrap 3 * https://github.com/onokumus/metisMenu * - * Made by Osman Nuri OkumuÅŸ + * Made by Osman Nuri Okumus * Under MIT License */ -!function(a,b,c){function d(b,c){this.element=b,this.settings=a.extend({},f,c),this._defaults=f,this._name=e,this.init()}var e="metisMenu",f={toggle:!0};d.prototype={init:function(){var b=a(this.element),c=this.settings.toggle;this.isIE()<=9?(b.find("li.active").has("ul").children("ul").collapse("show"),b.find("li").not(".active").has("ul").children("ul").collapse("hide")):(b.find("li.active").has("ul").children("ul").addClass("collapse in"),b.find("li").not(".active").has("ul").children("ul").addClass("collapse")),b.find("li").has("ul").children("a").on("click",function(b){b.preventDefault(),a(this).parent("li").toggleClass("active").children("ul").collapse("toggle"),c&&a(this).parent("li").siblings().removeClass("active").children("ul.in").collapse("hide")})},isIE:function(){for(var a,b=3,d=c.createElement("div"),e=d.getElementsByTagName("i");d.innerHTML="<!--[if gt IE "+ ++b+"]><i></i><![endif]-->",e[0];)return b>4?b:a}},a.fn[e]=function(b){return this.each(function(){a.data(this,"plugin_"+e)||a.data(this,"plugin_"+e,new d(this,b))})}}(jQuery,window,document); \ No newline at end of file +!function(a,b,c){function d(b,c){this.element=a(b),this.settings=a.extend({},f,c),this._defaults=f,this._name=e,this.init()}var e="metisMenu",f={toggle:!0,doubleTapToGo:!1};d.prototype={init:function(){var b=this.element,d=this.settings.toggle,f=this;this.isIE()<=9?(b.find("li.active").has("ul").children("ul").collapse("show"),b.find("li").not(".active").has("ul").children("ul").collapse("hide")):(b.find("li.active").has("ul").children("ul").addClass("collapse in"),b.find("li").not(".active").has("ul").children("ul").addClass("collapse")),f.settings.doubleTapToGo&&b.find("li.active").has("ul").children("a").addClass("doubleTapToGo"),b.find("li").has("ul").children("a").on("click."+e,function(b){return b.preventDefault(),f.settings.doubleTapToGo&&f.doubleTapToGo(a(this))&&"#"!==a(this).attr("href")&&""!==a(this).attr("href")?(b.stopPropagation(),void(c.location=a(this).attr("href"))):(a(this).parent("li").toggleClass("active").children("ul").collapse("toggle"),void(d&&a(this).parent("li").siblings().removeClass("active").children("ul.in").collapse("hide")))})},isIE:function(){for(var a,b=3,d=c.createElement("div"),e=d.getElementsByTagName("i");d.innerHTML="<!--[if gt IE "+ ++b+"]><i></i><![endif]-->",e[0];)return b>4?b:a},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},remove:function(){this.element.off("."+e),this.element.removeData(e)}},a.fn[e]=function(b){return this.each(function(){var c=a(this);c.data(e)&&c.data(e).remove(),c.data(e,new d(this,b))}),this}}(jQuery,window,document); \ No newline at end of file