1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update components

This commit is contained in:
Luke Pulverenti 2016-04-18 16:43:57 -04:00
parent 600fceeb54
commit 9956595625
25 changed files with 213 additions and 284 deletions

View file

@ -128,7 +128,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
var attr = this.attrForItemTitle || 'textContent';
var title = item[attr] || item.getAttribute(attr);
if (title && title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.keyCode).toLowerCase()) {
if (!item.hasAttribute('disabled') && title &&
title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.keyCode).toLowerCase()) {
this._setFocusedItem(item);
break;
}
@ -137,21 +138,34 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* Focuses the previous item (relative to the currently focused item) in the
* menu.
* menu, disabled items will be skipped.
*/
_focusPrevious: function() {
var length = this.items.length;
var index = (Number(this.indexOf(this.focusedItem)) - 1 + length) % length;
this._setFocusedItem(this.items[index]);
var curFocusIndex = Number(this.indexOf(this.focusedItem));
for (var i = 1; i < length; i++) {
var item = this.items[(curFocusIndex - i + length) % length];
if (!item.hasAttribute('disabled')) {
this._setFocusedItem(item);
return;
}
}
},
/**
* Focuses the next item (relative to the currently focused item) in the
* menu.
* menu, disabled items will be skipped.
*/
_focusNext: function() {
var index = (Number(this.indexOf(this.focusedItem)) + 1) % this.items.length;
this._setFocusedItem(this.items[index]);
var length = this.items.length;
var curFocusIndex = Number(this.indexOf(this.focusedItem));
for (var i = 1; i < length; i++) {
var item = this.items[(curFocusIndex + i) % length];
if (!item.hasAttribute('disabled')) {
this._setFocusedItem(item);
return;
}
}
},
/**
@ -260,7 +274,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
if (selectedItem) {
this._setFocusedItem(selectedItem);
} else if (this.items[0]) {
this._setFocusedItem(this.items[0]);
// We find the first none-disabled item (if one exists)
this._focusNext();
}
});
},