removed all vibrant references (dead module)

This commit is contained in:
vitorsemeano 2019-04-03 22:27:57 +01:00
parent ce51c8012d
commit 1da48cd363
16 changed files with 11 additions and 163 deletions

View File

@ -132,8 +132,7 @@ define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoad
overlayMoreButton: section.overlayMoreButton && !cardLayout,
action: section.action,
allowBottomPadding: !enableScrollX(),
cardLayout: cardLayout,
vibrant: supportsImageAnalysis && cardLayout
cardLayout: cardLayout
}), html += "</div>"
}
elem.innerHTML = html, imageLoader.lazyChildren(elem)

View File

@ -30,9 +30,7 @@ define(['lazyLoader', 'imageFetcher', 'layoutManager', 'browser', 'appSettings',
function fillImageElement(elem, source, enableEffects) {
imageFetcher.loadImage(elem, source).then(function () {
var fillingVibrant = false;//fillVibrant(elem, source);
if (enableFade && enableEffects !== false && !fillingVibrant) {
if (enableFade && enableEffects !== false) {
fadeIn(elem);
}
@ -40,131 +38,6 @@ define(['lazyLoader', 'imageFetcher', 'layoutManager', 'browser', 'appSettings',
});
}
function fillVibrant(img, url, canvas, canvasContext) {
var vibrantElement = img.getAttribute('data-vibrant');
if (!vibrantElement) {
return false;
}
if (window.Vibrant) {
fillVibrantOnLoaded(img, url, vibrantElement, canvas, canvasContext);
return true;
}
require(['vibrant'], function () {
fillVibrantOnLoaded(img, url, vibrantElement, canvas, canvasContext);
});
return true;
}
function fillVibrantOnLoaded(img, url, vibrantElement) {
vibrantElement = document.getElementById(vibrantElement);
if (!vibrantElement) {
return;
}
requestIdleCallback(function () {
//var now = new Date().getTime();
getVibrantInfoFromElement(img, url).then(function (vibrantInfo) {
var swatch = vibrantInfo.split('|');
//console.log('vibrant took ' + (new Date().getTime() - now) + 'ms');
if (swatch.length) {
var index = 0;
var style = vibrantElement.style;
style.backgroundColor = swatch[index];
style.color = swatch[index + 1];
var classList = vibrantElement.classList;
if (classList.contains('cardFooter')) {
classList.add('cardFooter-vibrant');
} else {
classList.add('vibrant');
}
}
});
});
/*
* Results into:
* Vibrant #7a4426
* Muted #7b9eae
* DarkVibrant #348945
* DarkMuted #141414
* LightVibrant #f3ccb4
*/
}
function getVibrantInfoFromElement(elem, url) {
return new Promise(function (resolve, reject) {
require(['vibrant'], function () {
if (elem.tagName === 'IMG') {
resolve(getVibrantInfo(elem, url));
return;
}
var img = new Image();
img.onload = function () {
resolve(getVibrantInfo(img, url));
};
img.src = url;
});
});
}
function getSettingsKey(url) {
var parts = url.split('://');
url = parts[parts.length - 1];
url = url.substring(url.indexOf('/') + 1);
url = url.split('?')[0];
var cacheKey = 'vibrant31';
//cacheKey = 'vibrant' + new Date().getTime();
return cacheKey + url;
}
function getCachedVibrantInfo(url) {
return appSettings.get(getSettingsKey(url));
}
function getVibrantInfo(img, url) {
var value = getCachedVibrantInfo(url);
if (value) {
return value;
}
var vibrant = new Vibrant(img);
var swatches = vibrant.swatches();
value = '';
var swatch = swatches.DarkVibrant;
value += getSwatchString(swatch);
appSettings.set(getSettingsKey(url), value);
return value;
}
function getSwatchString(swatch) {
if (swatch) {
return swatch.getHex() + '|' + swatch.getBodyTextColor() + '|' + swatch.getTitleTextColor();
}
return '||';
}
function fadeIn(elem) {
var cssClass = 'lazy-image-fadein';
@ -248,8 +121,6 @@ define(['lazyLoader', 'imageFetcher', 'layoutManager', 'browser', 'appSettings',
self.lazyImage = fillImage;
self.lazyChildren = lazyChildren;
self.getPrimaryImageAspectRatio = getPrimaryImageAspectRatio;
self.getCachedVibrantInfo = getCachedVibrantInfo;
self.getVibrantInfoFromElement = getVibrantInfoFromElement;
return self;
});

View File

@ -167,7 +167,6 @@ define(["appRouter", "cardBuilder", "dom", "globalize", "connectionManager", "ap
action: section.action,
allowBottomPadding: !enableScrollX(),
cardLayout: cardLayout,
vibrant: supportsImageAnalysis && cardLayout,
leadingButtons: leadingButtons,
lines: lines
})

View File

@ -41,7 +41,6 @@ define(["browser", "layoutManager", "userSettings", "inputManager", "loading", "
overlayPlayButton: !supportsImageAnalysis,
allowBottomPadding: !enableScrollX(),
cardLayout: supportsImageAnalysis,
vibrant: supportsImageAnalysis,
coverImage: !0
}), imageLoader.lazyChildren(elem), loading.hide()
})
@ -78,7 +77,6 @@ define(["browser", "layoutManager", "userSettings", "inputManager", "loading", "
overlayMoreButton: !supportsImageAnalysis,
allowBottomPadding: !enableScrollX(),
cardLayout: supportsImageAnalysis,
vibrant: supportsImageAnalysis,
coverImage: !0
}), imageLoader.lazyChildren(itemsContainer)
})
@ -115,7 +113,6 @@ define(["browser", "layoutManager", "userSettings", "inputManager", "loading", "
overlayMoreButton: !supportsImageAnalysis,
allowBottomPadding: !enableScrollX(),
cardLayout: supportsImageAnalysis,
vibrant: supportsImageAnalysis,
coverImage: !0
}), imageLoader.lazyChildren(itemsContainer)
})

