1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
This commit is contained in:
Sarab Singh 2020-05-03 23:59:23 +05:30
parent 6c4528f0dc
commit 8432ac0da7
4 changed files with 38 additions and 12949 deletions

View file

@ -1,7 +1,6 @@
import dialogHelper from 'dialogHelper';
import layoutManager from 'layoutManager';
import globalize from 'globalize';
// import browser from 'browser';
import dom from 'dom';
import 'emby-button';
import 'css!./actionSheet';
@ -11,19 +10,14 @@ import 'listViewStyle';
function getOffsets(elems) {
var doc = document;
var results = [];
if (!doc) {
if (!document) {
return results;
}
var box;
var elem;
for (var i = 0, length = elems.length; i < length; i++) {
elem = elems[i];
for (let elem in elems) {
// Support: BlackBerry 5, iOS 3 (original iPhone)
// If we don't have gBCR, just use 0,0 rather than error
if (elem.getBoundingClientRect) {
@ -147,17 +141,12 @@ export function show(options) {
style += "min-width:" + minWidth + "px;";
}
var i;
var length;
var option;
var renderIcon = false;
var icons = [];
var itemIcon;
for (i = 0, length = options.items.length; i < length; i++) {
for (let item in options.items) {
option = options.items[i];
itemIcon = option.icon || (option.selected ? 'check' : null);
itemIcon = item.icon || (item.selected ? 'check' : null);
if (itemIcon) {
renderIcon = true;
@ -214,20 +203,18 @@ export function show(options) {
menuItemClass += ' actionsheet-xlargeFont';
}
for (i = 0, length = options.items.length; i < length; i++) {
for (let item in options.items) {
option = options.items[i];
if (option.divider) {
if (item.divider) {
html += '<div class="actionsheetDivider"></div>';
continue;
}
var autoFocus = option.selected && layoutManager.tv ? ' autoFocus' : '';
var autoFocus = item.selected && layoutManager.tv ? ' autoFocus' : '';
// Check for null in case int 0 was passed in
var optionId = option.id == null || option.id === '' ? option.value : option.id;
var optionId = item.id == null || item.id === '' ? item.value : item.id;
html += '<button' + autoFocus + ' is="emby-button" type="button" class="' + menuItemClass + '" data-id="' + optionId + '">';
itemIcon = icons[i];
@ -242,20 +229,20 @@ export function show(options) {
html += '<div class="listItemBody actionsheetListItemBody">';
html += '<div class="listItemBodyText actionSheetItemText">';
html += (option.name || option.textContent || option.innerText);
html += (item.name || item.textContent || item.innerText);
html += '</div>';
if (option.secondaryText) {
if (item.secondaryText) {
html += '<div class="listItemBodyText secondary">';
html += option.secondaryText;
html += item.secondaryText;
html += '</div>';
}
html += '</div>';
if (option.asideText) {
if (item.asideText) {
html += '<div class="listItemAside actionSheetItemAsideText">';
html += option.asideText;
html += item.asideText;
html += '</div>';
}

View file

@ -16,28 +16,24 @@ function alertText(options) {
export function deleteItem(options) {
var item = options.item;
var itemId = item.Id;
var parentId = item.SeasonId || item.SeriesId || item.ParentId;
var serverId = item.ServerId;
var msg = globalize.translate('ConfirmDeleteItem');
var title = globalize.translate('HeaderDeleteItem');
var apiClient = connectionManager.getApiClient(item.ServerId);
return confirm({
title: title,
text: msg,
title: globalize.translate('HeaderDeleteItem'),
text: globalize.translate('ConfirmDeleteItem'),
confirmText: globalize.translate('Delete'),
primary: 'delete'
}).then(function () {
return apiClient.deleteItem(itemId).then(function () {
return apiClient.deleteItem(item.Id).then(function () {
if (options.navigate) {
if (parentId) {
appRouter.showItem(parentId, serverId);
appRouter.showItem(parentId, item.ServerId);
} else {
appRouter.goHome();
}

View file

@ -2,25 +2,19 @@ import actionsheet from 'actionsheet';
import datetime from 'datetime';
import playbackManager from 'playbackManager';
import globalize from 'globalize';
// import appSettings from 'appSettings';
export function show(options) {
var item = options.item;
var itemType = item.Type;
var isFolder = item.IsFolder;
var itemId = item.Id;
var channelId = item.ChannelId;
var serverId = item.ServerId;
var resumePositionTicks = item.UserData ? item.UserData.PlaybackPositionTicks : null;
var playableItemId = itemType === 'Program' ? channelId : itemId;
var playableItemId = item.Type === 'Program' ? item.ChannelId : item.Id;
if (!resumePositionTicks || isFolder) {
if (!resumePositionTicks || item.IsFolder) {
playbackManager.play({
ids: [playableItemId],
serverId: serverId
serverId: item.ServerId
});
return;
}
@ -48,14 +42,14 @@ export function show(options) {
case 'play':
playbackManager.play({
ids: [playableItemId],
serverId: serverId
serverId: item.ServerId
});
break;
case 'resume':
playbackManager.play({
ids: [playableItemId],
startPositionTicks: resumePositionTicks,
serverId: serverId
serverId: item.ServerId
});
break;
case 'queue':

File diff suppressed because it is too large Load diff