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

update components

This commit is contained in:
Luke Pulverenti 2016-06-16 02:20:12 -04:00
parent 857b8348bb
commit 165a3a99a2
11 changed files with 99 additions and 48 deletions

View file

@ -16,12 +16,12 @@
}, },
"devDependencies": {}, "devDependencies": {},
"ignore": [], "ignore": [],
"version": "1.1.63", "version": "1.1.64",
"_release": "1.1.63", "_release": "1.1.64",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.1.63", "tag": "1.1.64",
"commit": "076ec0b311164c5a85aeae3375af2c23be9b20fb" "commit": "a1d00ddc6a767b00a588729b13c8202b99b1eadb"
}, },
"_source": "https://github.com/MediaBrowser/Emby.ApiClient.Javascript.git", "_source": "https://github.com/MediaBrowser/Emby.ApiClient.Javascript.git",
"_target": "^1.1.51", "_target": "^1.1.51",

View file

@ -2992,6 +2992,7 @@
var options = {}; var options = {};
var userId = self.getCurrentUserId();
if (userId) { if (userId) {
options.userId = userId; options.userId = userId;
} }

View file

@ -15,12 +15,12 @@
}, },
"devDependencies": {}, "devDependencies": {},
"ignore": [], "ignore": [],
"version": "1.4.49", "version": "1.4.51",
"_release": "1.4.49", "_release": "1.4.51",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.4.49", "tag": "1.4.51",
"commit": "6254f7790a298aa3b41ede2ac2e303cb26d88705" "commit": "90b14ccc0e927221ab1d6c7556d1fadccf3876b9"
}, },
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.0", "_target": "^1.2.0",

View file