View File

@ -15,7 +15,6 @@ define(["layoutManager", "loading", "cardBuilder", "apphost", "imageLoader", "sc
coverImage: !0,
cardLayout: !1,
centerText: !0,
vibrant: !1,
allowBottomPadding: !scrollX,
preferThumb: "auto",
overlayText: !1

View File

@ -19,7 +19,6 @@ define(["layoutManager", "cardBuilder", "apphost", "imageLoader", "loading", "sc
coverImage: !0,
cardLayout: cardLayout,
centerText: !cardLayout,
vibrant: cardLayout && supportsImageAnalysis,
allowBottomPadding: !enableScrollX(),
preferThumb: "auto"
}, cardOptions || {})), imageLoader.lazyChildren(recordingItems)

View File

@ -80,8 +80,7 @@ define(["loading", "events", "libraryBrowser", "imageLoader", "listView", "cardB
context: "movies",
lazy: !0,
cardLayout: !0,
showTitle: !0,
vibrant: !0
showTitle: !0
}) : "Banner" == viewStyle ? cardBuilder.getCardsHtml({
items: result.Items,
shape: "banner",
@ -98,8 +97,7 @@ define(["loading", "events", "libraryBrowser", "imageLoader", "listView", "cardB
context: "movies",
showTitle: !0,
centerText: !1,
cardLayout: !0,
vibrant: !0
cardLayout: !0
}) : cardBuilder.getCardsHtml({
items: result.Items,
shape: "auto",

View File

@ -80,7 +80,6 @@ define(["layoutManager", "loading", "libraryBrowser", "cardBuilder", "lazyLoader
scalable: !0,
centerText: !1,
cardLayout: !0,
vibrant: supportsImageAnalysis,
showYear: !0
}) : "PosterCard" == viewStyle ? cardBuilder.buildCards(result.Items, {
itemsContainer: elem,
@ -89,7 +88,6 @@ define(["layoutManager", "loading", "libraryBrowser", "cardBuilder", "lazyLoader
scalable: !0,
centerText: !1,
cardLayout: !0,
vibrant: supportsImageAnalysis,
showYear: !0
}) : "Poster" == viewStyle && cardBuilder.buildCards(result.Items, {
itemsContainer: elem,

View File

@ -67,8 +67,7 @@ define(["layoutManager", "loading", "events", "libraryBrowser", "imageLoader", "
context: "movies",
cardLayout: !0,
showTitle: !0,
showYear: !0,
vibrant: !0
showYear: !0
}) : "Banner" == viewStyle ? cardBuilder.getCardsHtml({
items: result.Items,
shape: "banner",
@ -84,8 +83,7 @@ define(["layoutManager", "loading", "events", "libraryBrowser", "imageLoader", "
context: "movies",
showTitle: !0,
showYear: !0,
cardLayout: !0,
vibrant: !0
cardLayout: !0
}) : cardBuilder.getCardsHtml({
items: result.Items,
shape: "portrait",

View File

@ -49,15 +49,13 @@ define(["libraryBrowser", "cardBuilder", "apphost", "imageLoader", "loading"], f
preferThumb: !0,
context: "music",
cardLayout: !0,
showTitle: !0,
vibrant: !0
showTitle: !0
}) : "PosterCard" == viewStyle ? html = cardBuilder.getCardsHtml({
items: result.Items,
shape: "auto",
context: "music",
cardLayout: !0,
showTitle: !0,
vibrant: !0
showTitle: !0
}) : "Poster" == viewStyle && (html = cardBuilder.getCardsHtml({
items: result.Items,
shape: "auto",

View File

@ -43,8 +43,7 @@ define(["libraryBrowser", "cardBuilder", "apphost", "imageLoader", "loading"], f
centerText: !0,
overlayPlayButton: !0,
allowBottomPadding: !0,
cardLayout: !1,
vibrant: !1
cardLayout: !1
});
var elem = context.querySelector("#items");
elem.innerHTML = html, imageLoader.lazyChildren(elem), libraryBrowser.saveQueryValues(getSavedQueryKey(), query), loading.hide()

View File

@ -69,8 +69,7 @@ define(["loading", "listView", "cardBuilder", "libraryMenu", "libraryBrowser", "
shape: "square",
coverImage: !0,
showTitle: !0,
cardLayout: !0,
vibrant: !0
cardLayout: !0
}) : "Thumb" == viewStyle ? cardBuilder.getCardsHtml({
items: result.Items,
shape: "backdrop",
@ -83,8 +82,7 @@ define(["loading", "listView", "cardBuilder", "libraryMenu", "libraryBrowser", "
shape: "backdrop",
showTitle: !0,
preferThumb: !0,
cardLayout: !0,
vibrant: !0
cardLayout: !0
}) : cardBuilder.getCardsHtml({
items: result.Items,
shape: "square",

View File

@ -673,7 +673,6 @@ var AppInfo = {};
var componentsPath = "components";
var paths = {
velocity: bowerPath + "/velocity/velocity.min",
vibrant: bowerPath + "/vibrant/dist/vibrant",
ironCardList: "components/ironcardlist/ironcardlist",
scrollThreshold: "components/scrollthreshold",
playlisteditor: "components/playlisteditor/playlisteditor",

View File

@ -80,7 +80,6 @@ define(["layoutManager", "loading", "libraryBrowser", "cardBuilder", "lazyLoader
scalable: !0,
centerText: !1,
cardLayout: !0,
vibrant: supportsImageAnalysis,
showYear: !0
}) : "PosterCard" == viewStyle ? cardBuilder.buildCards(result.Items, {
itemsContainer: elem,
@ -89,7 +88,6 @@ define(["layoutManager", "loading", "libraryBrowser", "cardBuilder", "lazyLoader
scalable: !0,
centerText: !1,
cardLayout: !0,
vibrant: supportsImageAnalysis,
showYear: !0
}) : "Poster" == viewStyle && cardBuilder.buildCards(result.Items, {
itemsContainer: elem,

View File

@ -34,7 +34,6 @@ define(["loading", "components/groupedcards", "cardBuilder", "apphost", "imageLo
centerText: !0,
lazy: !0,
overlayPlayButton: !0,
vibrant: !1,
lines: 2
});
var elem = context.querySelector("#latestEpisodes");

View File

@ -73,7 +73,6 @@ define(["layoutManager", "loading", "datetime", "libraryBrowser", "cardBuilder",
overlayText: !1,
allowBottomPadding: allowBottomPadding,
cardLayout: supportsImageAnalysis,
vibrant: supportsImageAnalysis,
overlayMoreButton: !0,
missingIndicator: !1
}), html += "</div>", html += "</div>"