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

limit resume to 8

This commit is contained in:
Luke Pulverenti 2016-03-08 13:47:36 -05:00
parent dd2b5bc15e
commit fb269362ff
7 changed files with 62 additions and 25 deletions

View file

@ -15,12 +15,12 @@
}, },
"devDependencies": {}, "devDependencies": {},
"ignore": [], "ignore": [],
"version": "1.1.25", "version": "1.1.26",
"_release": "1.1.25", "_release": "1.1.26",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.1.25", "tag": "1.1.26",
"commit": "0b6a10525c2143ac953dd9f8229e5eab2c2055bf" "commit": "3cee1dd4f0c0b8727fbd8e03c77b989100082faa"
}, },
"_source": "git://github.com/MediaBrowser/emby-webcomponents.git", "_source": "git://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "~1.1.5", "_target": "~1.1.5",

View file

@ -1,5 +1,29 @@
define(['isMobile'], function (isMobile) { define(['isMobile'], function (isMobile) {
function isTv() {
// This is going to be really difficult to get right
var userAgent = navigator.userAgent.toLowerCase();
if (userAgent.indexOf('tv') != -1) {
return true;
}
if (userAgent.indexOf('samsung') != -1) {
return true;
}
if (userAgent.indexOf('nintendo') != -1) {
return true;
}
if (userAgent.indexOf('viera') != -1) {
return true;
}
return false;
}
var uaMatch = function (ua) { var uaMatch = function (ua) {
ua = ua.toLowerCase(); ua = ua.toLowerCase();
@ -68,5 +92,7 @@
browser.xboxOne = userAgent.toLowerCase().indexOf('xbox') != -1; browser.xboxOne = userAgent.toLowerCase().indexOf('xbox') != -1;
browser.animate = document.documentElement.animate != null; browser.animate = document.documentElement.animate != null;
browser.tv = isTv();
return browser; return browser;
}); });

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-overlay-behavior", "name": "iron-overlay-behavior",
"version": "1.4.1", "version": "1.4.2",
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for making an element an overlay", "description": "Provides a behavior for making an element an overlay",
"private": true, "private": true,
@ -35,11 +35,11 @@
}, },
"ignore": [], "ignore": [],
"homepage": "https://github.com/polymerelements/iron-overlay-behavior", "homepage": "https://github.com/polymerelements/iron-overlay-behavior",
"_release": "1.4.1", "_release": "1.4.2",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.4.1", "tag": "v1.4.2",
"commit": "4aefb7bc41aecef69022d6435133c430fc52d3ba" "commit": "565869d04433fb1065210ca30d81e7b7c4af73f8"
}, },
"_source": "git://github.com/polymerelements/iron-overlay-behavior.git", "_source": "git://github.com/polymerelements/iron-overlay-behavior.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-overlay-behavior", "name": "iron-overlay-behavior",
"version": "1.4.1", "version": "1.4.2",
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"description": "Provides a behavior for making an element an overlay", "description": "Provides a behavior for making an element an overlay",
"private": true, "private": true,

View file

