bootstrap-submenu
Advanced tools
Comparing version 1.2.12 to 1.2.13
/*! | ||
* Bootstrap-submenu v1.2.12 (http://vsn4ik.github.io/bootstrap-submenu) | ||
* Bootstrap-submenu v1.2.13 (http://vsn4ik.github.io/bootstrap-submenu) | ||
* Copyright 2015 Vasily A. (https://github.com/vsn4ik) | ||
@@ -7,2 +7,8 @@ * Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE) | ||
/** | ||
* 'Strict Mode' strictly in body of function | ||
* $.inArray: friends with IE8. Use Array.prototype.indexOf in future. | ||
* $.proxy: friends with IE8. Use Function.prototype.bind in future. | ||
*/ | ||
'use strict'; | ||
@@ -24,3 +30,3 @@ | ||
})(function($) { | ||
// Or ':not(.disabled):has(a)'; | ||
// Or ':not(.disabled):has(a)' or ':not(.disabled):parent'; | ||
var desc = ':not(.disabled, .divider, .dropdown-header)'; | ||
@@ -46,11 +52,11 @@ | ||
this.$element.on({ | ||
'click.bs.dropdown': this.click.bind(this), | ||
keydown: this.keydown.bind(this) | ||
'click.bs.dropdown': $.proxy(this.click, this), | ||
keydown: $.proxy(this.keydown, this) | ||
}); | ||
this.$menu.on('hide.bs.submenu', this.hide.bind(this)); | ||
this.$items.on('keydown', this.item_keydown.bind(this)); | ||
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', this.next_keydown.bind(this)); | ||
this.$menu.nextAll(desc + ':first:not(.dropdown-submenu)').children('a').on('keydown', $.proxy(this.next_keydown, this)); | ||
}, | ||
@@ -86,10 +92,10 @@ click: function(event) { | ||
// Off vertical scrolling | ||
if (/^(32|38|40)$/.test(event.keyCode)) { | ||
if ($.inArray(event.keyCode, [32, 38, 40]) != -1) { | ||
event.preventDefault(); | ||
} | ||
if (/^(13|32)$/.test(event.keyCode)) { | ||
if ($.inArray(event.keyCode, [13, 32]) != -1) { | ||
this.toggle(); | ||
} | ||
else if (/^(27|38|40)$/.test(event.keyCode)) { | ||
else if ($.inArray(event.keyCode, [27, 38, 40]) != -1) { | ||
event.stopPropagation(); | ||
@@ -96,0 +102,0 @@ |
/*! | ||
* Bootstrap-submenu v1.2.12 (http://vsn4ik.github.io/bootstrap-submenu) | ||
* Bootstrap-submenu v1.2.13 (http://vsn4ik.github.io/bootstrap-submenu) | ||
* Copyright 2015 Vasily A. (https://github.com/vsn4ik) | ||
@@ -7,2 +7,2 @@ * Licensed under MIT (https://github.com/vsn4ik/bootstrap-submenu/blob/master/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":this.click.bind(this),keydown:this.keydown.bind(this)}),this.$menu.on("hide.bs.submenu",this.hide.bind(this)),this.$items.on("keydown",this.item_keydown.bind(this)),this.$menu.nextAll(c+":first:not(.dropdown-submenu)").children("a").on("keydown",this.next_keydown.bind(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(a){if(/^(32|38|40)$/.test(a.keyCode)&&a.preventDefault(),/^(13|32)$/.test(a.keyCode))this.toggle();else if(/^(27|38|40)$/.test(a.keyCode))if(a.stopPropagation(),27==a.keyCode)this.$menu.hasClass("open")?this.close():(this.$menus.trigger("hide.bs.submenu"),this.$drop.removeClass("open").children("a").trigger("focus"));else{var b=this.$main.find("li:not(.disabled):visible > a"),c=b.index(a.target);if(38==a.keyCode&&0!==c)c--;else{if(40!=a.keyCode||c===b.length-1)return;c++}b.eq(c).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.$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))})}}); |
@@ -0,1 +1,7 @@ | ||
/** | ||
* 'Strict Mode' strictly in body of function | ||
* $.inArray: friends with IE8. Use Array.prototype.indexOf in future. | ||
* $.proxy: friends with IE8. Use Function.prototype.bind in future. | ||
*/ | ||
'use strict'; | ||
@@ -17,3 +23,3 @@ | ||
})(function($) { | ||
// Or ':not(.disabled):has(a)'; | ||
// Or ':not(.disabled):has(a)' or ':not(.disabled):parent'; | ||
var desc = ':not(.disabled, .divider, .dropdown-header)'; | ||
@@ -39,11 +45,11 @@ | ||
this.$element.on({ | ||
'click.bs.dropdown': this.click.bind(this), | ||
keydown: this.keydown.bind(this) | ||
'click.bs.dropdown': $.proxy(this.click, this), | ||
keydown: $.proxy(this.keydown, this) | ||
}); | ||
this.$menu.on('hide.bs.submenu', this.hide.bind(this)); | ||
this.$items.on('keydown', this.item_keydown.bind(this)); | ||
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', this.next_keydown.bind(this)); | ||
this.$menu.nextAll(desc + ':first:not(.dropdown-submenu)').children('a').on('keydown', $.proxy(this.next_keydown, this)); | ||
}, | ||
@@ -79,10 +85,10 @@ click: function(event) { | ||
// Off vertical scrolling | ||
if (/^(32|38|40)$/.test(event.keyCode)) { | ||
if ($.inArray(event.keyCode, [32, 38, 40]) != -1) { | ||
event.preventDefault(); | ||
} | ||
if (/^(13|32)$/.test(event.keyCode)) { | ||
if ($.inArray(event.keyCode, [13, 32]) != -1) { | ||
this.toggle(); | ||
} | ||
else if (/^(27|38|40)$/.test(event.keyCode)) { | ||
else if ($.inArray(event.keyCode, [27, 38, 40]) != -1) { | ||
event.stopPropagation(); | ||
@@ -89,0 +95,0 @@ |
{ | ||
"name": "bootstrap-submenu", | ||
"version": "1.2.12", | ||
"version": "1.2.13", | ||
"description": "Bootstrap Sub-Menus", | ||
@@ -17,6 +17,3 @@ "keywords": [ | ||
"repository": "vsn4ik/bootstrap-submenu", | ||
"license": { | ||
"type": "MIT", | ||
"url": "https://github.com/vsn4ik/bootstrap-submenu/blob/master/LICENSE" | ||
}, | ||
"license": "MIT", | ||
"files": [ | ||
@@ -42,5 +39,5 @@ "dist", | ||
"grunt-contrib-less": "~1.0.1", | ||
"grunt-contrib-symlink": "~0.3.0", | ||
"grunt-contrib-uglify": "~0.9.1", | ||
"grunt-jekyll": "~0.4.2", | ||
"grunt-ejs": "~0.3.0", | ||
"highlight.js": "~8.5.0", | ||
"jquery": "~2.1.4", | ||
@@ -47,0 +44,0 @@ "load-grunt-tasks": "~3.1.0", |
@@ -5,3 +5,3 @@ # [Bootstrap-submenu](http://vsn4ik.github.io/bootstrap-submenu) | ||
[![npm version](https://img.shields.io/npm/v/bootstrap-submenu.svg)](https://www.npmjs.com/package/bootstrap-submenu) | ||
[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)][license] | ||
[![License](https://img.shields.io/npm/l/bootstrap-submenu.svg)][license] | ||
[![Build Status](https://travis-ci.org/vsn4ik/bootstrap-submenu.svg)](https://travis-ci.org/vsn4ik/bootstrap-submenu) | ||
@@ -15,3 +15,3 @@ [![devDependency Status](https://david-dm.org/vsn4ik/bootstrap-submenu/dev-status.svg)](https://david-dm.org/vsn4ik/bootstrap-submenu#info=devDependencies) | ||
- [Download the latest release](https://github.com/vsn4ik/bootstrap-submenu/releases/download/v1.2.12/bootstrap-submenu-1.2.12-dist.zip "Download 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`. | ||
@@ -18,0 +18,0 @@ - Install with [Bower](http://bower.io): `bower install bootstrap-submenu`. |
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
34694
412