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

update images

This commit is contained in:
Luke Pulverenti 2016-10-13 17:13:30 -04:00
parent 793cf35f42
commit fbc040dc9c
6 changed files with 42 additions and 32 deletions

View file

@ -138,7 +138,7 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser
return true; return true;
} }
function fillVibrantOnLoaded(img, url, vibrantElement, canvas, canvasContext) { function fillVibrantOnLoaded(img, url, vibrantElement) {
vibrantElement = document.getElementById(vibrantElement); vibrantElement = document.getElementById(vibrantElement);
if (!vibrantElement) { if (!vibrantElement) {
@ -148,7 +148,7 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser
requestIdleCallback(function () { requestIdleCallback(function () {
//var now = new Date().getTime(); //var now = new Date().getTime();
var swatch = getVibrantInfo(canvas || img, url, canvasContext).split('|'); var swatch = getVibrantInfo(img, url).split('|');
//console.log('vibrant took ' + (new Date().getTime() - now) + 'ms'); //console.log('vibrant took ' + (new Date().getTime() - now) + 'ms');
if (swatch.length) { if (swatch.length) {
@ -176,7 +176,7 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser
url = url.split('?')[0]; url = url.split('?')[0];
var cacheKey = 'vibrant11'; var cacheKey = 'vibrant21';
return cacheKey + url; return cacheKey + url;
} }
@ -185,14 +185,14 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser
return appSettings.get(getSettingsKey(url)); return appSettings.get(getSettingsKey(url));
} }
function getVibrantInfo(img, url, canvasContext) { function getVibrantInfo(img, url) {
var value = getCachedVibrantInfo(url); var value = getCachedVibrantInfo(url);
if (value) { if (value) {
return value; return value;
} }
var vibrant = new Vibrant(img, canvasContext); var vibrant = new Vibrant(img);
var swatches = vibrant.swatches(); var swatches = vibrant.swatches();
value = ''; value = '';

View file

@ -622,7 +622,7 @@ module.exports = MMCQ.quantize
this.swatches = bind(this.swatches, this); this.swatches = bind(this.swatches, this);
var a, allPixels, b, cmap, g, i, image, imageData, offset, pixelCount, pixels, r; var a, allPixels, b, cmap, g, i, image, imageData, offset, pixelCount, pixels, r;
if (typeof colorCount === 'undefined') { if (typeof colorCount === 'undefined') {
colorCount = 64; colorCount = 16;
} }
if (typeof quality === 'undefined') { if (typeof quality === 'undefined') {
quality = 5; quality = 5;
@ -837,21 +837,28 @@ module.exports = MMCQ.quantize
*/ */
window.CanvasImage = CanvasImage = (function() { window.CanvasImage = CanvasImage = (function() {
function CanvasImage(image, context) { function CanvasImage(image) {
if (context) {
this.width = image.width;
this.height = image.height;
this.context = context;
} else {
this.canvas = document.createElement('canvas'); this.canvas = document.createElement('canvas');
this.width = this.canvas.width = image.width;
this.height = this.canvas.height = image.height;
this.context = this.canvas.getContext('2d'); this.context = this.canvas.getContext('2d');
this.context.drawImage(image, 0, 0, this.width, this.height);
var originalWidth = image.width;
var originalHeight = image.height;
var maxArea = 300 * 300;
var bitmapArea = originalWidth * originalHeight;
var scaleRatio = 1;
if (bitmapArea > maxArea) {
scaleRatio = maxArea / bitmapArea;
} }
//console.log(scaleRatio);
this.width = this.canvas.width = originalWidth * scaleRatio;
this.height = this.canvas.height = originalHeight * scaleRatio;
this.context.drawImage(image, 0, 0, originalWidth, originalHeight, 0, 0, this.width, this.height);
} }
CanvasImage.prototype.getPixelCount = function() { CanvasImage.prototype.getPixelCount = function() {

View file

@ -160,7 +160,7 @@ progress {
top: 0; top: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
left: 280px; left: 260px;
} }
.dashboardDocument .adminDrawerLogo { .dashboardDocument .adminDrawerLogo {
@ -339,7 +339,6 @@ a[data-role='button'], .type-interior button:not([data-role='none']):not(.clearB
@media all and (min-width: 1200px) { @media all and (min-width: 1200px) {
.mainDrawerPanel:not([narrow]) .content-primary { .mainDrawerPanel:not([narrow]) .content-primary {
padding-right: 1.5em;
padding-left: 2em; padding-left: 2em;
} }
} }

View file

@ -89,7 +89,7 @@
} }
.homePageSection + .homePageSection { .homePageSection + .homePageSection {
margin-top: 30px; margin-top: 25px;
} }
.sectionHeaderButton { .sectionHeaderButton {

View file

@ -103,12 +103,7 @@
}); });
} }
var lastFullRender = 0; function reload(page, enableFullRender) {
function enableFullRender() {
return (new Date().getTime() - lastFullRender) > 300000;
}
function reload(page) {
renderActiveRecordings(page, ApiClient.getLiveTvRecordings({ renderActiveRecordings(page, ApiClient.getLiveTvRecordings({
UserId: Dashboard.getCurrentUserId(), UserId: Dashboard.getCurrentUserId(),
@ -118,7 +113,7 @@
EnableImageTypes: "Primary,Thumb,Backdrop" EnableImageTypes: "Primary,Thumb,Backdrop"
})); }));
if (!enableFullRender()) { if (!enableFullRender) {
return; return;
} }
@ -190,7 +185,6 @@
renderItems(page, result.Items, 'upcomingKidsItems'); renderItems(page, result.Items, 'upcomingKidsItems');
}); });
lastFullRender = new Date().getTime();
} }
function renderItems(page, items, sectionClass, overlayButton, shape) { function renderItems(page, items, sectionClass, overlayButton, shape) {
@ -227,6 +221,10 @@
return function (view, params) { return function (view, params) {
var self = this; var self = this;
var lastFullRender = 0;
function enableFullRender() {
return (new Date().getTime() - lastFullRender) > 300000;
}
self.initTab = function () { self.initTab = function () {
@ -247,7 +245,13 @@
self.renderTab = function () { self.renderTab = function () {
var tabContent = view.querySelector('.pageTabContent[data-index=\'' + 0 + '\']'); var tabContent = view.querySelector('.pageTabContent[data-index=\'' + 0 + '\']');
if (enableFullRender()) {
reload(tabContent, true);
lastFullRender = new Date().getTime();
} else {
reload(tabContent); reload(tabContent);
}
}; };
var tabControllers = []; var tabControllers = [];

View file

@ -569,7 +569,7 @@
lazy: true, lazy: true,
overlayPlayButton: true, overlayPlayButton: true,
context: 'home', context: 'home',
centerText: true, centerText: !supportsImageAnalysis,
allowBottomPadding: !enableScrollX(), allowBottomPadding: !enableScrollX(),
cardLayout: supportsImageAnalysis, cardLayout: supportsImageAnalysis,
vibrant: supportsImageAnalysis vibrant: supportsImageAnalysis