1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
This commit is contained in:
Luke Pulverenti 2017-01-27 18:07:14 -05:00
parent 82bcca376f
commit 8a6884abef
494 changed files with 256 additions and 120180 deletions

View file

@ -1,41 +1 @@
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,
vpHeight = windowSize.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;
}
return visibleInViewport;
});
define(["dom"],function(dom){"use strict";function visibleInViewport(elem,partial,thresholdX,thresholdY){if(thresholdX=thresholdX||0,thresholdY=thresholdY||0,!elem.getBoundingClientRect)return!0;var windowSize=dom.getWindowSize(),vpWidth=windowSize.innerWidth,vpHeight=windowSize.innerHeight,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}return visibleInViewport});