@ -1,4 +1,4 @@
define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'focusManager', 'apphost', 'css!./style', 'material-icons', 'paper-icon-button-light', 'paper-spinner'], function (dialogHelper, inputmanager, connectionManager, layoutManager, focusManager, appHost) { define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'focusManager', 'apphost', 'loading', 'css!./style', 'material-icons', 'paper-icon-button-light'], function (dialogHelper, inputmanager, connectionManager, layoutManager, focusManager, appHost, loading) {
function getImageUrl(item, options, apiClient) { function getImageUrl(item, options, apiClient) {
@ -254,20 +254,12 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
function onSlideChangeStart(swiper, slide, image) { function onSlideChangeStart(swiper, slide, image) {
var spinner = slide.querySelector('paper-spinner'); //loading.show();
if (spinner) {
spinner.active = true;
}
} }
function onSlideChangeEnd(swiper, slide, image) { function onSlideChangeEnd(swiper, slide, image) {
var spinner = slide.querySelector('paper-spinner'); //loading.hide();
if (spinner) {
spinner.active = false;
// Remove it because in IE it might just keep in spinning forever
spinner.parentNode.removeChild(spinner);
}
} }
function getSwiperSlideHtmlFromSlide(item) { function getSwiperSlideHtmlFromSlide(item) {
@ -275,7 +267,6 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
var html = ''; var html = '';
html += '<div class="swiper-slide" data-original="' + item.originalImage + '" data-itemid="' + item.Id + '" data-serverid="' + item.ServerId + '">'; html += '<div class="swiper-slide" data-original="' + item.originalImage + '" data-itemid="' + item.Id + '" data-serverid="' + item.ServerId + '">';
html += '<img data-src="' + item.imageUrl + '" class="swiper-lazy">'; html += '<img data-src="' + item.imageUrl + '" class="swiper-lazy">';
html += '<paper-spinner></paper-spinner>';
if (item.title || item.subtitle) { if (item.title || item.subtitle) {
html += '<div class="slideText">'; html += '<div class="slideText">';
html += '<div class="slideTextInner">'; html += '<div class="slideTextInner">';

View file

@ -32,14 +32,14 @@
"web-component-tester": "^4.0.0", "web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/PolymerElements/iron-icon", "homepage": "https://github.com/polymerelements/iron-icon",
"_release": "1.0.8", "_release": "1.0.8",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.8", "tag": "v1.0.8",
"commit": "f36b38928849ef3853db727faa8c9ef104d611eb" "commit": "f36b38928849ef3853db727faa8c9ef104d611eb"
}, },
"_source": "git://github.com/PolymerElements/iron-icon.git", "_source": "git://github.com/polymerelements/iron-icon.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-icon" "_originalSource": "polymerelements/iron-icon"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-location", "name": "iron-location",
"version": "0.8.3", "version": "0.8.4",
"description": "Bidirectional data binding into the page's URL.", "description": "Bidirectional data binding into the page's URL.",
"private": true, "private": true,
"authors": [ "authors": [
@ -37,11 +37,11 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.2.3" "iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.2.3"
}, },
"_release": "0.8.3", "_release": "0.8.4",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v0.8.3", "tag": "v0.8.4",
"commit": "cb124aa740c07d2b65af1d7e05a3cf8fd6a25f87" "commit": "dcb05b63c0f367fde7ebfd3bebefee606f69dd68"
}, },
"_source": "git://github.com/PolymerElements/iron-location.git", "_source": "git://github.com/PolymerElements/iron-location.git",
"_target": "^0.8.0", "_target": "^0.8.0",

View file

@ -2,7 +2,7 @@ language: node_js
sudo: required sudo: required
node_js: stable node_js: stable
addons: addons:
firefox: latest firefox: '46.0'
apt: apt:
sources: sources:
- google-chrome - google-chrome

View file

@ -1,6 +1,6 @@
{ {
"name": "iron-location", "name": "iron-location",
"version": "0.8.3", "version": "0.8.4",
"description": "Bidirectional data binding into the page's URL.", "description": "Bidirectional data binding into the page's URL.",
"private": true, "private": true,
"authors": [ "authors": [

View file

@ -125,9 +125,8 @@ milliseconds.
computed: '_makeRegExp(urlSpaceRegex)' computed: '_makeRegExp(urlSpaceRegex)'
}, },
_lastChangedAtAt: { _lastChangedAt: {
type: Number, type: Number
value: -Infinity
}, },
_initialized: { _initialized: {
@ -146,6 +145,9 @@ milliseconds.
this.listen(window, 'location-changed', '_urlChanged'); this.listen(window, 'location-changed', '_urlChanged');
this.listen(window, 'popstate', '_urlChanged'); this.listen(window, 'popstate', '_urlChanged');
this.listen(/** @type {!HTMLBodyElement} */(document.body), 'click', '_globalOnClick'); this.listen(/** @type {!HTMLBodyElement} */(document.body), 'click', '_globalOnClick');
// Give a 200ms grace period to make initial redirects without any
// additions to the user's history.
this._lastChangedAt = window.performance.now() - (this.dwellTime - 200);
this._initialized = true; this._initialized = true;
this._urlChanged(); this._urlChanged();
@ -157,17 +159,6 @@ milliseconds.
this.unlisten(/** @type {!HTMLBodyElement} */(document.body), 'click', '_globalOnClick'); this.unlisten(/** @type {!HTMLBodyElement} */(document.body), 'click', '_globalOnClick');
this._initialized = false; this._initialized = false;
}, },
/**
* @return {number} the number of milliseconds since some point in the
* past. Only useful for comparing against other results from this
* function.
*/
_now: function() {
if (window.performance && window.performance.now) {
return window.performance.now();
}
return new Date().getTime();
},
_hashChanged: function() { _hashChanged: function() {
this.hash = window.location.hash.substring(1); this.hash = window.location.hash.substring(1);
}, },
@ -212,7 +203,7 @@ milliseconds.
// Need to use a full URL in case the containing page has a base URI. // Need to use a full URL in case the containing page has a base URI.
var fullNewUrl = new URL( var fullNewUrl = new URL(
newUrl, window.location.protocol + '//' + window.location.host).href; newUrl, window.location.protocol + '//' + window.location.host).href;
var now = this._now(); var now = window.performance.now();
var shouldReplace = var shouldReplace =
this._lastChangedAt + this.dwellTime > now; this._lastChangedAt + this.dwellTime > now;
this._lastChangedAt = now; this._lastChangedAt = now;
@ -230,6 +221,12 @@ milliseconds.
* @param {MouseEvent} event . * @param {MouseEvent} event .
*/ */
_globalOnClick: function(event) { _globalOnClick: function(event) {
// If another event handler has stopped this event then there's nothing
// for us to do. This can happen e.g. when there are multiple
// iron-location elements in a page.
if (event.defaultPrevented) {
return;
}
var href = this._getSameOriginLinkHref(event); var href = this._getSameOriginLinkHref(event);
if (!href) { if (!href) {
return; return;
@ -268,18 +265,18 @@ milliseconds.
// If there's no link there's nothing to do. // If there's no link there's nothing to do.
if (!anchor) { if (!anchor) {
return; return null;
} }
// Target blank is a new tab, don't intercept. // Target blank is a new tab, don't intercept.
if (anchor.target === '_blank') { if (anchor.target === '_blank') {
return; return null;
} }
// If the link is for an existing parent frame, don't intercept. // If the link is for an existing parent frame, don't intercept.
if ((anchor.target === '_top' || if ((anchor.target === '_top' ||
anchor.target === '_parent') && anchor.target === '_parent') &&
window.top !== window) { window.top !== window) {
return; return null;
} }
var href = anchor.href; var href = anchor.href;
@ -319,6 +316,11 @@ milliseconds.
// Need to use a full URL in case the containing page has a base URI. // Need to use a full URL in case the containing page has a base URI.
var fullNormalizedHref = new URL( var fullNormalizedHref = new URL(
normalizedHref, window.location.href).href; normalizedHref, window.location.href).href;
// If the navigation is to the current page we shouldn't add a history
// entry.
if (fullNormalizedHref === window.location.href) {
return null;
}
return fullNormalizedHref; return fullNormalizedHref;
}, },
_makeRegExp: function(urlSpaceRegex) { _makeRegExp: function(urlSpaceRegex) {

View file

@ -141,6 +141,34 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
'?greeting=hello&target=world&another=key'); '?greeting=hello&target=world&another=key');
}); });
}); });
suite('does not spam the user\'s history', function() {
var replaceStateCalls, pushStateCalls;
var nativeReplaceState, nativePushState;
setup(function() {
replaceStateCalls = pushStateCalls = 0;
nativeReplaceState = window.history.replaceState;
nativePushState = window.history.pushState;
window.history.replaceState = function() {
replaceStateCalls++;
};
window.history.pushState = function() {
pushStateCalls++;
};
});
teardown(function() {
window.history.replaceState = nativeReplaceState;
window.history.pushState = nativePushState;
});
test('when a change happens immediately after ' +
'the iron-location is attached', function() {
var ironLocation = fixture('Solo');
expect(pushStateCalls).to.be.equal(0);
expect(replaceStateCalls).to.be.equal(0);
ironLocation.path = '/foo';
expect(replaceStateCalls).to.be.equal(1);
expect(pushStateCalls).to.be.equal(0);
});
});
suite('when used with other iron-location elements', function() { suite('when used with other iron-location elements', function() {
var otherUrlElem; var otherUrlElem;
var urlElem; var urlElem;
@ -236,6 +264,35 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
anchor.target = '_blank'; anchor.target = '_blank';
expect(isClickCaptured(anchor)).to.be.eq(false); expect(isClickCaptured(anchor)).to.be.eq(false);
});
test('a link with an href to the ' +
'current page shouldn\'t add to history.', function() {
var anchor = document.createElement('a');
anchor.href = window.location.href;
expect(isClickCaptured(anchor)).to.be.equal(false);
});
test('a click that has already been defaultPrevented ' +
'shouldn\'t result in a navigation', function() {
fixture('Solo');
var anchor = document.createElement('a');
anchor.href = makeAbsoluteUrl('/');
anchor.addEventListener('click', function(event) {
event.preventDefault();
});
document.body.appendChild(anchor);
var originalPushState = window.history.pushState;
var count = 0;
window.history.pushState = function() {
count++;
}
anchor.click();
window.history.pushState = originalPushState;
expect(count).to.be.equal(0);
}) })
}); });

View file

@ -39,6 +39,6 @@
"commit": "ce5b9fb2d8aa03c698410e2e55cffcfa0b788a3a" "commit": "ce5b9fb2d8aa03c698410e2e55cffcfa0b788a3a"
}, },
"_source": "git://github.com/Polymer/polymer.git", "_source": "git://github.com/Polymer/polymer.git",
"_target": "^1.0.0", "_target": "^1.1.0",
"_originalSource": "Polymer/polymer" "_originalSource": "Polymer/polymer"
} }