@ -243,6 +243,8 @@ context. You should place this element as a child of `<body>` whenever possible.
}, },
ready: function() { ready: function() {
// Used to skip calls to notifyResize and refit while the overlay is animating.
this.__isAnimating = false;
// with-backdrop needs tabindex to be set in order to trap the focus. // with-backdrop needs tabindex to be set in order to trap the focus.
// If it is not set, IronOverlayBehavior will set it, and remove it if with-backdrop = false. // If it is not set, IronOverlayBehavior will set it, and remove it if with-backdrop = false.
this.__shouldRemoveTabIndex = false; this.__shouldRemoveTabIndex = false;
@ -328,6 +330,7 @@ context. You should place this element as a child of `<body>` whenever possible.
this._manager.trackBackdrop(this); this._manager.trackBackdrop(this);
this.__isAnimating = true;
if (this.opened) { if (this.opened) {
this._prepareRenderOpened(); this._prepareRenderOpened();
} }
@ -410,7 +413,7 @@ context. You should place this element as a child of `<body>` whenever possible.
// Needed to calculate the size of the overlay so that transitions on its size // Needed to calculate the size of the overlay so that transitions on its size
// will have the correct starting points. // will have the correct starting points.
this._preparePositioning(); this._preparePositioning();
this.fit(); this.refit();
this._finishPositioning(); this._finishPositioning();
if (this.withBackdrop) { if (this.withBackdrop) {
@ -441,24 +444,23 @@ context. You should place this element as a child of `<body>` whenever possible.
}, },
_finishRenderOpened: function() { _finishRenderOpened: function() {
// This ensures the overlay is visible before we set the focus
// (by calling _onIronResize -> refit).
this.notifyResize();
// Focus the child node with [autofocus] // Focus the child node with [autofocus]
this._applyFocus(); this._applyFocus();
this.notifyResize();
this.__isAnimating = false;
this.fire('iron-overlay-opened'); this.fire('iron-overlay-opened');
}, },
_finishRenderClosed: function() { _finishRenderClosed: function() {
// Hide the overlay and remove the backdrop. // Hide the overlay and remove the backdrop.
this.resetFit();
this.style.display = 'none'; this.style.display = 'none';
this._manager.removeOverlay(this); this._manager.removeOverlay(this);
this._applyFocus(); this._applyFocus();
this.notifyResize();
this.notifyResize();
this.__isAnimating = false;
this.fire('iron-overlay-closed', this.closingReason); this.fire('iron-overlay-closed', this.closingReason);
}, },
@ -513,6 +515,10 @@ context. You should place this element as a child of `<body>` whenever possible.
}, },
_onIronResize: function() { _onIronResize: function() {
if (this.__isAnimating) {
return;
}
if (this.opened) { if (this.opened) {
this.refit(); this.refit();
} }
@ -524,7 +530,7 @@ context. You should place this element as a child of `<body>` whenever possible.
* Can be overridden in order to avoid multiple observers on the same node. * Can be overridden in order to avoid multiple observers on the same node.
*/ */
_onNodesChange: function() { _onNodesChange: function() {
if (this.opened) { if (this.opened && !this.__isAnimating) {
this.notifyResize(); this.notifyResize();
} }
// Store it so we don't query too much. // Store it so we don't query too much.

View file

@ -165,8 +165,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}); });
test('open() triggers iron-resize', function(done) { test('open() triggers iron-resize', function(done) {
// Ignore the iron-resize on attached. var callCount = 0;
var callCount = -1;
// Ignore iron-resize triggered by window resize. // Ignore iron-resize triggered by window resize.
window.addEventListener('resize', function() { callCount--; }, true); window.addEventListener('resize', function() { callCount--; }, true);
overlay.addEventListener('iron-resize', function() { callCount++; }); overlay.addEventListener('iron-resize', function() { callCount++; });
@ -353,16 +352,22 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
test('overlay positioned & sized properly', function(done) { test('overlay positioned & sized properly', function(done) {
overlay.addEventListener('iron-overlay-opened', function() { overlay.addEventListener('iron-overlay-opened', function() {
var s = getComputedStyle(overlay); var s = getComputedStyle(overlay);
assert.equal(parseFloat(s.left), (window.innerWidth - overlay.offsetWidth) / 2, 'centered horizontally'); assert.closeTo(parseFloat(s.left), (window.innerWidth - overlay.offsetWidth) / 2, 1, 'centered horizontally');
assert.equal(parseFloat(s.top), (window.innerHeight - overlay.offsetHeight) / 2, 'centered vertically'); assert.closeTo(parseFloat(s.top), (window.innerHeight - overlay.offsetHeight) / 2, 1, 'centered vertically');
done(); done();
}); });
}); });
test('open overlay refits on iron-resize', function() { test('open overlay refits on iron-resize', function(done) {
var spy = sinon.spy(overlay, 'refit'); var spy = sinon.spy(overlay, 'refit');
// At this point, overlay is still opening.
overlay.fire('iron-resize'); overlay.fire('iron-resize');
assert.isTrue(spy.called, 'overlay should refit'); assert.isFalse(spy.called, 'overlay did not refit while animating');
overlay.addEventListener('iron-overlay-opened', function() {
overlay.fire('iron-resize');
assert.isTrue(spy.called, 'overlay did refit');
done();
});
}); });
}); });
@ -664,10 +669,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
test('backdrop is removed when toggling overlay opened', function(done) { test('backdrop is removed when toggling overlay opened', function(done) {
overlay.open(); overlay.open();
assert.isObject(overlay.backdropElement.parentNode, 'backdrop is immediately inserted in the document'); assert.isOk(overlay.backdropElement.parentNode, 'backdrop is immediately inserted in the document');
runAfterClose(overlay, function() { runAfterClose(overlay, function() {
assert.isFalse(overlay.backdropElement.opened, 'backdrop is closed'); assert.isFalse(overlay.backdropElement.opened, 'backdrop is closed');
assert.isNotObject(overlay.backdropElement.parentNode, 'backdrop is removed from document'); assert.isNotOk(overlay.backdropElement.parentNode, 'backdrop is removed from document');
done(); done();
}); });
}); });

View file

@ -418,7 +418,7 @@
SortOrder: "Descending", SortOrder: "Descending",
MediaTypes: "Video", MediaTypes: "Video",
Filters: "IsResumable", Filters: "IsResumable",
Limit: screenWidth >= 1920 ? 10 : (screenWidth >= 1600 ? 8 : (screenWidth >= 1200 ? 9 : 6)), Limit: screenWidth >= 1920 ? 8 : (screenWidth >= 1600 ? 8 : (screenWidth >= 1200 ? 9 : 6)),
Recursive: true, Recursive: true,
Fields: "PrimaryImageAspectRatio,SyncInfo", Fields: "PrimaryImageAspectRatio,SyncInfo",
CollapseBoxSetItems: false, CollapseBoxSetItems: false,