1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

rework storage of PresentationUniqueKey

This commit is contained in:
Luke Pulverenti 2016-08-12 15:11:45 -04:00
parent b2fa34662d
commit b6e47ab6ec
6 changed files with 21 additions and 96 deletions

View file

@ -32,7 +32,6 @@
.emby-button.raised {
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
text-transform: none;
}
.emby-button.fab {

View file

@ -13,7 +13,6 @@
padding: .25em 1.15em;
line-height: 160%;
cursor: pointer;
white-space: nowrap;
overflow: hidden;
}

View file

@ -10,12 +10,7 @@
/* exported features */
var features = {
bind: !!(function () { }.bind),
classList: 'classList' in document.documentElement,
rAF: !!(window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame)
};
window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
/**
* Handles debouncing of events via requestAnimationFrame
@ -158,9 +153,6 @@
* Initialises the widget
*/
init: function () {
if (!Headroom.cutsTheMustard) {
return;
}
this.elem.classList.add(this.classes.initial);
@ -262,77 +254,18 @@
* @return {Number} pixels the page has scrolled along the Y-axis
*/
getScrollY: function () {
return (this.scroller.pageYOffset !== undefined)
? this.scroller.pageYOffset
: (this.scroller.scrollTop !== undefined)
? this.scroller.scrollTop
: (document.documentElement || document.body.parentNode || document.body).scrollTop;
},
/**
* Gets the height of the viewport
* @see http://andylangton.co.uk/blog/development/get-viewport-size-width-and-height-javascript
* @return {int} the height of the viewport in pixels
*/
getViewportHeight: function () {
return window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;
},
/**
* Gets the height of the document
* @see http://james.padolsey.com/javascript/get-document-height-cross-browser/
* @return {int} the height of the document in pixels
*/
getDocumentHeight: function () {
var body = document.body,
documentElement = document.documentElement;
return Math.max(
body.scrollHeight, documentElement.scrollHeight,
body.offsetHeight, documentElement.offsetHeight,
body.clientHeight, documentElement.clientHeight
);
},
/**
* Gets the height of the DOM element
* @param {Object} elm the element to calculate the height of which
* @return {int} the height of the element in pixels
*/
getElementHeight: function (elm) {
return Math.max(
elm.scrollHeight,
elm.offsetHeight,
elm.clientHeight
);
},
/**
* Gets the height of the scroller element
* @return {int} the height of the scroller element in pixels
*/
getScrollerHeight: function () {
return (this.scroller === window || this.scroller === document.body)
? this.getDocumentHeight()
: this.getElementHeight(this.scroller);
},
/**
* determines if the scroll position is outside of document boundaries
* @param {int} currentScrollY the current y scroll position
* @return {bool} true if out of bounds, false otherwise
*/
isOutOfBounds: function (currentScrollY) {
var pastTop = currentScrollY < 0;
if (pastTop) {
return true;
var pageYOffset = this.scroller.pageYOffset;
if (pageYOffset !== undefined) {
return pageYOffset;
}
var pastBottom = currentScrollY + this.getViewportHeight() > this.getScrollerHeight();
return pastBottom;
var scrollTop = this.scroller.scrollTop;
if (scrollTop !== undefined) {
return scrollTop;
}
return (document.documentElement || document.body).scrollTop;
},
/**
@ -378,14 +311,16 @@
scrollDirection = currentScrollY > this.lastKnownScrollY ? 'down' : 'up',
toleranceExceeded = this.toleranceExceeded(currentScrollY, scrollDirection);
if (this.isOutOfBounds(currentScrollY)) { // Ignore bouncy scrolling in OSX
if (currentScrollY < 0) { // Ignore bouncy scrolling in OSX
return;
}
if (currentScrollY <= this.offset) {
this.top();
} else {
this.notTop();
if (this.enableTopClasses) {
if (currentScrollY <= this.offset) {
this.top();
} else {
this.notTop();
}
}
if (this.shouldUnpin(currentScrollY, toleranceExceeded)) {
@ -417,7 +352,6 @@
initial: 'headroom'
}
};
Headroom.cutsTheMustard = typeof features !== 'undefined' && features.rAF && features.bind && features.classList;
window.Headroom = Headroom;

View file

@ -98,7 +98,8 @@
scalable: true,
overlayPlayButton: section.overlayPlayButton,
overlayMoreButton: section.overlayMoreButton,
action: section.action
action: section.action,
allowBottomPadding: !enableScrollX()
});
html += '</div>';

View file

@ -150,12 +150,8 @@
requestAnimationFrame(function () {
if (pos) {
options.target.style.transform = 'translate3d(' + pos + 'px, 0, 0)';
options.target.style.WebkitTransform = 'translate3d(' + pos + 'px, 0, 0)';
options.target.style.MozTransform = 'translate3d(' + pos + 'px, 0, 0)';
} else {
options.target.style.transform = 'none';
options.target.style.WebkitTransform = 'none';
options.target.style.MozTransform = 'none';
}
});
};

View file

@ -197,22 +197,18 @@ div[data-role='page'] {
* Adding them is left as an exercise for the reader.
*/
.headroom {
-webkit-transition: transform 200ms linear;
transition: transform 200ms linear;
transition: transform 180ms linear;
}
.headroom--pinned {
-webkit-transform: translateY(0%);
transform: translateY(0%);
transform: none;
}
.headroom--unpinned:not(.headroomDisabled) {
-webkit-transform: translateY(-100%);
transform: translateY(-100%);
}
.libraryViewNav.headroom--unpinned:not(.headroomDisabled) {
-webkit-transform: translateY(-210%);
transform: translateY(-210%);
}