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-10-06 00:28:10 -04:00
parent be99ee04d2
commit 86a369b500
20 changed files with 149 additions and 73 deletions

View file

@ -14,12 +14,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.4.286",
"_release": "1.4.286",
"version": "1.4.289",
"_release": "1.4.289",
"_resolution": {
"type": "version",
"tag": "1.4.286",
"commit": "680a1d64f25542c11e035d4118c788ef68199e18"
"tag": "1.4.289",
"commit": "ee09c94102cdcaacfdf815e779bdf8281657344e"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.1",

View file

@ -129,6 +129,8 @@
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
[];
var versionMatch = /(version)[ \/]([\w.]+)/.exec(ua);
var platform_match = /(ipad)/.exec(ua) ||
/(iphone)/.exec(ua) ||
/(android)/.exec(ua) ||
@ -153,10 +155,24 @@
browser = 'opera';
}
var version;
if (versionMatch && versionMatch.length > 2) {
version = versionMatch[2];
}
version = version || match[2] || "0";
var versionMajor = parseInt(version.split('.')[0]);
if (isNaN(versionMajor)) {
versionMajor = 0;
}
return {
browser: browser,
version: match[2] || "0",
platform: platform_match[0] || ""
version: version,
platform: platform_match[0] || "",
versionMajor: versionMajor
};
};
@ -167,6 +183,7 @@
if (matched.browser) {
browser[matched.browser] = true;
browser.version = matched.version;
browser.versionMajor = matched.versionMajor;
}
if (matched.platform) {

View file

@ -1,6 +1,10 @@
button::-moz-focus-inner {
padding: 0;
border: 0
border: 0;
}
button {
-webkit-border-fit: border !important;
}
.card {
@ -188,6 +192,8 @@ button::-moz-focus-inner {
bottom: 0;
/* Needed in case this is a button */
display: block;
/* Needed in safari */
height: 100%;
}
.cardImage {
@ -204,6 +210,9 @@ button::-moz-focus-inner {
.cardImage-img {
max-height: 100%;
max-width: 100%;
/* This is simply for lazy image purposes, to ensure the image is visible sooner when scrolling */
min-height: 70%;
min-width: 70%;
align-self: flex-end;
position: static;
}

View file

@ -270,6 +270,10 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'mediaInfo
isVertical = true;
}
if (options.vibrant && !appHost.supports('imageanalysis')) {
options.vibrant = false;
}
setCardData(items, options);
if (options.indexBy === 'Genres') {

View file

@ -152,7 +152,7 @@
.paper-icon-button-light > i {
width: auto;
height: auto;
font-size: 1.5em;
font-size: 1.6em;
/* Make sure its on top of the ripple */
position: relative;
z-index: 1;

View file

@ -31,9 +31,8 @@
}, false);
}
function animateButton(e) {
function animateButton(e, btn) {
var btn = this;
requestAnimationFrame(function () {
animateButtonInternal(e, btn);
});
@ -42,17 +41,22 @@
function onKeyDown(e) {
if (e.keyCode === 13) {
animateButton.call(this, e);
animateButton(e, this);
}
}
function onMouseDown(e) {
if (e.button === 0) {
animateButton.call(this, e);
animateButton(e, this);
}
}
function onClick(e) {
animateButton(e, this);
}
function enableAnimation() {
if (browser.tv) {
// too slow
@ -78,7 +82,7 @@
passive: true
});
if (browser.safari) {
dom.addEventListener(this, 'click', animateButton, {
dom.addEventListener(this, 'click', onClick, {
passive: true
});
} else {

View file

@ -34,9 +34,8 @@
}, false);
}
function animateButton(e) {
function animateButton(e, btn) {
var btn = this;
requestAnimationFrame(function () {
animateButtonInternal(e, btn);
});
@ -45,10 +44,15 @@
function onKeyDown(e) {
if (e.keyCode === 13) {
animateButton.call(this, e);
animateButton(e, this);
}
}
function onClick(e) {
animateButton(e, this);
}
EmbyButtonPrototype.createdCallback = function () {
if (this.classList.contains('paper-icon-button-light')) {
@ -61,7 +65,7 @@
dom.addEventListener(this, 'keydown', onKeyDown, {
passive: true
});
dom.addEventListener(this, 'click', animateButton, {
dom.addEventListener(this, 'click', onClick, {
passive: true
});
}

View file

@ -1,4 +1,5 @@
define(['browser', 'css!./emby-collapse', 'registerElement'], function (browser) {
'use strict';
var EmbyButtonPrototype = Object.create(HTMLDivElement.prototype);
@ -9,7 +10,9 @@
elem.style.height = 'auto';
var height = elem.offsetHeight + 'px';
elem.style.height = '0';
elem.offsetHeight;
// trigger reflow
var newHeight = elem.offsetHeight;
elem.style.height = height;
setTimeout(function () {
@ -29,7 +32,8 @@
function slideUpToHide(button, elem) {
elem.style.height = elem.offsetHeight + 'px';
elem.offsetHeight;
// trigger reflow
var newHeight = elem.offsetHeight;
elem.classList.remove('expanded');
elem.style.height = '0';
@ -49,14 +53,15 @@
function onButtonClick(e) {
var collapseContent = this.parentNode.querySelector('.collapseContent');
var button = this;
var collapseContent = button.parentNode.querySelector('.collapseContent');
if (collapseContent.expanded) {
collapseContent.expanded = false;
slideUpToHide(this, collapseContent);
slideUpToHide(button, collapseContent);
} else {
collapseContent.expanded = true;
slideDownToShow(this, collapseContent);
slideDownToShow(button, collapseContent);
}
}
@ -75,10 +80,7 @@
var title = this.getAttribute('title');
var html = '<button is="emby-button" type="button" on-click="toggleExpand" id="expandButton" class="emby-collapsible-button iconRight">\
<h3 class="emby-collapsible-title" title="' + title + '">' + title + '</h3>\
<i class="md-icon emby-collapse-expandIcon">expand_more</i>\
</button>';
var html = '<button is="emby-button" type="button" on-click="toggleExpand" id="expandButton" class="emby-collapsible-button iconRight"><h3 class="emby-collapsible-title" title="' + title + '">' + title + '</h3><i class="md-icon emby-collapse-expandIcon">expand_more</i></button>';
this.insertAdjacentHTML('afterbegin', html);
@ -86,7 +88,7 @@
button.addEventListener('click', onButtonClick);
if (this.getAttribute('data-expanded') == 'true') {
if (this.getAttribute('data-expanded') === 'true') {
onButtonClick.call(button);
}
};

View file

@ -1,4 +1,5 @@
define(['layoutManager', 'browser', 'dom', 'css!./emby-input', 'registerElement'], function (layoutManager, browser, dom) {
'use strict';
var EmbyInputPrototype = Object.create(HTMLInputElement.prototype);
@ -19,7 +20,7 @@
bubbles: false,
cancelable: false
}));
}
};
Object.defineProperty(HTMLInputElement.prototype, 'value', descriptor);
supportsFloatingLabel = true;
@ -86,7 +87,7 @@
label.classList.remove('inputLabel-float');
} else {
var instanceSupportsFloat = supportsFloatingLabel && this.type != 'date' && this.type != 'time';
var instanceSupportsFloat = supportsFloatingLabel && this.type !== 'date' && this.type !== 'time';
if (instanceSupportsFloat) {
label.classList.add('inputLabel-float');

View file

@ -1,11 +1,12 @@
define(['css!./emby-radio', 'registerElement'], function () {
'use strict';
var EmbyRadioPrototype = Object.create(HTMLInputElement.prototype);
function onKeyDown(e) {
// Don't submit form on enter
if (e.keyCode == 13) {
if (e.keyCode === 13) {
e.preventDefault();
this.checked = true;
@ -16,7 +17,7 @@
EmbyRadioPrototype.attachedCallback = function () {
if (this.getAttribute('data-radio') == 'true') {
if (this.getAttribute('data-radio') === 'true') {
return;
}

View file

@ -1,4 +1,5 @@
define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registerElement'], function (layoutManager, browser, actionsheet) {
'use strict';
var EmbySelectPrototype = Object.create(HTMLSelectElement.prototype);
@ -54,7 +55,7 @@
function getLabel(select) {
var elem = select.previousSibling;
while (elem && elem.tagName != 'LABEL') {
while (elem && elem.tagName !== 'LABEL') {
elem = elem.previousSibling;
}
return elem;

View file

@ -1,4 +1,5 @@
define(['browser', 'css!./emby-slider', 'registerElement', 'emby-input'], function (browser) {
'use strict';
var EmbySliderPrototype = Object.create(HTMLInputElement.prototype);
@ -41,7 +42,7 @@
EmbySliderPrototype.attachedCallback = function () {
if (this.getAttribute('data-embycheckbox') == 'true') {
if (this.getAttribute('data-embycheckbox') === 'true') {
return;
}

View file

@ -1,4 +1,5 @@
define(['dom', 'scroller', 'browser', 'registerElement', 'css!./emby-tabs', 'scrollStyles'], function (dom, scroller, browser) {
'use strict';
var EmbyTabs = Object.create(HTMLDivElement.prototype);
var buttonClass = 'emby-tab-button';
@ -78,7 +79,7 @@
var onAnimationFinish = function () {
//if (tabs.getAttribute('data-selectionbar') != 'false') {
//if (tabs.getAttribute('data-selectionbar') !== 'false') {
// showButtonSelectionBar(newButton);
//}
newButton.classList.add(activeButtonClass);
@ -103,7 +104,7 @@
var current = tabs.querySelector('.' + activeButtonClass);
var tabButton = dom.parentWithClass(e.target, buttonClass);
if (tabButton && tabButton != current) {
if (tabButton && tabButton !== current) {
if (current) {
current.classList.remove(activeButtonClass);
@ -186,7 +187,7 @@
return;
}
if (tabs.getAttribute('data-selectionbar') == 'false') {
if (tabs.getAttribute('data-selectionbar') === 'false') {
return;
}
@ -253,7 +254,7 @@
var tabButtons = tabs.querySelectorAll('.' + buttonClass);
if (current == selected || triggerEvent === false) {
if (current === selected || triggerEvent === false) {
tabs.dispatchEvent(new CustomEvent("beforetabchange", {
detail: {
@ -269,7 +270,7 @@
var currentTabButton = tabButtons[current];
moveSelectionBar(tabs, tabButtons[selected], currentTabButton, false);
if (current != selected && currentTabButton) {
if (current !== selected && currentTabButton) {
currentTabButton.classList.remove(activeButtonClass);
}

View file

@ -1,4 +1,5 @@
define(['layoutManager', 'browser', 'css!./emby-textarea', 'registerElement'], function (layoutManager, browser) {
'use strict';
function autoGrow(textarea, maxLines) {
var self = this;
@ -84,7 +85,7 @@
bubbles: false,
cancelable: false
}));
}
};
Object.defineProperty(HTMLTextAreaElement.prototype, 'value', descriptor);
supportsFloatingLabel = true;
@ -113,7 +114,7 @@
label.innerHTML = this.getAttribute('label') || '';
label.classList.add('textareaLabel');
if (!supportsFloatingLabel || this.type == 'date') {
if (!supportsFloatingLabel || this.type === 'date') {
label.classList.add('nofloat');
}

View file

@ -1,11 +1,12 @@
define(['css!./emby-toggle', 'registerElement'], function () {
'use strict';
var EmbyTogglePrototype = Object.create(HTMLInputElement.prototype);
function onKeyDown(e) {
// Don't submit form on enter
if (e.keyCode == 13) {
if (e.keyCode === 13) {
e.preventDefault();
this.checked = !this.checked;
@ -20,7 +21,7 @@
EmbyTogglePrototype.attachedCallback = function () {
if (this.getAttribute('data-embytoggle') == 'true') {
if (this.getAttribute('data-embytoggle') === 'true') {
return;
}

View file

@ -1,10 +1,11 @@
define([], function () {
'use strict';
function getFetchPromise(request) {
var headers = request.headers || {};
if (request.dataType == 'json') {
if (request.dataType === 'json') {
headers.accept = 'application/json';
}
@ -107,9 +108,9 @@
if (response.status < 400) {
if (request.dataType == 'json' || request.headers.accept == 'application/json') {
if (request.dataType === 'json' || request.headers.accept === 'application/json') {
return response.json();
} else if (request.dataType == 'text' || (response.headers.get('Content-Type') || '').toLowerCase().indexOf('text/') == 0) {
} else if (request.dataType === 'text' || (response.headers.get('Content-Type') || '').toLowerCase().indexOf('text/') === 0) {
return response.text();
} else {
return response;

View file

@ -1,4 +1,5 @@
define(['dom'], function (dom) {
'use strict';
var scopes = [];
function pushScope(elem) {
@ -48,7 +49,7 @@ define(['dom'], function (dom) {
var focusableContainerTagNames = ['BODY', 'DIALOG'];
var focusableQuery = focusableTagNames.map(function (t) {
if (t == 'INPUT') {
if (t === 'INPUT') {
t += ':not([type="range"])';
}
return t + ':not([tabindex="-1"]):not(:disabled)';
@ -57,7 +58,7 @@ define(['dom'], function (dom) {
function isFocusable(elem) {
if (focusableTagNames.indexOf(elem.tagName) != -1) {
if (focusableTagNames.indexOf(elem.tagName) !== -1) {
return true;
}
@ -99,13 +100,13 @@ define(['dom'], function (dom) {
return false;
}
if (elem.getAttribute('tabindex') == "-1") {
if (elem.getAttribute('tabindex') === "-1") {
return false;
}
if (elem.tagName == 'INPUT') {
if (elem.tagName === 'INPUT') {
var type = elem.type;
if (type == 'range') {
if (type === 'range') {
return false;
}
}
@ -139,7 +140,7 @@ define(['dom'], function (dom) {
function isFocusContainer(elem, direction) {
if (focusableContainerTagNames.indexOf(elem.tagName) != -1) {
if (focusableContainerTagNames.indexOf(elem.tagName) !== -1) {
return true;
}
if (elem.classList.contains('focuscontainer')) {
@ -151,7 +152,7 @@ define(['dom'], function (dom) {
return true;
}
}
else if (direction == 3) {
else if (direction === 3) {
if (elem.classList.contains('focuscontainer-down')) {
return true;
}
@ -230,11 +231,11 @@ define(['dom'], function (dom) {
for (var i = 0, length = focusable.length; i < length; i++) {
var curr = focusable[i];
if (curr == activeElement) {
if (curr === activeElement) {
continue;
}
// Don't refocus into the same container
if (curr == focusableContainer) {
if (curr === focusableContainer) {
continue;
}
@ -256,7 +257,7 @@ define(['dom'], function (dom) {
if (elementRect.left >= rect.left) {
continue;
}
if (elementRect.right == rect.right) {
if (elementRect.right === rect.right) {
continue;
}
break;
@ -265,7 +266,7 @@ define(['dom'], function (dom) {
if (elementRect.right <= rect.right) {
continue;
}
if (elementRect.left == rect.left) {
if (elementRect.left === rect.left) {
continue;
}
break;
@ -304,8 +305,8 @@ define(['dom'], function (dom) {
// See if there's a focusable container, and if so, send the focus command to that
var nearestElementFocusableParent = dom.parentWithClass(nearestElement, 'focusable');
if (nearestElementFocusableParent && nearestElementFocusableParent != nearestElement && activeElement) {
if (dom.parentWithClass(activeElement, 'focusable') != nearestElementFocusableParent) {
if (nearestElementFocusableParent && nearestElementFocusableParent !== nearestElement && activeElement) {
if (dom.parentWithClass(activeElement, 'focusable') !== nearestElementFocusableParent) {
nearestElement = nearestElementFocusableParent;
}
}
@ -404,12 +405,12 @@ define(['dom'], function (dom) {
function sortNodesT(a, b) {
var result = a.distT - b.distT;
if (result != 0) {
if (result !== 0) {
return result;
}
result = a.index - b.index;
if (result != 0) {
if (result !== 0) {
return result;
}

View file

@ -1,4 +1,5 @@
define(['connectionManager', 'userSettings', 'events'], function (connectionManager, userSettings, events) {
'use strict';
var allTranslations = {};
var currentCulture;
@ -69,20 +70,20 @@ define(['connectionManager', 'userSettings', 'events'], function (connectionMana
// If it's de-DE, convert to just de
var parts = culture.split('-');
if (parts.length == 2) {
if (parts[0].toLowerCase() == parts[1].toLowerCase()) {
if (parts.length === 2) {
if (parts[0].toLowerCase() === parts[1].toLowerCase()) {
culture = parts[0].toLowerCase();
}
}
var lower = culture.toLowerCase();
if (lower == 'ca-es') {
if (lower === 'ca-es') {
return 'ca';
}
// normalize Swedish
if (lower == 'sv-se') {
if (lower === 'sv-se') {
return 'sv';
}
@ -130,12 +131,12 @@ define(['connectionManager', 'userSettings', 'events'], function (connectionMana
lang = normalizeLocaleName(lang);
var filtered = translations.filter(function (t) {
return normalizeLocaleName(t.lang) == lang;
return normalizeLocaleName(t.lang) === lang;
});
if (!filtered.length) {
filtered = translations.filter(function (t) {
return normalizeLocaleName(t.lang) == 'en-us';
return normalizeLocaleName(t.lang) === 'en-us';
});
}
@ -148,7 +149,7 @@ define(['connectionManager', 'userSettings', 'events'], function (connectionMana
var url = filtered[0].path;
url += url.indexOf('?') == -1 ? '?' : '&';
url += url.indexOf('?') === -1 ? '?' : '&';
url += 'v=' + cacheParam;
var xhr = new XMLHttpRequest();
@ -217,14 +218,14 @@ define(['connectionManager', 'userSettings', 'events'], function (connectionMana
var startIndex = html.indexOf('${');
if (startIndex == -1) {
if (startIndex === -1) {
return html;
}
startIndex += 2;
var endIndex = html.indexOf('}', startIndex);
if (endIndex == -1) {
if (endIndex === -1) {
return html;
}
@ -250,7 +251,7 @@ define(['connectionManager', 'userSettings', 'events'], function (connectionMana
events.on(connectionManager, 'localusersignedin', updateCurrentCulture);
events.on(userSettings, 'change', function (e, name) {
if (name == 'language') {
if (name === 'language') {
updateCurrentCulture();
}
});

View file

@ -1,4 +1,4 @@
define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser', 'dom', 'appSettings', 'vibrant'], function (visibleinviewport, imageFetcher, layoutManager, events, browser, dom, appSettings) {
define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser', 'dom', 'appSettings'], function (visibleinviewport, imageFetcher, layoutManager, events, browser, dom, appSettings) {
var thresholdX;
var thresholdY;
@ -74,6 +74,22 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser
return;
}
if (window.Vibrant) {
fillVibrantOnLoaded(img, url, vibrantElement);
return;
}
require(['vibrant'], function () {
fillVibrantOnLoaded(img, url, vibrantElement);
});
}
function fillVibrantOnLoaded(img, url, vibrantElement) {
if (img.tagName != 'IMG') {
return;
}
vibrantElement = document.getElementById(vibrantElement);
if (!vibrantElement) {
return;
@ -97,7 +113,16 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser
}
function getSettingsKey(url) {
return 'vibrant3-' + url.split('?')[0];
var parts = url.split('://');
url = parts[parts.length - 1];
url = url.substring(url.indexOf('/') + 1);
url = url.split('?')[0];
console.log(url);
return 'vibrant3-' + url;
}
function getCachedVibrantInfo(url) {

View file

@ -1,4 +1,5 @@
define(['browser', 'appSettings', 'events'], function (browser, appSettings, events) {
'use strict';
function setLayout(self, layout, selectedLayout) {
@ -17,7 +18,7 @@ define(['browser', 'appSettings', 'events'], function (browser, appSettings, eve
self.setLayout = function (layout, save) {
if (!layout || layout == 'auto') {
if (!layout || layout === 'auto') {
self.autoLayout();
if (save !== false) {