Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bootstrap-submenu

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bootstrap-submenu - npm Package Compare versions

Comparing version 1.2.13 to 2.0.0

dist/css/bootstrap-submenu.min.css.map

181

dist/js/bootstrap-submenu.js
/*!
* Bootstrap-submenu v1.2.13 (http://vsn4ik.github.io/bootstrap-submenu)
* Bootstrap-submenu v2.0.0 (http://vsn4ik.github.io/bootstrap-submenu)
* Copyright 2015 Vasily A. (https://github.com/vsn4ik)
* Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE)
* Licensed under the MIT license
*/
/**
* 'Strict Mode' strictly in body of function
* $.inArray: friends with IE8. Use Array.prototype.indexOf in future.

@@ -29,32 +28,49 @@ * $.proxy: friends with IE8. Use Function.prototype.bind in future.

})(function($) {
// Or ':not(.disabled):has(a)' or ':not(.disabled):parent';
var desc = ':not(.disabled, .divider, .dropdown-header)';
function Submenupicker(element) {
function Item(element) {
this.$element = $(element);
this.$main = this.$element.closest('.dropdown, .dropup, .btn-group');
this.$menu = this.$element.parent();
this.$drop = this.$menu.parent().parent();
this.$menus = this.$menu.siblings('.dropdown-submenu');
this.$menu = this.$element.closest('.dropdown-menu');
this.$main = this.$menu.parent();
this.$items = this.$menu.children('.dropdown-submenu');
var $children = this.$menu.find('> .dropdown-menu > ' + desc);
this.init();
}
this.$submenus = $children.filter('.dropdown-submenu');
this.$items = $children.not('.dropdown-submenu');
Item.prototype = {
init: function() {
this.$element.on('keydown', $.proxy(this, 'keydown'));
},
close: function() {
this.$main.removeClass('open');
this.$items.trigger('hide.bs.submenu');
},
keydown: function(event) {
// 27: Esc
if (event.keyCode == 27) {
event.stopPropagation();
this.close();
this.$main.children('a, button').trigger('focus');
}
}
};
function SubmenuItem(element) {
this.$element = $(element);
this.$main = this.$element.parent();
this.$menu = this.$main.children('.dropdown-menu');
this.$subs = this.$main.siblings('.dropdown-submenu');
this.$items = this.$menu.children('.dropdown-submenu');
this.init();
}
Submenupicker.prototype = {
$.extend(SubmenuItem.prototype, Item.prototype, {
init: function() {
this.$element.on({
'click.bs.dropdown': $.proxy(this.click, this),
keydown: $.proxy(this.keydown, this)
click: $.proxy(this, 'click'),
keydown: $.proxy(this, 'keydown')
});
this.$menu.on('hide.bs.submenu', $.proxy(this.hide, this));
this.$items.on('keydown', $.proxy(this.item_keydown, this));
// Bootstrap fix
this.$menu.nextAll(desc + ':first:not(.dropdown-submenu)').children('a').on('keydown', $.proxy(this.next_keydown, this));
this.$main.on('hide.bs.submenu', $.proxy(this.hide, this));
},

@@ -66,11 +82,2 @@ click: function(event) {

},
toggle: function() {
if (this.$menu.hasClass('open')) {
this.close();
}
else {
this.$menu.addClass('open');
this.$menus.trigger('hide.bs.submenu');
}
},
hide: function(event) {

@@ -82,12 +89,19 @@ // Stop event bubbling

},
close: function() {
this.$menu.removeClass('open');
this.$submenus.trigger('hide.bs.submenu');
open: function() {
this.$main.addClass('open');
this.$subs.trigger('hide.bs.submenu');
},
toggle: function() {
if (this.$main.hasClass('open')) {
this.close();
}
else {
this.open();
}
},
keydown: function(event) {
// 13: Return, 27: Esc, 32: Spacebar
// 38: Arrow up, 40: Arrow down
// 13: Return, 32: Spacebar
// Off vertical scrolling
if ($.inArray(event.keyCode, [32, 38, 40]) != -1) {
if (event.keyCode == 32) {
// Off vertical scrolling
event.preventDefault();

@@ -99,63 +113,56 @@ }

}
else if ($.inArray(event.keyCode, [27, 38, 40]) != -1) {
event.stopPropagation();
}
});
if (event.keyCode == 27) {
if (this.$menu.hasClass('open')) {
this.close();
}
else {
this.$menus.trigger('hide.bs.submenu');
this.$drop.removeClass('open').children('a').trigger('focus');
}
}
else {
var $items = this.$main.find('li:not(.disabled):visible > a');
function Submenupicker(element) {
this.$element = $(element);
this.$main = this.$element.parent();
this.$menu = this.$main.children('.dropdown-menu');
this.$items = this.$menu.children('.dropdown-submenu');
var index = $items.index(event.target);
this.init();
}
if (event.keyCode == 38 && index !== 0) {
index--;
}
else if (event.keyCode == 40 && index !== $items.length - 1) {
index++;
}
else {
return;
}
Submenupicker.prototype = {
init: function() {
this.$menu.off('keydown.bs.dropdown.data-api');
this.$menu.on('keydown', $.proxy(this, 'item_keydown'));
$items.eq(index).trigger('focus');
}
}
},
item_keydown: function(event) {
// 27: Esc
this.$menu.find('li > a').each(function() {
new Item(this);
});
if (event.keyCode != 27) {
return;
}
this.$menu.find('.dropdown-submenu > a').each(function() {
new SubmenuItem(this);
});
event.stopPropagation();
this.close();
this.$element.trigger('focus');
this.$main.on('hidden.bs.dropdown', $.proxy(this, 'hidden'));
},
next_keydown: function(event) {
// 38: Arrow up
hidden: function() {
this.$items.trigger('hide.bs.submenu');
},
item_keydown: function(event) {
// 38: Arrow up, 40: Arrow down
if (event.keyCode != 38) {
return;
}
if ($.inArray(event.keyCode, [38, 40]) != -1) {
// Off vertical scrolling
event.preventDefault();
// Off vertical scrolling
event.preventDefault();
event.stopPropagation();
event.stopPropagation();
var $items = this.$menu.find('li:not(.disabled):visible > a');
var index = $items.index(event.target);
// Use this.$drop instead this.$main (optimally)
var $items = this.$drop.find('li:not(.disabled):visible > a');
if (event.keyCode == 38 && index !== 0) {
index--;
}
else if (event.keyCode == 40 && index !== $items.length - 1) {
index++;
}
else {
return;
}
var index = $items.index(event.target);
$items.eq(index - 1).trigger('focus');
$items.eq(index).trigger('focus');
}
}

@@ -162,0 +169,0 @@ };

/*!
* Bootstrap-submenu v1.2.13 (http://vsn4ik.github.io/bootstrap-submenu)
* Bootstrap-submenu v2.0.0 (http://vsn4ik.github.io/bootstrap-submenu)
* Copyright 2015 Vasily A. (https://github.com/vsn4ik)
* Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE)
* Licensed under the MIT license
*/
"use strict";!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){function b(b){this.$element=a(b),this.$main=this.$element.closest(".dropdown, .dropup, .btn-group"),this.$menu=this.$element.parent(),this.$drop=this.$menu.parent().parent(),this.$menus=this.$menu.siblings(".dropdown-submenu");var d=this.$menu.find("> .dropdown-menu > "+c);this.$submenus=d.filter(".dropdown-submenu"),this.$items=d.not(".dropdown-submenu"),this.init()}var c=":not(.disabled, .divider, .dropdown-header)";return b.prototype={init:function(){this.$element.on({"click.bs.dropdown":a.proxy(this.click,this),keydown:a.proxy(this.keydown,this)}),this.$menu.on("hide.bs.submenu",a.proxy(this.hide,this)),this.$items.on("keydown",a.proxy(this.item_keydown,this)),this.$menu.nextAll(c+":first:not(.dropdown-submenu)").children("a").on("keydown",a.proxy(this.next_keydown,this))},click:function(a){a.stopPropagation(),this.toggle()},toggle:function(){this.$menu.hasClass("open")?this.close():(this.$menu.addClass("open"),this.$menus.trigger("hide.bs.submenu"))},hide:function(a){a.stopPropagation(),this.close()},close:function(){this.$menu.removeClass("open"),this.$submenus.trigger("hide.bs.submenu")},keydown:function(b){if(-1!=a.inArray(b.keyCode,[32,38,40])&&b.preventDefault(),-1!=a.inArray(b.keyCode,[13,32]))this.toggle();else if(-1!=a.inArray(b.keyCode,[27,38,40]))if(b.stopPropagation(),27==b.keyCode)this.$menu.hasClass("open")?this.close():(this.$menus.trigger("hide.bs.submenu"),this.$drop.removeClass("open").children("a").trigger("focus"));else{var c=this.$main.find("li:not(.disabled):visible > a"),d=c.index(b.target);if(38==b.keyCode&&0!==d)d--;else{if(40!=b.keyCode||d===c.length-1)return;d++}c.eq(d).trigger("focus")}},item_keydown:function(a){27==a.keyCode&&(a.stopPropagation(),this.close(),this.$element.trigger("focus"))},next_keydown:function(a){if(38==a.keyCode){a.preventDefault(),a.stopPropagation();var b=this.$drop.find("li:not(.disabled):visible > a"),c=b.index(a.target);b.eq(c-1).trigger("focus")}}},a.fn.submenupicker=function(c){var d=this instanceof a?this:a(c);return d.each(function(){var c=a.data(this,"bs.submenu");c||(c=new b(this),a.data(this,"bs.submenu",c))})}});
"use strict";!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){function b(b){this.$element=a(b),this.$menu=this.$element.closest(".dropdown-menu"),this.$main=this.$menu.parent(),this.$items=this.$menu.children(".dropdown-submenu"),this.init()}function c(b){this.$element=a(b),this.$main=this.$element.parent(),this.$menu=this.$main.children(".dropdown-menu"),this.$subs=this.$main.siblings(".dropdown-submenu"),this.$items=this.$menu.children(".dropdown-submenu"),this.init()}function d(b){this.$element=a(b),this.$main=this.$element.parent(),this.$menu=this.$main.children(".dropdown-menu"),this.$items=this.$menu.children(".dropdown-submenu"),this.init()}return b.prototype={init:function(){this.$element.on("keydown",a.proxy(this,"keydown"))},close:function(){this.$main.removeClass("open"),this.$items.trigger("hide.bs.submenu")},keydown:function(a){27==a.keyCode&&(a.stopPropagation(),this.close(),this.$main.children("a, button").trigger("focus"))}},a.extend(c.prototype,b.prototype,{init:function(){this.$element.on({click:a.proxy(this,"click"),keydown:a.proxy(this,"keydown")}),this.$main.on("hide.bs.submenu",a.proxy(this.hide,this))},click:function(a){a.stopPropagation(),this.toggle()},hide:function(a){a.stopPropagation(),this.close()},open:function(){this.$main.addClass("open"),this.$subs.trigger("hide.bs.submenu")},toggle:function(){this.$main.hasClass("open")?this.close():this.open()},keydown:function(b){32==b.keyCode&&b.preventDefault(),-1!=a.inArray(b.keyCode,[13,32])&&this.toggle()}}),d.prototype={init:function(){this.$menu.off("keydown.bs.dropdown.data-api"),this.$menu.on("keydown",a.proxy(this,"item_keydown")),this.$menu.find("li > a").each(function(){new b(this)}),this.$menu.find(".dropdown-submenu > a").each(function(){new c(this)}),this.$main.on("hidden.bs.dropdown",a.proxy(this,"hidden"))},hidden:function(){this.$items.trigger("hide.bs.submenu")},item_keydown:function(b){if(-1!=a.inArray(b.keyCode,[38,40])){b.preventDefault(),b.stopPropagation();var c=this.$menu.find("li:not(.disabled):visible > a"),d=c.index(b.target);if(38==b.keyCode&&0!==d)d--;else{if(40!=b.keyCode||d===c.length-1)return;d++}c.eq(d).trigger("focus")}}},a.fn.submenupicker=function(b){var c=this instanceof a?this:a(b);return c.each(function(){var b=a.data(this,"bs.submenu");b||(b=new d(this),a.data(this,"bs.submenu",b))})}});
/**
* 'Strict Mode' strictly in body of function
* $.inArray: friends with IE8. Use Array.prototype.indexOf in future.

@@ -23,32 +22,49 @@ * $.proxy: friends with IE8. Use Function.prototype.bind in future.

})(function($) {
// Or ':not(.disabled):has(a)' or ':not(.disabled):parent';
var desc = ':not(.disabled, .divider, .dropdown-header)';
function Submenupicker(element) {
function Item(element) {
this.$element = $(element);
this.$main = this.$element.closest('.dropdown, .dropup, .btn-group');
this.$menu = this.$element.parent();
this.$drop = this.$menu.parent().parent();
this.$menus = this.$menu.siblings('.dropdown-submenu');
this.$menu = this.$element.closest('.dropdown-menu');
this.$main = this.$menu.parent();
this.$items = this.$menu.children('.dropdown-submenu');
var $children = this.$menu.find('> .dropdown-menu > ' + desc);
this.init();
}
this.$submenus = $children.filter('.dropdown-submenu');
this.$items = $children.not('.dropdown-submenu');
Item.prototype = {
init: function() {
this.$element.on('keydown', $.proxy(this, 'keydown'));
},
close: function() {
this.$main.removeClass('open');
this.$items.trigger('hide.bs.submenu');
},
keydown: function(event) {
// 27: Esc
if (event.keyCode == 27) {
event.stopPropagation();
this.close();
this.$main.children('a, button').trigger('focus');
}
}
};
function SubmenuItem(element) {
this.$element = $(element);
this.$main = this.$element.parent();
this.$menu = this.$main.children('.dropdown-menu');
this.$subs = this.$main.siblings('.dropdown-submenu');
this.$items = this.$menu.children('.dropdown-submenu');
this.init();
}
Submenupicker.prototype = {
$.extend(SubmenuItem.prototype, Item.prototype, {
init: function() {
this.$element.on({
'click.bs.dropdown': $.proxy(this.click, this),
keydown: $.proxy(this.keydown, this)
click: $.proxy(this, 'click'),
keydown: $.proxy(this, 'keydown')
});
this.$menu.on('hide.bs.submenu', $.proxy(this.hide, this));
this.$items.on('keydown', $.proxy(this.item_keydown, this));
// Bootstrap fix
this.$menu.nextAll(desc + ':first:not(.dropdown-submenu)').children('a').on('keydown', $.proxy(this.next_keydown, this));
this.$main.on('hide.bs.submenu', $.proxy(this.hide, this));
},

@@ -60,11 +76,2 @@ click: function(event) {

},
toggle: function() {
if (this.$menu.hasClass('open')) {
this.close();
}
else {
this.$menu.addClass('open');
this.$menus.trigger('hide.bs.submenu');
}
},
hide: function(event) {

@@ -76,12 +83,19 @@ // Stop event bubbling

},
close: function() {
this.$menu.removeClass('open');
this.$submenus.trigger('hide.bs.submenu');
open: function() {
this.$main.addClass('open');
this.$subs.trigger('hide.bs.submenu');
},
toggle: function() {
if (this.$main.hasClass('open')) {
this.close();
}
else {
this.open();
}
},
keydown: function(event) {
// 13: Return, 27: Esc, 32: Spacebar
// 38: Arrow up, 40: Arrow down
// 13: Return, 32: Spacebar
// Off vertical scrolling
if ($.inArray(event.keyCode, [32, 38, 40]) != -1) {
if (event.keyCode == 32) {
// Off vertical scrolling
event.preventDefault();

@@ -93,63 +107,56 @@ }

}
else if ($.inArray(event.keyCode, [27, 38, 40]) != -1) {
event.stopPropagation();
}
});
if (event.keyCode == 27) {
if (this.$menu.hasClass('open')) {
this.close();
}
else {
this.$menus.trigger('hide.bs.submenu');
this.$drop.removeClass('open').children('a').trigger('focus');
}
}
else {
var $items = this.$main.find('li:not(.disabled):visible > a');
function Submenupicker(element) {
this.$element = $(element);
this.$main = this.$element.parent();
this.$menu = this.$main.children('.dropdown-menu');
this.$items = this.$menu.children('.dropdown-submenu');
var index = $items.index(event.target);
this.init();
}
if (event.keyCode == 38 && index !== 0) {
index--;
}
else if (event.keyCode == 40 && index !== $items.length - 1) {
index++;
}
else {
return;
}
Submenupicker.prototype = {
init: function() {
this.$menu.off('keydown.bs.dropdown.data-api');
this.$menu.on('keydown', $.proxy(this, 'item_keydown'));
$items.eq(index).trigger('focus');
}
}
},
item_keydown: function(event) {
// 27: Esc
this.$menu.find('li > a').each(function() {
new Item(this);
});
if (event.keyCode != 27) {
return;
}
this.$menu.find('.dropdown-submenu > a').each(function() {
new SubmenuItem(this);
});
event.stopPropagation();
this.close();
this.$element.trigger('focus');
this.$main.on('hidden.bs.dropdown', $.proxy(this, 'hidden'));
},
next_keydown: function(event) {
// 38: Arrow up
hidden: function() {
this.$items.trigger('hide.bs.submenu');
},
item_keydown: function(event) {
// 38: Arrow up, 40: Arrow down
if (event.keyCode != 38) {
return;
}
if ($.inArray(event.keyCode, [38, 40]) != -1) {
// Off vertical scrolling
event.preventDefault();
// Off vertical scrolling
event.preventDefault();
event.stopPropagation();
event.stopPropagation();
var $items = this.$menu.find('li:not(.disabled):visible > a');
var index = $items.index(event.target);
// Use this.$drop instead this.$main (optimally)
var $items = this.$drop.find('li:not(.disabled):visible > a');
if (event.keyCode == 38 && index !== 0) {
index--;
}
else if (event.keyCode == 40 && index !== $items.length - 1) {
index++;
}
else {
return;
}
var index = $items.index(event.target);
$items.eq(index - 1).trigger('focus');
$items.eq(index).trigger('focus');
}
}

@@ -156,0 +163,0 @@ };

{
"name": "bootstrap-submenu",
"version": "1.2.13",
"version": "2.0.0",
"description": "Bootstrap Sub-Menus",

@@ -29,16 +29,16 @@ "keywords": [

"devDependencies": {
"bootstrap": "~3.3.4",
"bootstrap": "~3.3.5",
"grunt": "~0.4.5",
"grunt-banner": "~0.4.0",
"grunt-banner": "~0.5.0",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-compress": "~0.13.0",
"grunt-contrib-copy": "~0.8.0",
"grunt-contrib-cssmin": "~0.12.3",
"grunt-contrib-jshint": "~0.11.2",
"grunt-contrib-copy": "~0.8.1",
"grunt-contrib-cssmin": "~0.13.0",
"grunt-contrib-jshint": "~0.11.3",
"grunt-contrib-less": "~1.0.1",
"grunt-contrib-uglify": "~0.9.1",
"grunt-contrib-uglify": "~0.9.2",
"grunt-ejs": "~0.3.0",
"highlight.js": "~8.5.0",
"highlight.js": "~8.8.0",
"jquery": "~2.1.4",
"load-grunt-tasks": "~3.1.0",
"load-grunt-tasks": "~3.2.0",
"octicons": "github/octicons"

@@ -53,2 +53,3 @@ },

"docs",
".gitattributes",
".gitignore",

@@ -55,0 +56,0 @@ ".travis.yml",

@@ -14,8 +14,8 @@ # [Bootstrap-submenu](http://vsn4ik.github.io/bootstrap-submenu)

- [Download the latest release](https://github.com/vsn4ik/bootstrap-submenu/releases/download/v1.2.13/bootstrap-submenu-1.2.13-dist.zip "Download Bootstrap-submenu").
- Clone the repo: `git clone https://github.com/vsn4ik/bootstrap-submenu.git`.
- Install with [Bower](http://bower.io): `bower install bootstrap-submenu`.
- Install with [npm](https://www.npmjs.com): `npm install bootstrap-submenu`.
- Install with [SPM](http://spmjs.io): `spm install bootstrap-submenu`.
- Install with [Composer](https://getcomposer.org): `composer require vsn4ik/bootstrap-submenu "dev-master"`.
* [Download the latest release](https://github.com/vsn4ik/bootstrap-submenu/releases/download/v2.0.0/bootstrap-submenu-2.0.0-dist.zip "Download Bootstrap-submenu").
* Clone the repo: `git clone https://github.com/vsn4ik/bootstrap-submenu.git`.
* Install with [Bower](http://bower.io): `bower install bootstrap-submenu`.
* Install with [npm](https://www.npmjs.com): `npm install bootstrap-submenu`.
* Install with [SPM](http://spmjs.io): `spm install bootstrap-submenu`.
* Install with [Composer](https://getcomposer.org): `composer require vsn4ik/bootstrap-submenu "dev-master"`.

@@ -29,3 +29,4 @@ ### What's included

│ ├── bootstrap-submenu.css.map
│ └── bootstrap-submenu.min.css
│ ├── bootstrap-submenu.min.css
│ └── bootstrap-submenu.min.css.map
└── js/

@@ -44,4 +45,4 @@ ├── bootstrap-submenu.js

- Bootstrap 3.0.0
- jQuery 1.9.1
* Bootstrap 3.0.0
* jQuery 1.9.1

@@ -53,3 +54,3 @@

- <https://github.com/vsn4ik>
* <https://github.com/vsn4ik>

@@ -56,0 +57,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc