mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
support IntersectionObserver
This commit is contained in:
parent
2d62dc8dd9
commit
48058e8fff
8 changed files with 135 additions and 62 deletions
|
@ -16,12 +16,12 @@
|
|||
},
|
||||
"devDependencies": {},
|
||||
"ignore": [],
|
||||
"version": "1.3.45",
|
||||
"_release": "1.3.45",
|
||||
"version": "1.3.48",
|
||||
"_release": "1.3.48",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.3.45",
|
||||
"commit": "dbaa46e3aa38a939b82f305c61e875e1a30da2fe"
|
||||
"tag": "1.3.48",
|
||||
"commit": "0764e35340e4625a5af560b2f46468646a7d9d10"
|
||||
},
|
||||
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
|
||||
"_target": "^1.2.0",
|
||||
|
|
|
@ -88,12 +88,48 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events'], functio
|
|||
target.addEventListener(type, handler, optionsOrCapture);
|
||||
}
|
||||
|
||||
function unveilWithIntersection(images) {
|
||||
|
||||
var filledCount = 0;
|
||||
|
||||
var observer = new IntersectionObserver(function (entries) {
|
||||
for (var j = 0, length2 = entries.length; j < length2; j++) {
|
||||
var entry = entries[j];
|
||||
var intersectionRatio = entry.intersectionRatio;
|
||||
if (intersectionRatio) {
|
||||
|
||||
var target = entry.target;
|
||||
observer.unobserve(target);
|
||||
fillImage(target);
|
||||
filledCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (filledCount >= images.length) {
|
||||
//observer.disconnect();
|
||||
}
|
||||
},
|
||||
{
|
||||
/* Using default options. Details below */
|
||||
}
|
||||
);
|
||||
// Start observing an element
|
||||
for (var i = 0, length = images.length; i < length; i++) {
|
||||
observer.observe(images[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function unveilElements(images) {
|
||||
|
||||
if (!images.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (window.IntersectionObserver) {
|
||||
unveilWithIntersection(images);
|
||||
return;
|
||||
}
|
||||
|
||||
var filledImages = [];
|
||||
var cancellationTokens = [];
|
||||
|
||||
|
|
|
@ -11,7 +11,14 @@ define(['apphost', 'globalize', 'connectionManager'], function (appHost, globali
|
|||
|
||||
var commands = [];
|
||||
|
||||
if (item.CanDownload && user.Policy.EnableContentDownloading && appHost.supports('filedownload')) {
|
||||
if (item.CanDelete) {
|
||||
commands.push({
|
||||
name: globalize.translate('sharedcomponents#Delete'),
|
||||
id: 'delete'
|
||||
});
|
||||
}
|
||||
|
||||
if (item.CanDownload && appHost.supports('filedownload')) {
|
||||
commands.push({
|
||||
name: globalize.translate('sharedcomponents#Download'),
|
||||
id: 'download'
|
||||
|
@ -69,6 +76,14 @@ define(['apphost', 'globalize', 'connectionManager'], function (appHost, globali
|
|||
case 'refresh':
|
||||
{
|
||||
refresh(apiClient, itemId);
|
||||
reject();
|
||||
break;
|
||||
}
|
||||
case 'delete':
|
||||
{
|
||||
deleteItem(apiClient, itemId).then(function () {
|
||||
resolve(true);
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'share':
|
||||
|
@ -83,11 +98,33 @@ define(['apphost', 'globalize', 'connectionManager'], function (appHost, globali
|
|||
break;
|
||||
}
|
||||
default:
|
||||
reject();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function deleteItem(apiClient, itemId) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var msg = globalize.translate('sharedcomponents#ConfirmDeleteItem');
|
||||
var title = globalize.translate('sharedcomponents#HeaderDeleteItem');
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
|
||||
confirm(msg, title).then(function () {
|
||||
|
||||
apiClient.deleteItem(itemId).then(function () {
|
||||
resolve(true);
|
||||
});
|
||||
|
||||
}, reject);
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function refresh(apiClient, itemId) {
|
||||
|
||||
apiClient.refreshItem(itemId, {
|
||||
|
@ -97,7 +134,6 @@ define(['apphost', 'globalize', 'connectionManager'], function (appHost, globali
|
|||
MetadataRefreshMode: 'FullRefresh',
|
||||
ReplaceAllImages: false,
|
||||
ReplaceAllMetadata: true
|
||||
|
||||
});
|
||||
|
||||
require(['toast'], function (toast) {
|
||||
|
|
|
@ -203,10 +203,10 @@ define(['loading', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'b
|
|||
|
||||
if (!isBackNav) {
|
||||
// Don't force a new view for home due to the back menu
|
||||
if (route.type != 'home') {
|
||||
//if (route.type != 'home') {
|
||||
onNewViewNeeded();
|
||||
return;
|
||||
}
|
||||
//}
|
||||
}
|
||||
viewManager.tryRestoreView(currentRequest).then(function () {
|
||||
|
||||
|
|
|
@ -50,6 +50,9 @@
|
|||
"Edit": "Edit",
|
||||
"Download": "Download",
|
||||
"Advanced": "Advanced",
|
||||
"Delete": "Delete",
|
||||
"HeaderDeleteItem": "Delete Item",
|
||||
"ConfirmDeleteItem": "Deleting this item will delete it from both the file system and your media library. Are you sure you wish to continue?",
|
||||
"Refresh": "Refresh",
|
||||
"RefreshQueued": "Refresh queued."
|
||||
}
|
|
@ -112,11 +112,11 @@ define(['browser'], function (browser) {
|
|||
|
||||
function slide(newAnimatedPage, oldAnimatedPage, transition, isBack) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
var timings = {
|
||||
duration: 450,
|
||||
iterations: 1,
|
||||
easing: 'ease-out',
|
||||
fill: 'both'
|
||||
easing: 'ease-out'
|
||||
}
|
||||
|
||||
var animations = [];
|
||||
|
@ -145,18 +145,17 @@ define(['browser'], function (browser) {
|
|||
|
||||
currentAnimations = animations;
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
animations[animations.length - 1].onfinish = resolve;
|
||||
});
|
||||
}
|
||||
|
||||
function fade(newAnimatedPage, oldAnimatedPage, transition, isBack) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
var timings = {
|
||||
duration: 200,
|
||||
iterations: 1,
|
||||
easing: 'ease-out',
|
||||
fill: 'both'
|
||||
easing: 'ease-out'
|
||||
}
|
||||
|
||||
var animations = [];
|
||||
|
@ -181,7 +180,6 @@ define(['browser'], function (browser) {
|
|||
|
||||
currentAnimations = animations;
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
animations[animations.length - 1].onfinish = resolve;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -30,14 +30,14 @@
|
|||
"web-component-tester": "polymer/web-component-tester#^3.4.0"
|
||||
},
|
||||
"ignore": [],
|
||||
"homepage": "https://github.com/polymerelements/iron-a11y-announcer",
|
||||
"homepage": "https://github.com/PolymerElements/iron-a11y-announcer",
|
||||
"_release": "1.0.4",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.4",
|
||||
"commit": "5ce3eb8c4282bb53cd72e348858dc6be6b4c50b9"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/iron-a11y-announcer.git",
|
||||
"_source": "git://github.com/PolymerElements/iron-a11y-announcer.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "polymerelements/iron-a11y-announcer"
|
||||
"_originalSource": "PolymerElements/iron-a11y-announcer"
|
||||
}
|
|
@ -36,7 +36,7 @@
|
|||
"tag": "v1.5.2",
|
||||
"commit": "18e8e12dcd9a4560de480562f65935feed334b86"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/iron-selector.git",
|
||||
"_source": "git://github.com/polymerelements/iron-selector.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/iron-selector"
|
||||
"_originalSource": "polymerelements/iron-selector"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue