bootstrap-submenu
Advanced tools
Comparing version 1.1.4 to 1.1.5
/*! | ||
* Bootstrap-submenu v1.1.4 (http://vsn4ik.github.io/bootstrap-submenu) | ||
* Bootstrap-submenu v1.1.5 (http://vsn4ik.github.io/bootstrap-submenu) | ||
* Copyright 2014 vsn4ik | ||
@@ -15,5 +15,9 @@ * Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE) | ||
function Submenupicker(element) { | ||
var desc = ':not(.disabled, .divider, .dropdown-header):first'; | ||
this.$element = $(element); | ||
this.$menu = this.$element.parent(); | ||
this.$submenus = this.$menu.parent().find('.dropdown-submenu').not(this.$menu); | ||
this.$prev = this.$menu.prevAll(desc).children('a'); | ||
this.$next = this.$menu.nextAll(desc).children('a'); | ||
@@ -39,3 +43,3 @@ this.init(); | ||
// 13: Return, 32: Spacebar | ||
// 38: Arrow left, 40: Arrow right | ||
// 38: Arrow up, 40: Arrow down | ||
@@ -47,9 +51,15 @@ // Off vertical scrolling | ||
if (/^(38|40)$/.test(event.keyCode)) { | ||
event.stopPropagation(); | ||
} | ||
if (/^(13|32)$/.test(event.keyCode)) { | ||
this.toggle(); | ||
} | ||
else if (/^(38|40)$/.test(event.keyCode)) { | ||
event.stopPropagation(); | ||
if (event.keyCode == 38) { | ||
this.$prev.focus(); | ||
} | ||
else if (event.keyCode == 40) { | ||
this.$next.focus(); | ||
} | ||
} | ||
} | ||
@@ -60,4 +70,3 @@ }; | ||
return this.each(function() { | ||
var $this = $(this); | ||
var data = $this.data('bs.submenu'); | ||
var data = $.data(this, 'bs.submenu'); | ||
@@ -67,3 +76,3 @@ if (!data) { | ||
$this.data('bs.submenu', true); | ||
$.data(this, 'bs.submenu', true); | ||
} | ||
@@ -70,0 +79,0 @@ }); |
/*! | ||
* Bootstrap-submenu v1.1.4 (http://vsn4ik.github.io/bootstrap-submenu) | ||
* Bootstrap-submenu v1.1.5 (http://vsn4ik.github.io/bootstrap-submenu) | ||
* Copyright 2014 vsn4ik | ||
@@ -7,2 +7,2 @@ * Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE) | ||
"use strict";if("undefined"==typeof jQuery)throw new Error("Bootstrap-submenu requires jQuery");!function(a){function b(b){this.$element=a(b),this.$menu=this.$element.parent(),this.$submenus=this.$menu.parent().find(".dropdown-submenu").not(this.$menu),this.init()}b.prototype={init:function(){this.$element.on("click.bs.dropdown",this.click.bind(this)),this.$element.keydown(this.keydown.bind(this))},click:function(a){a.stopPropagation(),this.toggle()},toggle:function(){this.$menu.toggleClass("open"),this.$submenus.removeClass("open")},keydown:function(a){/^(32|38|40)$/.test(a.keyCode)&&a.preventDefault(),/^(38|40)$/.test(a.keyCode)&&a.stopPropagation(),/^(13|32)$/.test(a.keyCode)&&this.toggle()}},a.fn.submenupicker=function(){return this.each(function(){var c=a(this),d=c.data("bs.submenu");d||(new b(this),c.data("bs.submenu",!0))})}}(jQuery); | ||
"use strict";if("undefined"==typeof jQuery)throw new Error("Bootstrap-submenu requires jQuery");!function(a){function b(b){var c=":not(.disabled, .divider, .dropdown-header):first";this.$element=a(b),this.$menu=this.$element.parent(),this.$submenus=this.$menu.parent().find(".dropdown-submenu").not(this.$menu),this.$prev=this.$menu.prevAll(c).children("a"),this.$next=this.$menu.nextAll(c).children("a"),this.init()}b.prototype={init:function(){this.$element.on("click.bs.dropdown",this.click.bind(this)),this.$element.keydown(this.keydown.bind(this))},click:function(a){a.stopPropagation(),this.toggle()},toggle:function(){this.$menu.toggleClass("open"),this.$submenus.removeClass("open")},keydown:function(a){/^(32|38|40)$/.test(a.keyCode)&&a.preventDefault(),/^(13|32)$/.test(a.keyCode)?this.toggle():/^(38|40)$/.test(a.keyCode)&&(a.stopPropagation(),38==a.keyCode?this.$prev.focus():40==a.keyCode&&this.$next.focus())}},a.fn.submenupicker=function(){return this.each(function(){var c=a.data(this,"bs.submenu");c||(new b(this),a.data(this,"bs.submenu",!0))})}}(jQuery); |
@@ -9,5 +9,9 @@ 'use strict'; | ||
function Submenupicker(element) { | ||
var desc = ':not(.disabled, .divider, .dropdown-header):first'; | ||
this.$element = $(element); | ||
this.$menu = this.$element.parent(); | ||
this.$submenus = this.$menu.parent().find('.dropdown-submenu').not(this.$menu); | ||
this.$prev = this.$menu.prevAll(desc).children('a'); | ||
this.$next = this.$menu.nextAll(desc).children('a'); | ||
@@ -33,3 +37,3 @@ this.init(); | ||
// 13: Return, 32: Spacebar | ||
// 38: Arrow left, 40: Arrow right | ||
// 38: Arrow up, 40: Arrow down | ||
@@ -41,9 +45,15 @@ // Off vertical scrolling | ||
if (/^(38|40)$/.test(event.keyCode)) { | ||
event.stopPropagation(); | ||
} | ||
if (/^(13|32)$/.test(event.keyCode)) { | ||
this.toggle(); | ||
} | ||
else if (/^(38|40)$/.test(event.keyCode)) { | ||
event.stopPropagation(); | ||
if (event.keyCode == 38) { | ||
this.$prev.focus(); | ||
} | ||
else if (event.keyCode == 40) { | ||
this.$next.focus(); | ||
} | ||
} | ||
} | ||
@@ -54,4 +64,3 @@ }; | ||
return this.each(function() { | ||
var $this = $(this); | ||
var data = $this.data('bs.submenu'); | ||
var data = $.data(this, 'bs.submenu'); | ||
@@ -61,3 +70,3 @@ if (!data) { | ||
$this.data('bs.submenu', true); | ||
$.data(this, 'bs.submenu', true); | ||
} | ||
@@ -64,0 +73,0 @@ }); |
{ | ||
"name": "bootstrap-submenu", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Bootstrap Sub-Menus", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11967
177