mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
use visibleinviewport
This commit is contained in:
parent
7e639dbf67
commit
378cb21558
2 changed files with 12 additions and 57 deletions
|
@ -1842,6 +1842,7 @@ var AppInfo = {};
|
||||||
credentialprovider: apiClientBowerPath + '/credentials',
|
credentialprovider: apiClientBowerPath + '/credentials',
|
||||||
apiclient: apiClientBowerPath + '/apiclient',
|
apiclient: apiClientBowerPath + '/apiclient',
|
||||||
connectionmanagerfactory: apiClientBowerPath + '/connectionmanager',
|
connectionmanagerfactory: apiClientBowerPath + '/connectionmanager',
|
||||||
|
visibleinviewport: embyWebComponentsBowerPath + "/visibleinviewport",
|
||||||
browserdeviceprofile: embyWebComponentsBowerPath + "/browserdeviceprofile",
|
browserdeviceprofile: embyWebComponentsBowerPath + "/browserdeviceprofile",
|
||||||
browser: embyWebComponentsBowerPath + "/browser",
|
browser: embyWebComponentsBowerPath + "/browser",
|
||||||
qualityoptions: embyWebComponentsBowerPath + "/qualityoptions",
|
qualityoptions: embyWebComponentsBowerPath + "/qualityoptions",
|
||||||
|
|
68
dashboard-ui/thirdparty/jquery.unveil-custom.js
vendored
68
dashboard-ui/thirdparty/jquery.unveil-custom.js
vendored
|
@ -1,51 +1,11 @@
|
||||||
/**
|
define(['visibleinviewport'], function (visibleInViewport) {
|
||||||
* jQuery Unveil
|
|
||||||
* A very lightweight jQuery plugin to lazy load images
|
|
||||||
* http://luis-almeida.github.com/unveil
|
|
||||||
*
|
|
||||||
* Licensed under the MIT license.
|
|
||||||
* Copyright 2013 Luís Almeida
|
|
||||||
* https://github.com/luis-almeida
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var thresholdX = screen.availWidth || 0;
|
|
||||||
var thresholdY = screen.availHeight || 0;
|
|
||||||
var wheelEvent = (document.implementation.hasFeature('Event.wheel', '3.0') ? 'wheel' : 'mousewheel');
|
var wheelEvent = (document.implementation.hasFeature('Event.wheel', '3.0') ? 'wheel' : 'mousewheel');
|
||||||
|
var thresholdX = screen.availWidth;
|
||||||
function visibleInViewport(elem, partial) {
|
var thresholdY = screen.availHeight;
|
||||||
|
|
||||||
var vpWidth = window.innerWidth,
|
|
||||||
vpHeight = window.innerHeight;
|
|
||||||
|
|
||||||
// Use this native browser method, if available.
|
|
||||||
var rec = elem.getBoundingClientRect(),
|
|
||||||
tViz = rec.top >= 0 && rec.top < vpHeight + thresholdY,
|
|
||||||
bViz = rec.bottom > 0 && rec.bottom <= vpHeight + thresholdY,
|
|
||||||
lViz = rec.left >= 0 && rec.left < vpWidth + thresholdX,
|
|
||||||
rViz = rec.right > 0 && rec.right <= vpWidth + thresholdX,
|
|
||||||
vVisible = partial ? tViz || bViz : tViz && bViz,
|
|
||||||
hVisible = partial ? lViz || rViz : lViz && rViz;
|
|
||||||
|
|
||||||
return vVisible && hVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
var unveilId = 0;
|
|
||||||
|
|
||||||
function isVisible(elem) {
|
function isVisible(elem) {
|
||||||
return visibleInViewport(elem, true);
|
return visibleInViewport(elem, true, thresholdX, thresholdY);
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillImage(elem) {
|
function fillImage(elem) {
|
||||||
|
@ -64,8 +24,6 @@
|
||||||
|
|
||||||
var images = elems;
|
var images = elems;
|
||||||
|
|
||||||
unveilId++;
|
|
||||||
|
|
||||||
function unveil() {
|
function unveil() {
|
||||||
|
|
||||||
var remaining = [];
|
var remaining = [];
|
||||||
|
@ -118,16 +76,6 @@
|
||||||
fillImages([elem]);
|
fillImages([elem]);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.ImageLoader = {
|
|
||||||
fillImages: fillImages,
|
|
||||||
lazyImage: lazyImage,
|
|
||||||
lazyChildren: lazyChildren
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
|
|
||||||
function setImageIntoElement(elem, url) {
|
function setImageIntoElement(elem, url) {
|
||||||
|
|
||||||
if (elem.tagName !== "IMG") {
|
if (elem.tagName !== "IMG") {
|
||||||
|
@ -163,4 +111,10 @@
|
||||||
|
|
||||||
window.ImageStore = new simpleImageStore();
|
window.ImageStore = new simpleImageStore();
|
||||||
|
|
||||||
})();
|
window.ImageLoader = {
|
||||||
|
fillImages: fillImages,
|
||||||
|
lazyImage: lazyImage,
|
||||||
|
lazyChildren: lazyChildren
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue