From 86a369b500b3095ab6de41e782fafc106fd36f26 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 6 Oct 2016 00:28:10 -0400 Subject: [PATCH] update components --- .../emby-webcomponents/.bower.json | 8 ++--- .../emby-webcomponents/browser.js | 21 +++++++++++-- .../emby-webcomponents/cardbuilder/card.css | 11 ++++++- .../cardbuilder/cardbuilder.js | 4 +++ .../emby-button/emby-button.css | 2 +- .../emby-button/emby-button.js | 14 ++++++--- .../emby-button/paper-icon-button-light.js | 12 ++++--- .../emby-collapse/emby-collapse.js | 22 +++++++------ .../emby-input/emby-input.js | 5 +-- .../emby-radio/emby-radio.js | 5 +-- .../emby-select/emby-select.js | 3 +- .../emby-slider/emby-slider.js | 3 +- .../emby-webcomponents/emby-tabs/emby-tabs.js | 11 ++++--- .../emby-textarea/emby-textarea.js | 5 +-- .../emby-toggle/emby-toggle.js | 5 +-- .../emby-webcomponents/fetchhelper.js | 7 +++-- .../emby-webcomponents/focusmanager.js | 31 ++++++++++--------- .../emby-webcomponents/globalize.js | 21 +++++++------ .../emby-webcomponents/images/imagehelper.js | 29 +++++++++++++++-- .../emby-webcomponents/layoutmanager.js | 3 +- 20 files changed, 149 insertions(+), 73 deletions(-) diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index 247483183..be93ec514 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -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", diff --git a/dashboard-ui/bower_components/emby-webcomponents/browser.js b/dashboard-ui/bower_components/emby-webcomponents/browser.js index 9397f448b..8f4fb0d54 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/browser.js +++ b/dashboard-ui/bower_components/emby-webcomponents/browser.js @@ -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) { diff --git a/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/card.css b/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/card.css index c33f0b20f..b055fcc95 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/card.css +++ b/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/card.css @@ -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; } diff --git a/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/cardbuilder.js b/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/cardbuilder.js index 2b871d819..6f66afe8a 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/cardbuilder.js +++ b/dashboard-ui/bower_components/emby-webcomponents/cardbuilder/cardbuilder.js @@ -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') { diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.css b/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.css index e47dcacfd..24ec5c769 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.css +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.css @@ -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; diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.js b/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.js index 561f3a321..0064d772b 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.js +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-button/emby-button.js @@ -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 { diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-button/paper-icon-button-light.js b/dashboard-ui/bower_components/emby-webcomponents/emby-button/paper-icon-button-light.js index 705d88e42..ba5f5a1c2 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-button/paper-icon-button-light.js +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-button/paper-icon-button-light.js @@ -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 }); } diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-collapse/emby-collapse.js b/dashboard-ui/bower_components/emby-webcomponents/emby-collapse/emby-collapse.js index 0e06a9b87..44e2de1f9 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-collapse/emby-collapse.js +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-collapse/emby-collapse.js @@ -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 = ''; + var html = ''; 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); } }; diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-input/emby-input.js b/dashboard-ui/bower_components/emby-webcomponents/emby-input/emby-input.js index 3990769a3..4b8318731 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-input/emby-input.js +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-input/emby-input.js @@ -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'); diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-radio/emby-radio.js b/dashboard-ui/bower_components/emby-webcomponents/emby-radio/emby-radio.js index f680abf6f..6e3b6b9bf 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-radio/emby-radio.js +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-radio/emby-radio.js @@ -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; } diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-select/emby-select.js b/dashboard-ui/bower_components/emby-webcomponents/emby-select/emby-select.js index e8693ebe6..9e7563290 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-select/emby-select.js +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-select/emby-select.js @@ -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; diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-slider/emby-slider.js b/dashboard-ui/bower_components/emby-webcomponents/emby-slider/emby-slider.js index b407a78bb..da6ed55d8 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-slider/emby-slider.js +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-slider/emby-slider.js @@ -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; } diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-tabs/emby-tabs.js b/dashboard-ui/bower_components/emby-webcomponents/emby-tabs/emby-tabs.js index 1de8deeda..6b6031b60 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-tabs/emby-tabs.js +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-tabs/emby-tabs.js @@ -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); } diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-textarea/emby-textarea.js b/dashboard-ui/bower_components/emby-webcomponents/emby-textarea/emby-textarea.js index 5448152ef..2b93e1b88 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-textarea/emby-textarea.js +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-textarea/emby-textarea.js @@ -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'); } diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-toggle/emby-toggle.js b/dashboard-ui/bower_components/emby-webcomponents/emby-toggle/emby-toggle.js index 17898539d..d6d31957b 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-toggle/emby-toggle.js +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-toggle/emby-toggle.js @@ -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; } diff --git a/dashboard-ui/bower_components/emby-webcomponents/fetchhelper.js b/dashboard-ui/bower_components/emby-webcomponents/fetchhelper.js index b777f3a91..64bd5159a 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/fetchhelper.js +++ b/dashboard-ui/bower_components/emby-webcomponents/fetchhelper.js @@ -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; diff --git a/dashboard-ui/bower_components/emby-webcomponents/focusmanager.js b/dashboard-ui/bower_components/emby-webcomponents/focusmanager.js index b2a22fa08..c7234809d 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/focusmanager.js +++ b/dashboard-ui/bower_components/emby-webcomponents/focusmanager.js @@ -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; } diff --git a/dashboard-ui/bower_components/emby-webcomponents/globalize.js b/dashboard-ui/bower_components/emby-webcomponents/globalize.js index d8790f582..74e5e4766 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/globalize.js +++ b/dashboard-ui/bower_components/emby-webcomponents/globalize.js @@ -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(); } }); diff --git a/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js b/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js index c303d0d85..14972c29f 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js +++ b/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js @@ -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) { diff --git a/dashboard-ui/bower_components/emby-webcomponents/layoutmanager.js b/dashboard-ui/bower_components/emby-webcomponents/layoutmanager.js index f5ae69662..f62cac40c 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/layoutmanager.js +++ b/dashboard-ui/bower_components/emby-webcomponents/layoutmanager.js @@ -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) {