1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-12 16:44:17 +02:00
This commit is contained in:
Mark Otto
2017-01-21 17:50:45 -08:00
parent 4fa7749442
commit deb1c59c53
24 changed files with 583 additions and 1059 deletions

8
js/dist/carousel.js vendored
View File

@@ -129,7 +129,7 @@ var Carousel = function ($) {
if (this._isSliding) {
throw new Error('Carousel is sliding');
}
this._slide(Direction.PREVIOUS);
this._slide(Direction.PREV);
};
Carousel.prototype.pause = function pause(event) {
@@ -185,7 +185,7 @@ var Carousel = function ($) {
return;
}
var direction = index > activeIndex ? Direction.NEXT : Direction.PREVIOUS;
var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
this._slide(direction, this._items[index]);
};
@@ -256,7 +256,7 @@ var Carousel = function ($) {
Carousel.prototype._getItemByDirection = function _getItemByDirection(direction, activeElement) {
var isNextDirection = direction === Direction.NEXT;
var isPrevDirection = direction === Direction.PREVIOUS;
var isPrevDirection = direction === Direction.PREV;
var activeIndex = this._getItemIndex(activeElement);
var lastItemIndex = this._items.length - 1;
var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
@@ -265,7 +265,7 @@ var Carousel = function ($) {
return activeElement;
}
var delta = direction === Direction.PREVIOUS ? -1 : 1;
var delta = direction === Direction.PREV ? -1 : 1;
var itemIndex = (activeIndex + delta) % this._items.length;
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];

File diff suppressed because one or more lines are too long

4
js/dist/dropdown.js vendored
View File

@@ -24,9 +24,11 @@ var Dropdown = function ($) {
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + '|' + ARROW_DOWN_KEYCODE + '|' + ESCAPE_KEYCODE + '|' + SPACE_KEYCODE);
var Event = {
HIDE: 'hide' + EVENT_KEY,
@@ -199,7 +201,7 @@ var Dropdown = function ($) {
};
Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
if (!/(38|40|27|32)/.test(event.which) || /input|textarea/i.test(event.target.tagName)) {
if (!REGEXP_KEYDOWN.test(event.which) || /input|textarea/i.test(event.target.tagName)) {
return;
}

File diff suppressed because one or more lines are too long