Merge branch 'master' into media-session
This commit is contained in:
commit
14c74ee0b9
12 changed files with 159 additions and 398 deletions
|
@ -92,6 +92,8 @@
|
||||||
"src/components/cardbuilder/cardBuilder.js",
|
"src/components/cardbuilder/cardBuilder.js",
|
||||||
"src/components/filedownloader.js",
|
"src/components/filedownloader.js",
|
||||||
"src/components/playback/mediasession.js",
|
"src/components/playback/mediasession.js",
|
||||||
|
"src/components/images/imageLoader.js",
|
||||||
|
"src/components/lazyloader/lazyloader-intersectionobserver.js",
|
||||||
"src/components/sanatizefilename.js",
|
"src/components/sanatizefilename.js",
|
||||||
"src/components/scrollManager.js",
|
"src/components/scrollManager.js",
|
||||||
"src/scripts/dfnshelper.js",
|
"src/scripts/dfnshelper.js",
|
||||||
|
|
|
@ -1,50 +1,82 @@
|
||||||
define(['lazyLoader', 'imageFetcher', 'layoutManager', 'browser', 'appSettings', 'userSettings', 'require', 'css!./style'], function (lazyLoader, imageFetcher, layoutManager, browser, appSettings, userSettings, require) {
|
import * as lazyLoader from 'lazyLoader';
|
||||||
'use strict';
|
import * as userSettings from 'userSettings';
|
||||||
|
import 'css!./style';
|
||||||
var self = {};
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function fillImage(elem, source, enableEffects) {
|
|
||||||
|
|
||||||
if (!elem) {
|
|
||||||
throw new Error('elem cannot be null');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!source) {
|
|
||||||
source = elem.getAttribute('data-src');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
export function lazyImage(elem, source = elem.getAttribute('data-src')) {
|
||||||
if (!source) {
|
if (!source) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fillImageElement(elem, source, enableEffects);
|
fillImageElement(elem, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillImageElement(elem, source, enableEffects) {
|
export function fillImage(entry) {
|
||||||
imageFetcher.loadImage(elem, source).then(function () {
|
if (!entry) {
|
||||||
|
throw new Error('entry cannot be null');
|
||||||
|
}
|
||||||
|
|
||||||
if (enableEffects !== false) {
|
var source = undefined;
|
||||||
fadeIn(elem);
|
if (entry.target) {
|
||||||
|
source = entry.target.getAttribute('data-src');
|
||||||
|
} else {
|
||||||
|
source = entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry.intersectionRatio > 0) {
|
||||||
|
if (source) fillImageElement(entry.target, source);
|
||||||
|
} else if (!source) {
|
||||||
|
emptyImageElement(entry.target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function fillImageElement(elem, url) {
|
||||||
|
if (url === undefined) {
|
||||||
|
throw new Error('url cannot be undefined');
|
||||||
|
}
|
||||||
|
|
||||||
|
let preloaderImg = new Image();
|
||||||
|
preloaderImg.src = url;
|
||||||
|
|
||||||
|
preloaderImg.addEventListener('load', () => {
|
||||||
|
if (elem.tagName !== 'IMG') {
|
||||||
|
elem.style.backgroundImage = "url('" + url + "')";
|
||||||
|
} else {
|
||||||
|
elem.setAttribute('src', url);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userSettings.enableFastFadein()) {
|
||||||
|
elem.classList.add('lazy-image-fadein-fast');
|
||||||
|
} else {
|
||||||
|
elem.classList.add('lazy-image-fadein');
|
||||||
}
|
}
|
||||||
|
|
||||||
elem.removeAttribute('data-src');
|
elem.removeAttribute('data-src');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function fadeIn(elem) {
|
function emptyImageElement(elem) {
|
||||||
if (userSettings.enableFastFadein()) {
|
var url;
|
||||||
elem.classList.add('lazy-image-fadein-fast');
|
|
||||||
|
if (elem.tagName !== 'IMG') {
|
||||||
|
url = elem.style.backgroundImage.slice(4, -1).replace(/"/g, '');
|
||||||
|
elem.style.backgroundImage = 'none';
|
||||||
} else {
|
} else {
|
||||||
elem.classList.add('lazy-image-fadein');
|
url = elem.getAttribute('src');
|
||||||
|
elem.setAttribute('src', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elem.setAttribute('data-src', url);
|
||||||
|
|
||||||
|
elem.classList.remove('lazy-image-fadein-fast');
|
||||||
|
elem.classList.remove('lazy-image-fadein');
|
||||||
}
|
}
|
||||||
|
|
||||||
function lazyChildren(elem) {
|
export function lazyChildren(elem) {
|
||||||
|
|
||||||
lazyLoader.lazyChildren(elem, fillImage);
|
lazyLoader.lazyChildren(elem, fillImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPrimaryImageAspectRatio(items) {
|
export function getPrimaryImageAspectRatio(items) {
|
||||||
|
|
||||||
var values = [];
|
var values = [];
|
||||||
|
|
||||||
|
@ -104,7 +136,7 @@ define(['lazyLoader', 'imageFetcher', 'layoutManager', 'browser', 'appSettings',
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillImages(elems) {
|
export function fillImages(elems) {
|
||||||
|
|
||||||
for (var i = 0, length = elems.length; i < length; i++) {
|
for (var i = 0, length = elems.length; i < length; i++) {
|
||||||
var elem = elems[0];
|
var elem = elems[0];
|
||||||
|
@ -112,10 +144,11 @@ define(['lazyLoader', 'imageFetcher', 'layoutManager', 'browser', 'appSettings',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.fillImages = fillImages;
|
/* eslint-enable indent */
|
||||||
self.lazyImage = fillImage;
|
export default {
|
||||||
self.lazyChildren = lazyChildren;
|
fillImages: fillImages,
|
||||||
self.getPrimaryImageAspectRatio = getPrimaryImageAspectRatio;
|
fillImage: fillImage,
|
||||||
|
lazyImage: lazyImage,
|
||||||
return self;
|
lazyChildren: lazyChildren,
|
||||||
});
|
getPrimaryImageAspectRatio: getPrimaryImageAspectRatio
|
||||||
|
};
|
||||||
|
|
|
@ -1,44 +1,13 @@
|
||||||
.lazy-image-fadein {
|
.cardImageContainer.lazy {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
animation: lazy-image-fadein 330ms ease-in normal both;
|
|
||||||
-webkit-animation-duration: 0.8s;
|
|
||||||
-moz-animation-duration: 0.8s;
|
|
||||||
-o-animation-duration: 0.8s;
|
|
||||||
animation-duration: 0.8s;
|
|
||||||
-webkit-animation-name: popInAnimation;
|
|
||||||
-moz-animation-name: popInAnimation;
|
|
||||||
-o-animation-name: popInAnimation;
|
|
||||||
animation-name: popInAnimation;
|
|
||||||
-webkit-animation-fill-mode: forwards;
|
|
||||||
-moz-animation-fill-mode: forwards;
|
|
||||||
-o-animation-fill-mode: forwards;
|
|
||||||
animation-fill-mode: forwards;
|
|
||||||
-webkit-animation-timing-function: cubic-bezier(0, 0, 0.5, 1);
|
|
||||||
-moz-animation-timing-function: cubic-bezier(0, 0, 0.5, 1);
|
|
||||||
-o-animation-timing-function: cubic-bezier(0, 0, 0.5, 1);
|
|
||||||
animation-timing-function: cubic-bezier(0, 0, 0.5, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.lazy-image-fadein-fast {
|
.cardImageContainer.lazy.lazy-image-fadein {
|
||||||
animation: lazy-image-fadein 160ms ease-in normal both;
|
opacity: 1;
|
||||||
|
transition: opacity 0.7s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes lazy-image-fadein {
|
.cardImageContainer.lazy.lazy-image-fadein-fast {
|
||||||
from {
|
opacity: 1;
|
||||||
opacity: 0;
|
transition: opacity 0.2s;
|
||||||
}
|
|
||||||
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes popInAnimation {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
.lazy {
|
|
||||||
/* In edge, intersection observer will not fire on 0px sized elements */
|
|
||||||
min-width: 0.1em;
|
|
||||||
min-height: 0.1em;
|
|
||||||
}
|
|
|
@ -1,103 +1,67 @@
|
||||||
define(['require', 'browser'], function (require, browser) {
|
/* eslint-disable indent */
|
||||||
'use strict';
|
export class LazyLoader {
|
||||||
|
constructor(options) {
|
||||||
|
this.options = options;
|
||||||
|
}
|
||||||
|
|
||||||
function LazyLoader(options) {
|
createObserver() {
|
||||||
|
const callback = this.options.callback;
|
||||||
|
|
||||||
this.options = options;
|
const observer = new IntersectionObserver(
|
||||||
}
|
(entries) => {
|
||||||
|
entries.forEach(entry => {
|
||||||
|
callback(entry);
|
||||||
|
},
|
||||||
|
{rootMargin: '50%'});
|
||||||
|
});
|
||||||
|
|
||||||
if (browser.edge) {
|
this.observer = observer;
|
||||||
require(['css!./lazyedgehack']);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
LazyLoader.prototype.createObserver = function () {
|
addElements(elements) {
|
||||||
|
let observer = this.observer;
|
||||||
|
|
||||||
var observerOptions = {};
|
if (!observer) {
|
||||||
var options = this.options;
|
this.createObserver();
|
||||||
var loadedCount = 0;
|
observer = this.observer;
|
||||||
var callback = options.callback;
|
|
||||||
|
|
||||||
observerOptions.rootMargin = '50%';
|
|
||||||
|
|
||||||
var observerId = 'obs' + new Date().getTime();
|
|
||||||
|
|
||||||
var self = this;
|
|
||||||
var observer = new IntersectionObserver(function (entries) {
|
|
||||||
for (var j = 0, length2 = entries.length; j < length2; j++) {
|
|
||||||
var entry = entries[j];
|
|
||||||
|
|
||||||
if (entry.intersectionRatio > 0) {
|
|
||||||
|
|
||||||
// Stop watching and load the image
|
|
||||||
var target = entry.target;
|
|
||||||
|
|
||||||
observer.unobserve(target);
|
|
||||||
|
|
||||||
if (!target[observerId]) {
|
|
||||||
target[observerId] = 1;
|
|
||||||
callback(target);
|
|
||||||
loadedCount++;
|
|
||||||
|
|
||||||
if (loadedCount >= self.elementCount) {
|
|
||||||
self.destroyObserver();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
observerOptions
|
|
||||||
);
|
|
||||||
|
|
||||||
this.observer = observer;
|
Array.from(elements).forEach(element => {
|
||||||
};
|
observer.observe(element);
|
||||||
|
});
|
||||||
LazyLoader.prototype.addElements = function (elements) {
|
|
||||||
|
|
||||||
var observer = this.observer;
|
|
||||||
|
|
||||||
if (!observer) {
|
|
||||||
this.createObserver();
|
|
||||||
observer = this.observer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.elementCount = (this.elementCount || 0) + elements.length;
|
destroyObserver() {
|
||||||
|
const observer = this.observer;
|
||||||
|
|
||||||
for (var i = 0, length = elements.length; i < length; i++) {
|
if (observer) {
|
||||||
observer.observe(elements[i]);
|
observer.disconnect();
|
||||||
|
this.observer = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
LazyLoader.prototype.destroyObserver = function (elements) {
|
destroy() {
|
||||||
|
this.destroyObserver();
|
||||||
var observer = this.observer;
|
this.options = null;
|
||||||
|
|
||||||
if (observer) {
|
|
||||||
observer.disconnect();
|
|
||||||
this.observer = null;
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
LazyLoader.prototype.destroy = function (elements) {
|
|
||||||
|
|
||||||
this.destroyObserver();
|
|
||||||
this.options = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
function unveilElements(elements, root, callback) {
|
function unveilElements(elements, root, callback) {
|
||||||
|
|
||||||
if (!elements.length) {
|
if (!elements.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var lazyLoader = new LazyLoader({
|
const lazyLoader = new LazyLoader({
|
||||||
callback: callback
|
callback: callback
|
||||||
});
|
});
|
||||||
lazyLoader.addElements(elements);
|
lazyLoader.addElements(elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyLoader.lazyChildren = function (elem, callback) {
|
export function lazyChildren(elem, callback) {
|
||||||
|
|
||||||
unveilElements(elem.getElementsByClassName('lazy'), elem, callback);
|
unveilElements(elem.getElementsByClassName('lazy'), elem, callback);
|
||||||
};
|
}
|
||||||
|
|
||||||
return LazyLoader;
|
/* eslint-enable indent */
|
||||||
});
|
export default {
|
||||||
|
LazyLoader: LazyLoader,
|
||||||
|
lazyChildren: lazyChildren
|
||||||
|
};
|
||||||
|
|
|
@ -1,185 +0,0 @@
|
||||||
define(['visibleinviewport', 'dom', 'browser'], function (visibleinviewport, dom, browser) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var thresholdX;
|
|
||||||
var thresholdY;
|
|
||||||
|
|
||||||
function resetThresholds() {
|
|
||||||
|
|
||||||
var threshold = 0.3;
|
|
||||||
|
|
||||||
thresholdX = screen.availWidth * threshold;
|
|
||||||
thresholdY = screen.availHeight * threshold;
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetThresholdsOnTimer() {
|
|
||||||
|
|
||||||
setTimeout(resetThresholds, 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (browser.iOS) {
|
|
||||||
dom.addEventListener(window, 'orientationchange', resetThresholdsOnTimer, { passive: true });
|
|
||||||
dom.addEventListener(window, 'resize', resetThresholdsOnTimer, { passive: true });
|
|
||||||
} else {
|
|
||||||
dom.addEventListener(window, 'orientationchange', resetThresholds, { passive: true });
|
|
||||||
dom.addEventListener(window, 'resize', resetThresholds, { passive: true });
|
|
||||||
}
|
|
||||||
resetThresholds();
|
|
||||||
|
|
||||||
function isVisible(elem) {
|
|
||||||
return visibleinviewport(elem, true, thresholdX, thresholdY);
|
|
||||||
}
|
|
||||||
|
|
||||||
var wheelEvent = (document.implementation.hasFeature('Event.wheel', '3.0') ? 'wheel' : 'mousewheel');
|
|
||||||
var self = {};
|
|
||||||
|
|
||||||
function cancelAll(tokens) {
|
|
||||||
for (var i = 0, length = tokens.length; i < length; i++) {
|
|
||||||
|
|
||||||
tokens[i] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function unveilElementsInternal(instance, callback) {
|
|
||||||
|
|
||||||
var unveiledElements = [];
|
|
||||||
var cancellationTokens = [];
|
|
||||||
var loadedCount = 0;
|
|
||||||
|
|
||||||
function unveilInternal(tokenIndex) {
|
|
||||||
|
|
||||||
var anyFound = false;
|
|
||||||
var out = false;
|
|
||||||
|
|
||||||
var elements = instance.elements;
|
|
||||||
// TODO: This out construct assumes left to right, top to bottom
|
|
||||||
|
|
||||||
for (var i = 0, length = elements.length; i < length; i++) {
|
|
||||||
|
|
||||||
if (cancellationTokens[tokenIndex]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (unveiledElements[i]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
var elem = elements[i];
|
|
||||||
if (!out && isVisible(elem)) {
|
|
||||||
anyFound = true;
|
|
||||||
unveiledElements[i] = true;
|
|
||||||
callback(elem);
|
|
||||||
loadedCount++;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (anyFound) {
|
|
||||||
out = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (loadedCount >= elements.length) {
|
|
||||||
dom.removeEventListener(document, 'focus', unveil, {
|
|
||||||
capture: true,
|
|
||||||
passive: true
|
|
||||||
});
|
|
||||||
dom.removeEventListener(document, 'scroll', unveil, {
|
|
||||||
capture: true,
|
|
||||||
passive: true
|
|
||||||
});
|
|
||||||
dom.removeEventListener(document, wheelEvent, unveil, {
|
|
||||||
capture: true,
|
|
||||||
passive: true
|
|
||||||
});
|
|
||||||
dom.removeEventListener(window, 'resize', unveil, {
|
|
||||||
capture: true,
|
|
||||||
passive: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function unveil() {
|
|
||||||
|
|
||||||
cancelAll(cancellationTokens);
|
|
||||||
|
|
||||||
var index = cancellationTokens.length;
|
|
||||||
cancellationTokens.length++;
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
unveilInternal(index);
|
|
||||||
}, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
dom.addEventListener(document, 'focus', unveil, {
|
|
||||||
capture: true,
|
|
||||||
passive: true
|
|
||||||
});
|
|
||||||
dom.addEventListener(document, 'scroll', unveil, {
|
|
||||||
capture: true,
|
|
||||||
passive: true
|
|
||||||
});
|
|
||||||
dom.addEventListener(document, wheelEvent, unveil, {
|
|
||||||
capture: true,
|
|
||||||
passive: true
|
|
||||||
});
|
|
||||||
dom.addEventListener(window, 'resize', unveil, {
|
|
||||||
capture: true,
|
|
||||||
passive: true
|
|
||||||
});
|
|
||||||
|
|
||||||
unveil();
|
|
||||||
}
|
|
||||||
|
|
||||||
function LazyLoader(options) {
|
|
||||||
|
|
||||||
this.options = options;
|
|
||||||
}
|
|
||||||
|
|
||||||
LazyLoader.prototype.createObserver = function () {
|
|
||||||
|
|
||||||
unveilElementsInternal(this, this.options.callback);
|
|
||||||
this.observer = 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
LazyLoader.prototype.addElements = function (elements) {
|
|
||||||
|
|
||||||
this.elements = this.elements || [];
|
|
||||||
|
|
||||||
for (var i = 0, length = elements.length; i < length; i++) {
|
|
||||||
this.elements.push(elements[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
var observer = this.observer;
|
|
||||||
|
|
||||||
if (!observer) {
|
|
||||||
this.createObserver();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
LazyLoader.prototype.destroyObserver = function (elements) {
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
LazyLoader.prototype.destroy = function (elements) {
|
|
||||||
|
|
||||||
this.destroyObserver();
|
|
||||||
this.options = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
function unveilElements(elements, root, callback) {
|
|
||||||
|
|
||||||
if (!elements.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var lazyLoader = new LazyLoader({
|
|
||||||
callback: callback
|
|
||||||
});
|
|
||||||
lazyLoader.addElements(elements);
|
|
||||||
}
|
|
||||||
|
|
||||||
LazyLoader.lazyChildren = function (elem, callback) {
|
|
||||||
|
|
||||||
unveilElements(elem.getElementsByClassName('lazy'), elem, callback);
|
|
||||||
};
|
|
||||||
|
|
||||||
return LazyLoader;
|
|
||||||
});
|
|
|
@ -487,7 +487,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
|
||||||
tag: item.ImageTags.Thumb
|
tag: item.ImageTags.Thumb
|
||||||
});
|
});
|
||||||
page.classList.remove('noBackdrop');
|
page.classList.remove('noBackdrop');
|
||||||
imageLoader.lazyImage(itemBackdropElement, imgUrl, false);
|
imageLoader.lazyImage(itemBackdropElement, imgUrl);
|
||||||
hasbackdrop = true;
|
hasbackdrop = true;
|
||||||
} else if (usePrimaryImage && item.ImageTags && item.ImageTags.Primary) {
|
} else if (usePrimaryImage && item.ImageTags && item.ImageTags.Primary) {
|
||||||
imgUrl = apiClient.getScaledImageUrl(item.Id, {
|
imgUrl = apiClient.getScaledImageUrl(item.Id, {
|
||||||
|
@ -497,7 +497,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
|
||||||
tag: item.ImageTags.Primary
|
tag: item.ImageTags.Primary
|
||||||
});
|
});
|
||||||
page.classList.remove('noBackdrop');
|
page.classList.remove('noBackdrop');
|
||||||
imageLoader.lazyImage(itemBackdropElement, imgUrl, false);
|
imageLoader.lazyImage(itemBackdropElement, imgUrl);
|
||||||
hasbackdrop = true;
|
hasbackdrop = true;
|
||||||
} else if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
} else if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||||
imgUrl = apiClient.getScaledImageUrl(item.Id, {
|
imgUrl = apiClient.getScaledImageUrl(item.Id, {
|
||||||
|
@ -507,7 +507,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
|
||||||
tag: item.BackdropImageTags[0]
|
tag: item.BackdropImageTags[0]
|
||||||
});
|
});
|
||||||
page.classList.remove('noBackdrop');
|
page.classList.remove('noBackdrop');
|
||||||
imageLoader.lazyImage(itemBackdropElement, imgUrl, false);
|
imageLoader.lazyImage(itemBackdropElement, imgUrl);
|
||||||
hasbackdrop = true;
|
hasbackdrop = true;
|
||||||
} else if (item.ParentBackdropItemId && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length) {
|
} else if (item.ParentBackdropItemId && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length) {
|
||||||
imgUrl = apiClient.getScaledImageUrl(item.ParentBackdropItemId, {
|
imgUrl = apiClient.getScaledImageUrl(item.ParentBackdropItemId, {
|
||||||
|
@ -517,7 +517,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
|
||||||
tag: item.ParentBackdropImageTags[0]
|
tag: item.ParentBackdropImageTags[0]
|
||||||
});
|
});
|
||||||
page.classList.remove('noBackdrop');
|
page.classList.remove('noBackdrop');
|
||||||
imageLoader.lazyImage(itemBackdropElement, imgUrl, false);
|
imageLoader.lazyImage(itemBackdropElement, imgUrl);
|
||||||
hasbackdrop = true;
|
hasbackdrop = true;
|
||||||
} else if (item.ImageTags && item.ImageTags.Thumb) {
|
} else if (item.ImageTags && item.ImageTags.Thumb) {
|
||||||
imgUrl = apiClient.getScaledImageUrl(item.Id, {
|
imgUrl = apiClient.getScaledImageUrl(item.Id, {
|
||||||
|
@ -527,7 +527,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
|
||||||
tag: item.ImageTags.Thumb
|
tag: item.ImageTags.Thumb
|
||||||
});
|
});
|
||||||
page.classList.remove('noBackdrop');
|
page.classList.remove('noBackdrop');
|
||||||
imageLoader.lazyImage(itemBackdropElement, imgUrl, false);
|
imageLoader.lazyImage(itemBackdropElement, imgUrl);
|
||||||
hasbackdrop = true;
|
hasbackdrop = true;
|
||||||
} else {
|
} else {
|
||||||
itemBackdropElement.style.backgroundImage = '';
|
itemBackdropElement.style.backgroundImage = '';
|
||||||
|
|
|
@ -50,7 +50,8 @@ define(['layoutManager', 'loading', 'libraryBrowser', 'cardBuilder', 'lazyLoader
|
||||||
return enableScrollX() ? 'overflowPortrait' : 'portrait';
|
return enableScrollX() ? 'overflowPortrait' : 'portrait';
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillItemsContainer(elem) {
|
function fillItemsContainer(entry) {
|
||||||
|
var elem = entry.target;
|
||||||
var id = elem.getAttribute('data-id');
|
var id = elem.getAttribute('data-id');
|
||||||
var viewStyle = self.getCurrentViewStyle();
|
var viewStyle = self.getCurrentViewStyle();
|
||||||
var limit = 'Thumb' == viewStyle || 'ThumbCard' == viewStyle ? 5 : 9;
|
var limit = 'Thumb' == viewStyle || 'ThumbCard' == viewStyle ? 5 : 9;
|
||||||
|
|
|
@ -50,7 +50,8 @@ define(['layoutManager', 'loading', 'libraryBrowser', 'cardBuilder', 'lazyLoader
|
||||||
return enableScrollX() ? 'overflowPortrait' : 'portrait';
|
return enableScrollX() ? 'overflowPortrait' : 'portrait';
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillItemsContainer(elem) {
|
function fillItemsContainer(entry) {
|
||||||
|
var elem = entry.target;
|
||||||
var id = elem.getAttribute('data-id');
|
var id = elem.getAttribute('data-id');
|
||||||
var viewStyle = self.getCurrentViewStyle();
|
var viewStyle = self.getCurrentViewStyle();
|
||||||
var limit = 'Thumb' == viewStyle || 'ThumbCard' == viewStyle ? 5 : 9;
|
var limit = 'Thumb' == viewStyle || 'ThumbCard' == viewStyle ? 5 : 9;
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
define(['dom'], function (dom) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copyright 2012, Digital Fusion
|
|
||||||
* Licensed under the MIT license.
|
|
||||||
* http://teamdf.com/jquery-plugins/license/
|
|
||||||
*
|
|
||||||
* @author Sam Sehnert
|
|
||||||
* @desc A small plugin that checks whether elements are within
|
|
||||||
* the user visible viewport of a web browser.
|
|
||||||
* only accounts for vertical position, not horizontal.
|
|
||||||
*/
|
|
||||||
function visibleInViewport(elem, partial, thresholdX, thresholdY) {
|
|
||||||
|
|
||||||
thresholdX = thresholdX || 0;
|
|
||||||
thresholdY = thresholdY || 0;
|
|
||||||
|
|
||||||
if (!elem.getBoundingClientRect) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var windowSize = dom.getWindowSize();
|
|
||||||
|
|
||||||
var vpWidth = windowSize.innerWidth;
|
|
||||||
var vpHeight = windowSize.innerHeight;
|
|
||||||
|
|
||||||
// Use this native browser method, if available.
|
|
||||||
var rec = elem.getBoundingClientRect();
|
|
||||||
var tViz = rec.top >= 0 && rec.top < vpHeight + thresholdY;
|
|
||||||
var bViz = rec.bottom > 0 && rec.bottom <= vpHeight + thresholdY;
|
|
||||||
var lViz = rec.left >= 0 && rec.left < vpWidth + thresholdX;
|
|
||||||
var rViz = rec.right > 0 && rec.right <= vpWidth + thresholdX;
|
|
||||||
var vVisible = partial ? tViz || bViz : tViz && bViz;
|
|
||||||
var hVisible = partial ? lViz || rViz : lViz && rViz;
|
|
||||||
|
|
||||||
return vVisible && hVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
return visibleInViewport;
|
|
||||||
});
|
|
|
@ -265,3 +265,33 @@ import events from 'events';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-enable indent */
|
/* eslint-enable indent */
|
||||||
|
export default {
|
||||||
|
setUserInfo: setUserInfo,
|
||||||
|
getData: getData,
|
||||||
|
importFrom: importFrom,
|
||||||
|
set: set,
|
||||||
|
get: get,
|
||||||
|
serverConfig: serverConfig,
|
||||||
|
enableCinemaMode: enableCinemaMode,
|
||||||
|
enableNextVideoInfoOverlay: enableNextVideoInfoOverlay,
|
||||||
|
enableThemeSongs: enableThemeSongs,
|
||||||
|
enableThemeVideos: enableThemeVideos,
|
||||||
|
enableFastFadein: enableFastFadein,
|
||||||
|
enableBackdrops: enableBackdrops,
|
||||||
|
language: language,
|
||||||
|
dateTimeLocale: dateTimeLocale,
|
||||||
|
skipBackLength: skipBackLength,
|
||||||
|
skipForwardLength: skipForwardLength,
|
||||||
|
dashboardTheme: dashboardTheme,
|
||||||
|
skin: skin,
|
||||||
|
theme: theme,
|
||||||
|
screensaver: screensaver,
|
||||||
|
libraryPageSize: libraryPageSize,
|
||||||
|
soundEffects: soundEffects,
|
||||||
|
loadQuerySettings: loadQuerySettings,
|
||||||
|
saveQuerySettings: saveQuerySettings,
|
||||||
|
getSubtitleAppearanceSettings: getSubtitleAppearanceSettings,
|
||||||
|
setSubtitleAppearanceSettings: setSubtitleAppearanceSettings,
|
||||||
|
setFilter: setFilter,
|
||||||
|
getFilter: getFilter
|
||||||
|
};
|
||||||
|
|
|
@ -375,12 +375,7 @@ var AppInfo = {};
|
||||||
|
|
||||||
define('filesystem', [scriptsPath + '/filesystem'], returnFirstDependency);
|
define('filesystem', [scriptsPath + '/filesystem'], returnFirstDependency);
|
||||||
|
|
||||||
if (window.IntersectionObserver && !browser.edge) {
|
define('lazyLoader', [componentsPath + '/lazyloader/lazyloader-intersectionobserver'], returnFirstDependency);
|
||||||
define('lazyLoader', [componentsPath + '/lazyloader/lazyloader-intersectionobserver'], returnFirstDependency);
|
|
||||||
} else {
|
|
||||||
define('lazyLoader', [componentsPath + '/lazyloader/lazyloader-scroll'], returnFirstDependency);
|
|
||||||
}
|
|
||||||
|
|
||||||
define('shell', [componentsPath + '/shell'], returnFirstDependency);
|
define('shell', [componentsPath + '/shell'], returnFirstDependency);
|
||||||
|
|
||||||
define('apiclient', [bowerPath + '/apiclient/apiclient'], returnFirstDependency);
|
define('apiclient', [bowerPath + '/apiclient/apiclient'], returnFirstDependency);
|
||||||
|
@ -393,13 +388,10 @@ var AppInfo = {};
|
||||||
define('registerElement', ['document-register-element'], returnFirstDependency);
|
define('registerElement', ['document-register-element'], returnFirstDependency);
|
||||||
}
|
}
|
||||||
|
|
||||||
define('imageFetcher', [componentsPath + '/images/imageFetcher'], returnFirstDependency);
|
|
||||||
|
|
||||||
var preferNativeAlerts = browser.tv;
|
|
||||||
|
|
||||||
define('alert', [componentsPath + '/alert'], returnFirstDependency);
|
define('alert', [componentsPath + '/alert'], returnFirstDependency);
|
||||||
|
|
||||||
defineResizeObserver();
|
defineResizeObserver();
|
||||||
|
|
||||||
define('dialog', [componentsPath + '/dialog/dialog'], returnFirstDependency);
|
define('dialog', [componentsPath + '/dialog/dialog'], returnFirstDependency);
|
||||||
|
|
||||||
define('confirm', [componentsPath + '/confirm/confirm'], returnFirstDependency);
|
define('confirm', [componentsPath + '/confirm/confirm'], returnFirstDependency);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue