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 { .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); 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 { .emby-button.fab {

View file

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

View file

@ -10,12 +10,7 @@
/* exported features */ /* exported features */
var features = { var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
bind: !!(function () { }.bind),
classList: 'classList' in document.documentElement,
rAF: !!(window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame)
};
window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
/** /**
* Handles debouncing of events via requestAnimationFrame * Handles debouncing of events via requestAnimationFrame
@ -158,9 +153,6 @@
* Initialises the widget * Initialises the widget
*/ */
init: function () { init: function () {
if (!Headroom.cutsTheMustard) {
return;
}
this.elem.classList.add(this.classes.initial); this.elem.classList.add(this.classes.initial);
@ -262,77 +254,18 @@
* @return {Number} pixels the page has scrolled along the Y-axis * @return {Number} pixels the page has scrolled along the Y-axis
*/ */
getScrollY: function () { 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;
},
/** var pageYOffset = this.scroller.pageYOffset;
* Gets the height of the viewport if (pageYOffset !== undefined) {
* @see http://andylangton.co.uk/blog/development/get-viewport-size-width-and-height-javascript return pageYOffset;
* @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 pastBottom = currentScrollY + this.getViewportHeight() > this.getScrollerHeight(); var scrollTop = this.scroller.scrollTop;
return pastBottom; if (scrollTop !== undefined) {
return scrollTop;
}
return (document.documentElement || document.body).scrollTop;
}, },
/** /**
@ -378,15 +311,17 @@
scrollDirection = currentScrollY > this.lastKnownScrollY ? 'down' : 'up', scrollDirection = currentScrollY > this.lastKnownScrollY ? 'down' : 'up',
toleranceExceeded = this.toleranceExceeded(currentScrollY, scrollDirection); toleranceExceeded = this.toleranceExceeded(currentScrollY, scrollDirection);
if (this.isOutOfBounds(currentScrollY)) { // Ignore bouncy scrolling in OSX if (currentScrollY < 0) { // Ignore bouncy scrolling in OSX
return; return;
} }
if (this.enableTopClasses) {
if (currentScrollY <= this.offset) { if (currentScrollY <= this.offset) {
this.top(); this.top();
} else { } else {
this.notTop(); this.notTop();
} }
}
if (this.shouldUnpin(currentScrollY, toleranceExceeded)) { if (this.shouldUnpin(currentScrollY, toleranceExceeded)) {
this.unpin(); this.unpin();
@ -417,7 +352,6 @@
initial: 'headroom' initial: 'headroom'
} }
}; };
Headroom.cutsTheMustard = typeof features !== 'undefined' && features.rAF && features.bind && features.classList;
window.Headroom = Headroom; window.Headroom = Headroom;

View file

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

View file

@ -150,12 +150,8 @@
requestAnimationFrame(function () { requestAnimationFrame(function () {
if (pos) { if (pos) {
options.target.style.transform = 'translate3d(' + pos + 'px, 0, 0)'; 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 { } else {
options.target.style.transform = 'none'; 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. * Adding them is left as an exercise for the reader.
*/ */
.headroom { .headroom {
-webkit-transition: transform 200ms linear; transition: transform 180ms linear;
transition: transform 200ms linear;
} }
.headroom--pinned { .headroom--pinned {
-webkit-transform: translateY(0%); transform: none;
transform: translateY(0%);
} }
.headroom--unpinned:not(.headroomDisabled) { .headroom--unpinned:not(.headroomDisabled) {
-webkit-transform: translateY(-100%);
transform: translateY(-100%); transform: translateY(-100%);
} }
.libraryViewNav.headroom--unpinned:not(.headroomDisabled) { .libraryViewNav.headroom--unpinned:not(.headroomDisabled) {
-webkit-transform: translateY(-210%);
transform: translateY(-210%); transform: translateY(-210%);
} }