mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update playlist content
This commit is contained in:
parent
a511a2fa84
commit
d08286c538
24 changed files with 1115 additions and 156 deletions
|
@ -14,12 +14,12 @@
|
|||
},
|
||||
"devDependencies": {},
|
||||
"ignore": [],
|
||||
"version": "1.4.296",
|
||||
"_release": "1.4.296",
|
||||
"version": "1.4.299",
|
||||
"_release": "1.4.299",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.4.296",
|
||||
"commit": "b1299a1ac50def9b8cdd03ec54b6170eb6c983f4"
|
||||
"tag": "1.4.299",
|
||||
"commit": "7e708cf27aa74f7f0d0aaa30d95d3e1f09b71ce3"
|
||||
},
|
||||
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
|
||||
"_target": "^1.2.1",
|
||||
|
|
|
@ -191,7 +191,7 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'mediaInfo
|
|||
|
||||
if (isResizable(screenWidth)) {
|
||||
var roundScreenTo = 100;
|
||||
screenWidth = Math.ceil(screenWidth / roundScreenTo) * roundScreenTo;
|
||||
screenWidth = Math.floor(screenWidth / roundScreenTo) * roundScreenTo;
|
||||
}
|
||||
|
||||
if (window.screen) {
|
||||
|
@ -1340,7 +1340,7 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'mediaInfo
|
|||
}
|
||||
|
||||
if (!imgUrl) {
|
||||
var defaultName = item.Type === 'Program' || item.Type == 'Timer' || item.EpisodeTitle ? item.Name : itemHelper.getDisplayName(item);
|
||||
var defaultName = item.Type === 'Program' || item.Type === 'Timer' || item.EpisodeTitle ? item.Name : itemHelper.getDisplayName(item);
|
||||
cardImageContainerOpen += '<div class="cardText cardDefaultText">' + defaultName + '</div>';
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
.emby-button > i {
|
||||
/* For non-fab buttons that have icons */
|
||||
font-size: 1.4em;
|
||||
font-size: 1.36em;
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectionManager', 'require', 'loading', 'scrollHelper', 'emby-checkbox', 'css!./../formdialog', 'material-icons'], function (dialogHelper, globalize, userSettings, layoutManager, connectionManager, require, loading, scrollHelper) {
|
||||
'use strict';
|
||||
|
||||
function save(context, options) {
|
||||
|
||||
|
@ -32,7 +33,7 @@
|
|||
|
||||
var type = chkCategorys[i].getAttribute('data-type');
|
||||
|
||||
chkCategorys[i].checked = !selectedCategories.length || selectedCategories.indexOf(type) != -1;
|
||||
chkCategorys[i].checked = !selectedCategories.length || selectedCategories.indexOf(type) !== -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectionManager', 'require', 'loading', 'scrollHelper', 'emby-checkbox', 'emby-radio', 'css!./../formdialog', 'material-icons'], function (dialogHelper, globalize, userSettings, layoutManager, connectionManager, require, loading, scrollHelper) {
|
||||
'use strict';
|
||||
|
||||
function save(context) {
|
||||
|
||||
|
@ -32,28 +33,28 @@
|
|||
|
||||
var type = chkIndicators[i].getAttribute('data-type');
|
||||
|
||||
if (chkIndicators[i].getAttribute('data-default') == 'true') {
|
||||
chkIndicators[i].checked = userSettings.get('guide-indicator-' + type) != 'false';
|
||||
if (chkIndicators[i].getAttribute('data-default') === 'true') {
|
||||
chkIndicators[i].checked = userSettings.get('guide-indicator-' + type) !== 'false';
|
||||
} else {
|
||||
chkIndicators[i].checked = userSettings.get('guide-indicator-' + type) == 'true';
|
||||
chkIndicators[i].checked = userSettings.get('guide-indicator-' + type) === 'true';
|
||||
}
|
||||
}
|
||||
|
||||
context.querySelector('.chkColorCodedBackgrounds').checked = userSettings.get('guide-colorcodedbackgrounds') == 'true';
|
||||
context.querySelector('.chkFavoriteChannelsAtTop').checked = userSettings.get('livetv-favoritechannelsattop') != 'false';
|
||||
context.querySelector('.chkColorCodedBackgrounds').checked = userSettings.get('guide-colorcodedbackgrounds') === 'true';
|
||||
context.querySelector('.chkFavoriteChannelsAtTop').checked = userSettings.get('livetv-favoritechannelsattop') !== 'false';
|
||||
|
||||
var sortByValue = userSettings.get('livetv-channelorder') || 'DatePlayed';
|
||||
|
||||
var sortBys = context.querySelectorAll('.chkSortOrder');
|
||||
for (i = 0, length = sortBys.length; i < length; i++) {
|
||||
sortBys[i].checked = sortBys[i].value == sortByValue;
|
||||
sortBys[i].checked = sortBys[i].value === sortByValue;
|
||||
}
|
||||
}
|
||||
|
||||
function onSortByChange() {
|
||||
var newValue = this.value;
|
||||
if (this.checked) {
|
||||
var changed = options.query.SortBy != newValue;
|
||||
var changed = options.query.SortBy !== newValue;
|
||||
|
||||
options.query.SortBy = newValue.replace('_', ',');
|
||||
options.query.StartIndex = 0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
define(['require', 'browser', 'globalize', 'connectionManager', 'serverNotifications', 'loading', 'datetime', 'focusManager', 'userSettings', 'imageLoader', 'events', 'layoutManager', 'itemShortcuts', 'registrationservices', 'dom', 'clearButtonStyle', 'css!./guide.css', 'programStyles', 'material-icons', 'scrollStyles', 'emby-button', 'paper-icon-button-light'], function (require, browser, globalize, connectionManager, serverNotifications, loading, datetime, focusManager, userSettings, imageLoader, events, layoutManager, itemShortcuts, registrationServices, dom) {
|
||||
'use strict';
|
||||
|
||||
function showViewSettings(instance) {
|
||||
|
||||
|
@ -176,11 +177,11 @@
|
|||
channelQuery.EnableImageTypes = "Primary";
|
||||
|
||||
var categories = self.categoryOptions.categories || [];
|
||||
var displayMovieContent = !categories.length || categories.indexOf('movies') != -1;
|
||||
var displaySportsContent = !categories.length || categories.indexOf('sports') != -1;
|
||||
var displayNewsContent = !categories.length || categories.indexOf('news') != -1;
|
||||
var displayKidsContent = !categories.length || categories.indexOf('kids') != -1;
|
||||
var displaySeriesContent = !categories.length || categories.indexOf('series') != -1;
|
||||
var displayMovieContent = !categories.length || categories.indexOf('movies') !== -1;
|
||||
var displaySportsContent = !categories.length || categories.indexOf('sports') !== -1;
|
||||
var displayNewsContent = !categories.length || categories.indexOf('news') !== -1;
|
||||
var displayKidsContent = !categories.length || categories.indexOf('kids') !== -1;
|
||||
var displaySeriesContent = !categories.length || categories.indexOf('series') !== -1;
|
||||
|
||||
if (displayMovieContent && displaySportsContent && displayNewsContent && displayKidsContent) {
|
||||
channelQuery.IsMovie = null;
|
||||
|
@ -206,7 +207,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (userSettings.get('livetv-channelorder') == 'Number') {
|
||||
if (userSettings.get('livetv-channelorder') === 'Number') {
|
||||
channelQuery.SortBy = "SortName";
|
||||
channelQuery.SortOrder = "Ascending";
|
||||
} else {
|
||||
|
@ -350,14 +351,14 @@
|
|||
|
||||
var status;
|
||||
|
||||
if (item.Type == 'SeriesTimer') {
|
||||
if (item.Type === 'SeriesTimer') {
|
||||
return '<i class="md-icon programIcon seriesTimerIcon"></i>';
|
||||
}
|
||||
else if (item.TimerId || item.SeriesTimerId) {
|
||||
|
||||
status = item.Status || 'Cancelled';
|
||||
}
|
||||
else if (item.Type == 'Timer') {
|
||||
else if (item.Type === 'Timer') {
|
||||
|
||||
status = item.Status;
|
||||
}
|
||||
|
@ -367,7 +368,7 @@
|
|||
|
||||
if (item.SeriesTimerId) {
|
||||
|
||||
if (status != 'Cancelled') {
|
||||
if (status !== 'Cancelled') {
|
||||
return '<i class="md-icon programIcon seriesTimerIcon"></i>';
|
||||
}
|
||||
|
||||
|
@ -385,7 +386,7 @@
|
|||
var endMs = startMs + msPerDay - 1;
|
||||
|
||||
programs = programs.filter(function (curr) {
|
||||
return curr.ChannelId == channel.Id;
|
||||
return curr.ChannelId === channel.Id;
|
||||
});
|
||||
|
||||
var outerCssClass = layoutManager.tv ? 'channelPrograms channelPrograms-tv' : 'channelPrograms';
|
||||
|
@ -395,18 +396,18 @@
|
|||
var clickAction = layoutManager.tv ? 'link' : 'programdialog';
|
||||
|
||||
var categories = self.categoryOptions.categories || [];
|
||||
var displayMovieContent = !categories.length || categories.indexOf('movies') != -1;
|
||||
var displaySportsContent = !categories.length || categories.indexOf('sports') != -1;
|
||||
var displayNewsContent = !categories.length || categories.indexOf('news') != -1;
|
||||
var displayKidsContent = !categories.length || categories.indexOf('kids') != -1;
|
||||
var displaySeriesContent = !categories.length || categories.indexOf('series') != -1;
|
||||
var enableColorCodedBackgrounds = userSettings.get('guide-colorcodedbackgrounds') == 'true';
|
||||
var displayMovieContent = !categories.length || categories.indexOf('movies') !== -1;
|
||||
var displaySportsContent = !categories.length || categories.indexOf('sports') !== -1;
|
||||
var displayNewsContent = !categories.length || categories.indexOf('news') !== -1;
|
||||
var displayKidsContent = !categories.length || categories.indexOf('kids') !== -1;
|
||||
var displaySeriesContent = !categories.length || categories.indexOf('series') !== -1;
|
||||
var enableColorCodedBackgrounds = userSettings.get('guide-colorcodedbackgrounds') === 'true';
|
||||
|
||||
for (var i = 0, length = programs.length; i < length; i++) {
|
||||
|
||||
var program = programs[i];
|
||||
|
||||
if (program.ChannelId != channel.Id) {
|
||||
if (program.ChannelId !== channel.Id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -533,11 +534,11 @@
|
|||
var allowIndicators = dom.getWindowSize().innerWidth >= 600;
|
||||
|
||||
var options = {
|
||||
showHdIcon: allowIndicators && userSettings.get('guide-indicator-hd') == 'true',
|
||||
showLiveIndicator: allowIndicators && userSettings.get('guide-indicator-live') != 'false',
|
||||
showPremiereIndicator: allowIndicators && userSettings.get('guide-indicator-premiere') != 'false',
|
||||
showNewIndicator: allowIndicators && userSettings.get('guide-indicator-new') == 'true',
|
||||
showRepeatIndicator: allowIndicators && userSettings.get('guide-indicator-repeat') == 'true'
|
||||
showHdIcon: allowIndicators && userSettings.get('guide-indicator-hd') === 'true',
|
||||
showLiveIndicator: allowIndicators && userSettings.get('guide-indicator-live') !== 'false',
|
||||
showPremiereIndicator: allowIndicators && userSettings.get('guide-indicator-premiere') !== 'false',
|
||||
showNewIndicator: allowIndicators && userSettings.get('guide-indicator-new') === 'true',
|
||||
showRepeatIndicator: allowIndicators && userSettings.get('guide-indicator-repeat') === 'true'
|
||||
};
|
||||
|
||||
for (var i = 0, length = channels.length; i < length; i++) {
|
||||
|
@ -661,7 +662,7 @@
|
|||
|
||||
var focusElem;
|
||||
if (itemId) {
|
||||
focusElem = context.querySelector('[data-id="' + itemId + '"]')
|
||||
focusElem = context.querySelector('[data-id="' + itemId + '"]');
|
||||
}
|
||||
|
||||
if (focusElem) {
|
||||
|
@ -671,7 +672,7 @@
|
|||
var autoFocusParent;
|
||||
|
||||
if (channelRowId) {
|
||||
autoFocusParent = context.querySelector('[data-channelid="' + channelRowId + '"]')
|
||||
autoFocusParent = context.querySelector('[data-channelid="' + channelRowId + '"]');
|
||||
}
|
||||
|
||||
if (!autoFocusParent) {
|
||||
|
@ -788,7 +789,7 @@
|
|||
|
||||
var selectedDate = currentDate || new Date();
|
||||
dateOptions.forEach(function (d) {
|
||||
d.selected = new Date(d.id).getDate() == selectedDate.getDate();
|
||||
d.selected = new Date(d.id).getDate() === selectedDate.getDate();
|
||||
});
|
||||
|
||||
require(['actionsheet'], function (actionsheet) {
|
||||
|
@ -961,7 +962,7 @@
|
|||
|
||||
self.refresh();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return Guide;
|
||||
});
|
|
@ -1,4 +1,5 @@
|
|||
define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager', 'focusManager', 'globalize', 'scrollHelper', 'imageLoader', 'require', 'cardStyle', 'formDialogStyle', 'emby-button', 'paper-icon-button-light'], function (dialogHelper, connectionManager, loading, dom, layoutManager, focusManager, globalize, scrollHelper, imageLoader, require) {
|
||||
'use strict';
|
||||
|
||||
var currentItem;
|
||||
var hasChanges = false;
|
||||
|
@ -78,11 +79,11 @@
|
|||
options.type = type;
|
||||
options.index = index;
|
||||
|
||||
if (type == 'Backdrop') {
|
||||
if (type === 'Backdrop') {
|
||||
options.tag = item.BackdropImageTags[index];
|
||||
} else if (type == 'Screenshot') {
|
||||
} else if (type === 'Screenshot') {
|
||||
options.tag = item.ScreenshotImageTags[index];
|
||||
} else if (type == 'Primary') {
|
||||
} else if (type === 'Primary') {
|
||||
options.tag = item.PrimaryImageTag || item.ImageTags[type];
|
||||
} else {
|
||||
options.tag = item.ImageTags[type];
|
||||
|
@ -101,7 +102,7 @@
|
|||
|
||||
cssClass += " backdropCard backdropCard-scalable";
|
||||
|
||||
if (tagName == 'button') {
|
||||
if (tagName === 'button') {
|
||||
cssClass += ' card-focusscale btnImageCard';
|
||||
cardBoxCssClass += ' cardBox-focustransform cardBox-focustransform-transition';
|
||||
|
||||
|
@ -142,7 +143,7 @@
|
|||
if (enableFooterButtons) {
|
||||
html += '<div class="cardText cardTextCentered">';
|
||||
|
||||
if (image.ImageType == "Backdrop" || image.ImageType == "Screenshot") {
|
||||
if (image.ImageType === "Backdrop" || image.ImageType === "Screenshot") {
|
||||
|
||||
if (index > 0) {
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnMoveImage autoSize" data-imagetype="' + image.ImageType + '" data-index="' + image.ImageIndex + '" data-newindex="' + (image.ImageIndex - 1) + '" title="' + globalize.translate('sharedcomponents#MoveLeft') + '"><i class="md-icon">chevron_left</i></button>';
|
||||
|
@ -243,7 +244,7 @@
|
|||
function renderStandardImages(page, apiClient, item, imageInfos, imageProviders) {
|
||||
|
||||
var images = imageInfos.filter(function (i) {
|
||||
return i.ImageType != "Screenshot" && i.ImageType != "Backdrop" && i.ImageType != "Chapter";
|
||||
return i.ImageType !== "Screenshot" && i.ImageType !== "Backdrop" && i.ImageType !== "Chapter";
|
||||
});
|
||||
|
||||
renderImages(page, item, apiClient, images, imageProviders, page.querySelector('#images'));
|
||||
|
@ -252,7 +253,7 @@
|
|||
function renderBackdrops(page, apiClient, item, imageInfos, imageProviders) {
|
||||
|
||||
var images = imageInfos.filter(function (i) {
|
||||
return i.ImageType == "Backdrop";
|
||||
return i.ImageType === "Backdrop";
|
||||
|
||||
}).sort(function (a, b) {
|
||||
return a.ImageIndex - b.ImageIndex;
|
||||
|
@ -269,7 +270,7 @@
|
|||
function renderScreenshots(page, apiClient, item, imageInfos, imageProviders) {
|
||||
|
||||
var images = imageInfos.filter(function (i) {
|
||||
return i.ImageType == "Screenshot";
|
||||
return i.ImageType === "Screenshot";
|
||||
|
||||
}).sort(function (a, b) {
|
||||
return a.ImageIndex - b.ImageIndex;
|
||||
|
@ -318,7 +319,7 @@
|
|||
id: 'delete'
|
||||
});
|
||||
|
||||
if (type == 'Backdrop' || type == 'Screenshot') {
|
||||
if (type === 'Backdrop' || type === 'Screenshot') {
|
||||
if (index > 0) {
|
||||
commands.push({
|
||||
name: globalize.translate('sharedcomponents#MoveLeft'),
|
||||
|
@ -411,7 +412,7 @@
|
|||
addListeners(context, 'btnDeleteImage', 'click', function () {
|
||||
var type = this.getAttribute('data-imagetype');
|
||||
var index = this.getAttribute('data-index');
|
||||
index = index == "null" ? null : parseInt(index);
|
||||
index = index === "null" ? null : parseInt(index);
|
||||
var apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
||||
deleteImage(context, currentItem.Id, type, index, apiClient, true);
|
||||
});
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
define(['dom'], function (dom) {
|
||||
'use strict';
|
||||
|
||||
function loadImage(elem, url) {
|
||||
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser', 'dom', 'appSettings'], function (visibleinviewport, imageFetcher, layoutManager, events, browser, dom, appSettings) {
|
||||
define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser', 'dom', 'appSettings', 'require'], function (visibleinviewport, imageFetcher, layoutManager, events, browser, dom, appSettings, require) {
|
||||
'use strict';
|
||||
|
||||
var thresholdX;
|
||||
var thresholdY;
|
||||
|
||||
var requestIdleCallback = window.requestIdleCallback || function (fn) {
|
||||
fn();
|
||||
};
|
||||
|
||||
//var imagesWorker = new Worker(require.toUrl('.').split('?')[0] + '/imagesworker.js');
|
||||
|
||||
var supportsIntersectionObserver = function () {
|
||||
|
||||
if (window.IntersectionObserver) {
|
||||
|
@ -19,8 +26,8 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser
|
|||
var y = screen.availHeight;
|
||||
|
||||
if (browser.touch) {
|
||||
x *= 2;
|
||||
y *= 2;
|
||||
x *= 1.5;
|
||||
y *= 1.5;
|
||||
}
|
||||
|
||||
thresholdX = x;
|
||||
|
@ -48,26 +55,72 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser
|
|||
source = elem.getAttribute('data-src');
|
||||
}
|
||||
|
||||
if (source) {
|
||||
|
||||
imageFetcher.loadImage(elem, source).then(function () {
|
||||
|
||||
var fillingVibrant = fillVibrant(elem, source);
|
||||
|
||||
if (enableFade && !layoutManager.tv && enableEffects !== false && !fillingVibrant) {
|
||||
fadeIn(elem);
|
||||
}
|
||||
|
||||
elem.removeAttribute("data-src");
|
||||
});
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
|
||||
fillImageElement(elem, source, enableEffects);
|
||||
}
|
||||
|
||||
function fillVibrant(img, url) {
|
||||
function fillImageElement(elem, source, enableEffects) {
|
||||
imageFetcher.loadImage(elem, source).then(function () {
|
||||
|
||||
if (img.tagName != 'IMG') {
|
||||
return false;
|
||||
}
|
||||
var fillingVibrant = elem.tagName !== 'IMG' ? false : fillVibrant(elem, source);
|
||||
|
||||
if (enableFade && !layoutManager.tv && enableEffects !== false && !fillingVibrant) {
|
||||
fadeIn(elem);
|
||||
}
|
||||
|
||||
elem.removeAttribute("data-src");
|
||||
});
|
||||
}
|
||||
|
||||
//var placeholder = document.createElement('div');
|
||||
//imagesWorker.onmessage = function (evt) {
|
||||
// placeholder.dispatchEvent(new CustomEvent('decoded', {
|
||||
// detail: evt.data,
|
||||
// bubbles: false,
|
||||
// cancellable: false
|
||||
// }));
|
||||
//};
|
||||
|
||||
//var uniqueId = 0;
|
||||
|
||||
//function fillCanvas(elem, source) {
|
||||
|
||||
// var newUniqueId = (++uniqueId);
|
||||
|
||||
// imagesWorker.postMessage({
|
||||
// url: source,
|
||||
// id: newUniqueId
|
||||
// });
|
||||
|
||||
// placeholder.addEventListener('decoded', function (e) {
|
||||
|
||||
// if (e.detail.id == newUniqueId) {
|
||||
|
||||
// var imageBitmap = e.detail.imageBitmap;
|
||||
// var canvas = document.createElement('canvas');
|
||||
// var canvasContext = canvas.getContext('2d');
|
||||
|
||||
// //drawWidth *= ratio;
|
||||
// //drawHeight *= ratio;
|
||||
|
||||
// // https://stackoverflow.com/questions/21961839/simulation-background-size-cover-in-canvas/21961894#21961894
|
||||
// canvasContext.imageSmoothingEnabled = false;
|
||||
// var width = canvas.width = elem.offsetWidth;
|
||||
// var height = canvas.height = elem.offsetHeight;
|
||||
// canvasContext.drawImage(imageBitmap, 0, 0, imageBitmap.width, imageBitmap.height, 0, 0, width, height);
|
||||
|
||||
// fillVibrant(elem, source, canvas, canvasContext);
|
||||
|
||||
// elem.insertBefore(canvas, elem.firstChild);
|
||||
// elem.removeAttribute("data-src");
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
|
||||
function fillVibrant(img, url, canvas, canvasContext) {
|
||||
|
||||
var vibrantElement = img.getAttribute('data-vibrant');
|
||||
if (!vibrantElement) {
|
||||
|
@ -75,30 +128,35 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser
|
|||
}
|
||||
|
||||
if (window.Vibrant) {
|
||||
fillVibrantOnLoaded(img, url, vibrantElement);
|
||||
fillVibrantOnLoaded(img, url, vibrantElement, canvas, canvasContext);
|
||||
return true;
|
||||
}
|
||||
|
||||
require(['vibrant'], function () {
|
||||
fillVibrantOnLoaded(img, url, vibrantElement);
|
||||
fillVibrantOnLoaded(img, url, vibrantElement, canvas, canvasContext);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
function fillVibrantOnLoaded(img, url, vibrantElement) {
|
||||
function fillVibrantOnLoaded(img, url, vibrantElement, canvas, canvasContext) {
|
||||
|
||||
vibrantElement = document.getElementById(vibrantElement);
|
||||
if (!vibrantElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
var swatch = getVibrantInfo(img, url).split('|');
|
||||
if (swatch.length) {
|
||||
requestIdleCallback(function () {
|
||||
|
||||
var index = 0;
|
||||
vibrantElement.style['backgroundColor'] = swatch[index];
|
||||
vibrantElement.style['color'] = swatch[index + 1];
|
||||
}
|
||||
//var now = new Date().getTime();
|
||||
var swatch = getVibrantInfo(canvas || img, url, canvasContext).split('|');
|
||||
//console.log('vibrant took ' + (new Date().getTime() - now) + 'ms');
|
||||
if (swatch.length) {
|
||||
|
||||
var index = 0;
|
||||
vibrantElement.style.backgroundColor = swatch[index];
|
||||
vibrantElement.style.color = swatch[index + 1];
|
||||
}
|
||||
});
|
||||
/*
|
||||
* Results into:
|
||||
* Vibrant #7a4426
|
||||
|
@ -118,7 +176,8 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser
|
|||
|
||||
url = url.split('?')[0];
|
||||
|
||||
return 'vibrant5-' + url;
|
||||
var cacheKey = 'vibrant8';
|
||||
return cacheKey + url;
|
||||
}
|
||||
|
||||
function getCachedVibrantInfo(url) {
|
||||
|
@ -126,43 +185,41 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser
|
|||
return appSettings.get(getSettingsKey(url));
|
||||
}
|
||||
|
||||
function getVibrantInfo(img, url) {
|
||||
function getVibrantInfo(img, url, canvasContext) {
|
||||
|
||||
var value = getCachedVibrantInfo(url);
|
||||
if (value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
var vibrant = new Vibrant(img);
|
||||
var vibrant = new Vibrant(img, canvasContext);
|
||||
var swatches = vibrant.swatches();
|
||||
|
||||
value = '';
|
||||
var swatch = swatches['DarkVibrant'];
|
||||
var swatch = swatches.DarkVibrant;
|
||||
if (swatch) {
|
||||
value += swatch.getHex() + '|' + swatch.getBodyTextColor();
|
||||
}
|
||||
swatch = swatches['DarkMuted'];
|
||||
swatch = swatches.DarkMuted;
|
||||
if (swatch) {
|
||||
value += '|' + swatch.getHex() + '|' + swatch.getBodyTextColor();
|
||||
} else {
|
||||
value += '||';
|
||||
}
|
||||
swatch = swatches['Vibrant'];
|
||||
swatch = swatches.Vibrant;
|
||||
if (swatch) {
|
||||
value += '|' + swatch.getHex() + '|' + swatch.getBodyTextColor();
|
||||
} else {
|
||||
value += '||';
|
||||
}
|
||||
swatch = swatches['Muted'];
|
||||
swatch = swatches.Muted;
|
||||
if (swatch) {
|
||||
value += '|' + swatch.getHex() + '|' + swatch.getBodyTextColor();
|
||||
} else {
|
||||
value += '||';
|
||||
}
|
||||
|
||||
if (value) {
|
||||
appSettings.set(getSettingsKey(url), value);
|
||||
}
|
||||
appSettings.set(getSettingsKey(url), value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -335,31 +392,33 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser
|
|||
|
||||
var result;
|
||||
|
||||
if (values.length % 2)
|
||||
if (values.length % 2) {
|
||||
result = values[half];
|
||||
else
|
||||
}
|
||||
else {
|
||||
result = (values[half - 1] + values[half]) / 2.0;
|
||||
}
|
||||
|
||||
// If really close to 2:3 (poster image), just return 2:3
|
||||
var aspect2x3 = 2 / 3;
|
||||
if (Math.abs(aspect2x3 - result) <= .15) {
|
||||
if (Math.abs(aspect2x3 - result) <= 0.15) {
|
||||
return aspect2x3;
|
||||
}
|
||||
|
||||
// If really close to 16:9 (episode image), just return 16:9
|
||||
var aspect16x9 = 16 / 9;
|
||||
if (Math.abs(aspect16x9 - result) <= .2) {
|
||||
if (Math.abs(aspect16x9 - result) <= 0.2) {
|
||||
return aspect16x9;
|
||||
}
|
||||
|
||||
// If really close to 1 (square image), just return 1
|
||||
if (Math.abs(1 - result) <= .15) {
|
||||
if (Math.abs(1 - result) <= 0.15) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// If really close to 4:3 (poster image), just return 2:3
|
||||
var aspect4x3 = 4 / 3;
|
||||
if (Math.abs(aspect4x3 - result) <= .15) {
|
||||
if (Math.abs(aspect4x3 - result) <= 0.15) {
|
||||
return aspect4x3;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
define(['cryptojs-md5'], function () {
|
||||
'use strict';
|
||||
|
||||
var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.OIndexedDB || window.msIndexedDB;
|
||||
var dbVersion = 1;
|
||||
|
@ -30,20 +31,18 @@ define(['cryptojs-md5'], function () {
|
|||
|
||||
// Interim solution for Google Chrome to create an objectStore. Will be deprecated
|
||||
if (localDb.setVersion) {
|
||||
if (localDb.version != dbVersion) {
|
||||
if (localDb.version !== dbVersion) {
|
||||
var setVersion = localDb.setVersion(dbVersion);
|
||||
setVersion.onsuccess = function () {
|
||||
createObjectStore(localDb);
|
||||
};
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
db = localDb;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
db = localDb;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function revoke(url) {
|
||||
|
||||
|
@ -71,12 +70,12 @@ define(['cryptojs-md5'], function () {
|
|||
// Try to strip off the domain to share the cache between local and remote connections
|
||||
var index = url.indexOf('://');
|
||||
|
||||
if (index != -1) {
|
||||
if (index !== -1) {
|
||||
url = url.substring(index + 3);
|
||||
|
||||
index = url.indexOf('/');
|
||||
|
||||
if (index != -1) {
|
||||
if (index !== -1) {
|
||||
url = url.substring(index + 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
define(['cryptojs-md5'], function () {
|
||||
'use strict';
|
||||
|
||||
function loadImage(elem, url) {
|
||||
|
||||
|
@ -20,7 +21,7 @@ define(['cryptojs-md5'], function () {
|
|||
|
||||
function createDir(rootDirEntry, folders, callback, errorCallback) {
|
||||
// Throw out './' or '/' and move on to prevent something like '/foo/.//bar'.
|
||||
if (folders[0] == '.' || folders[0] == '') {
|
||||
if (folders[0] === '.' || folders[0] === '') {
|
||||
folders = folders.slice(1);
|
||||
}
|
||||
rootDirEntry.getDirectory(folders[0], { create: true }, function (dirEntry) {
|
||||
|
@ -140,12 +141,12 @@ define(['cryptojs-md5'], function () {
|
|||
// Try to strip off the domain to share the cache between local and remote connections
|
||||
var index = url.indexOf('://');
|
||||
|
||||
if (index != -1) {
|
||||
if (index !== -1) {
|
||||
url = url.substring(index + 3);
|
||||
|
||||
index = url.indexOf('/');
|
||||
|
||||
if (index != -1) {
|
||||
if (index !== -1) {
|
||||
url = url.substring(index + 1);
|
||||
}
|
||||
|
||||
|
@ -163,12 +164,12 @@ define(['cryptojs-md5'], function () {
|
|||
xhr.responseType = "arraybuffer";
|
||||
|
||||
xhr.onload = function (e) {
|
||||
if (this.status == 200) {
|
||||
if (this.status === 200) {
|
||||
writeData(dir, filename, this.getResponseHeader('Content-Type'), this.response, callback, errorCallback);
|
||||
} else {
|
||||
errorCallback();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
@ -200,7 +201,7 @@ define(['cryptojs-md5'], function () {
|
|||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
if (originalUrl.indexOf('tag=') != -1) {
|
||||
if (originalUrl.indexOf('tag=') !== -1) {
|
||||
originalUrl += "&accept=webp";
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
define(['css!./indicators.css', 'material-icons'], function () {
|
||||
'use strict';
|
||||
|
||||
function enableProgressIndicator(item) {
|
||||
|
||||
if (item.MediaType == 'Video') {
|
||||
if (item.Type != 'TvChannel') {
|
||||
if (item.MediaType === 'Video') {
|
||||
if (item.Type !== 'TvChannel') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +28,7 @@ define(['css!./indicators.css', 'material-icons'], function () {
|
|||
function getProgressBarHtml(item, options) {
|
||||
|
||||
if (enableProgressIndicator(item)) {
|
||||
if (item.Type == "Recording" && item.CompletionPercentage) {
|
||||
if (item.Type === "Recording" && item.CompletionPercentage) {
|
||||
|
||||
return getProgressHtml(item.CompletionPercentage, options);
|
||||
}
|
||||
|
@ -48,9 +49,9 @@ define(['css!./indicators.css', 'material-icons'], function () {
|
|||
|
||||
function enablePlayedIndicator(item) {
|
||||
|
||||
if (item.Type == "Series" || item.Type == "Season" || item.Type == "BoxSet" || item.MediaType == "Video" || item.MediaType == "Game" || item.MediaType == "Book") {
|
||||
if (item.Type === "Series" || item.Type === "Season" || item.Type === "BoxSet" || item.MediaType === "Video" || item.MediaType === "Game" || item.MediaType === "Book") {
|
||||
|
||||
if (item.Type != 'TvChannel') {
|
||||
if (item.Type !== 'TvChannel') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -100,14 +101,14 @@ define(['css!./indicators.css', 'material-icons'], function () {
|
|||
|
||||
var status;
|
||||
|
||||
if (item.Type == 'SeriesTimer') {
|
||||
if (item.Type === 'SeriesTimer') {
|
||||
return '<i class="md-icon timerIndicator indicatorIcon"></i>';
|
||||
}
|
||||
else if (item.TimerId || item.SeriesTimerId) {
|
||||
|
||||
status = item.Status || 'Cancelled';
|
||||
}
|
||||
else if (item.Type == 'Timer') {
|
||||
else if (item.Type === 'Timer') {
|
||||
|
||||
status = item.Status;
|
||||
}
|
||||
|
@ -117,7 +118,7 @@ define(['css!./indicators.css', 'material-icons'], function () {
|
|||
|
||||
if (item.SeriesTimerId) {
|
||||
|
||||
if (status != 'Cancelled') {
|
||||
if (status !== 'Cancelled') {
|
||||
return '<i class="md-icon timerIndicator indicatorIcon"></i>';
|
||||
}
|
||||
|
||||
|
@ -129,7 +130,7 @@ define(['css!./indicators.css', 'material-icons'], function () {
|
|||
|
||||
function getSyncIndicator(item) {
|
||||
|
||||
if (item.SyncPercent == 100) {
|
||||
if (item.SyncPercent === 100) {
|
||||
return '<div class="syncIndicator indicator fullSyncIndicator"><i class="md-icon indicatorIcon">file_download</i></div>';
|
||||
} else if (item.SyncPercent != null) {
|
||||
return '<div class="syncIndicator indicator emptySyncIndicator"><i class="md-icon indicatorIcon">file_download</i></div>';
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
"Repeat": "Repeat",
|
||||
"TrackCount": "{0} tracks",
|
||||
"ItemCount": "{0} items",
|
||||
"ValueSeriesYearToPresent": "{0} - Present",
|
||||
"ReleaseYearValue": "Release year: {0}",
|
||||
"OriginalAirDateValue": "Original air date: {0}",
|
||||
"EndsAtValue": "Ends at {0}",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue