From 046e5849243c77af1d2c7a33d3dc61639b2539f3 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 28 Aug 2014 00:32:45 -0400 Subject: [PATCH] Support webp image output --- dashboard-ui/css/site.css | 4 +++- dashboard-ui/thirdparty/mediabrowser.apiclient.js | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dashboard-ui/css/site.css b/dashboard-ui/css/site.css index befbc43ad6..f7829efd56 100644 --- a/dashboard-ui/css/site.css +++ b/dashboard-ui/css/site.css @@ -345,7 +345,9 @@ h1 .imageLink { } .page > .ui-content { - padding-bottom: 120px; + + /* Need this so that the audio player doesn't cover content, but also for unveil lazy loading. */ + padding-bottom: 160px; } .dashboardPanelDivider { diff --git a/dashboard-ui/thirdparty/mediabrowser.apiclient.js b/dashboard-ui/thirdparty/mediabrowser.apiclient.js index 1e22291559..7cc266da0d 100644 --- a/dashboard-ui/thirdparty/mediabrowser.apiclient.js +++ b/dashboard-ui/thirdparty/mediabrowser.apiclient.js @@ -2122,6 +2122,12 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi }); }; + function supportsWebP() { + + // TODO: Improve with http://webpjs.appspot.com/ + return $.browser.chrome || $.browser.android; + } + function normalizeImageOptions(options) { var ratio = window.devicePixelRatio || 1; @@ -2147,6 +2153,10 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi } options.quality = options.quality || (options.type.toLowerCase() == 'backdrop' ? 80 : 90); + + if (supportsWebP()) { + options.format = 'webp'; + } } /** @@ -2220,6 +2230,10 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi delete options.type; delete options.index; + if (supportsWebP()) { + options.format = 'webp'; + } + return self.getUrl(url, options); };