mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fixed the suggested changes
This commit is contained in:
parent
ee2f86124b
commit
83f1c7498d
3 changed files with 68 additions and 67 deletions
|
@ -10,13 +10,13 @@ import 'listViewStyle';
|
||||||
|
|
||||||
function getOffsets(elems) {
|
function getOffsets(elems) {
|
||||||
|
|
||||||
var results = [];
|
let results = [];
|
||||||
|
|
||||||
if (!document) {
|
if (!document) {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
var box;
|
let box;
|
||||||
for (let elem of elems) {
|
for (let elem of elems) {
|
||||||
// Support: BlackBerry 5, iOS 3 (original iPhone)
|
// Support: BlackBerry 5, iOS 3 (original iPhone)
|
||||||
// If we don't have gBCR, just use 0,0 rather than error
|
// If we don't have gBCR, just use 0,0 rather than error
|
||||||
|
@ -39,11 +39,11 @@ function getOffsets(elems) {
|
||||||
|
|
||||||
function getPosition(options, dlg) {
|
function getPosition(options, dlg) {
|
||||||
|
|
||||||
var windowSize = dom.getWindowSize();
|
const windowSize = dom.getWindowSize();
|
||||||
var windowHeight = windowSize.innerHeight;
|
const windowHeight = windowSize.innerHeight;
|
||||||
var windowWidth = windowSize.innerWidth;
|
const windowWidth = windowSize.innerWidth;
|
||||||
|
|
||||||
var pos = getOffsets([options.positionTo])[0];
|
let pos = getOffsets([options.positionTo])[0];
|
||||||
|
|
||||||
if (options.positionY !== 'top') {
|
if (options.positionY !== 'top') {
|
||||||
pos.top += (pos.height || 0) / 2;
|
pos.top += (pos.height || 0) / 2;
|
||||||
|
@ -51,16 +51,16 @@ function getPosition(options, dlg) {
|
||||||
|
|
||||||
pos.left += (pos.width || 0) / 2;
|
pos.left += (pos.width || 0) / 2;
|
||||||
|
|
||||||
var height = dlg.offsetHeight || 300;
|
const height = dlg.offsetHeight || 300;
|
||||||
var width = dlg.offsetWidth || 160;
|
const width = dlg.offsetWidth || 160;
|
||||||
|
|
||||||
// Account for popup size
|
// Account for popup size
|
||||||
pos.top -= height / 2;
|
pos.top -= height / 2;
|
||||||
pos.left -= width / 2;
|
pos.left -= width / 2;
|
||||||
|
|
||||||
// Avoid showing too close to the bottom
|
// Avoid showing too close to the bottom
|
||||||
var overflowX = pos.left + width - windowWidth;
|
const overflowX = pos.left + width - windowWidth;
|
||||||
var overflowY = pos.top + height - windowHeight;
|
const overflowY = pos.top + height - windowHeight;
|
||||||
|
|
||||||
if (overflowX > 0) {
|
if (overflowX > 0) {
|
||||||
pos.left -= (overflowX + 20);
|
pos.left -= (overflowX + 20);
|
||||||
|
@ -81,7 +81,7 @@ function getPosition(options, dlg) {
|
||||||
|
|
||||||
function centerFocus(elem, horiz, on) {
|
function centerFocus(elem, horiz, on) {
|
||||||
require(['scrollHelper'], function (scrollHelper) {
|
require(['scrollHelper'], function (scrollHelper) {
|
||||||
var fn = on ? 'on' : 'off';
|
const fn = on ? 'on' : 'off';
|
||||||
scrollHelper.centerFocus[fn](elem, horiz);
|
scrollHelper.centerFocus[fn](elem, horiz);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -92,19 +92,17 @@ export function show(options) {
|
||||||
// positionTo
|
// positionTo
|
||||||
// showCancel
|
// showCancel
|
||||||
// title
|
// title
|
||||||
var dialogOptions = {
|
let dialogOptions = {
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
enableHistory: options.enableHistory,
|
enableHistory: options.enableHistory,
|
||||||
scrollY: false
|
scrollY: false
|
||||||
};
|
};
|
||||||
|
|
||||||
var backButton = false;
|
let isFullscreen;
|
||||||
var isFullscreen;
|
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
dialogOptions.size = 'fullscreen';
|
dialogOptions.size = 'fullscreen';
|
||||||
isFullscreen = true;
|
isFullscreen = true;
|
||||||
backButton = true;
|
|
||||||
dialogOptions.autoFocus = true;
|
dialogOptions.autoFocus = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -116,7 +114,7 @@ export function show(options) {
|
||||||
dialogOptions.autoFocus = false;
|
dialogOptions.autoFocus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
let dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
|
|
||||||
if (isFullscreen) {
|
if (isFullscreen) {
|
||||||
dlg.classList.add('actionsheet-fullscreen');
|
dlg.classList.add('actionsheet-fullscreen');
|
||||||
|
@ -130,20 +128,20 @@ export function show(options) {
|
||||||
dlg.classList.add(options.dialogClass);
|
dlg.classList.add(options.dialogClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
var scrollClassName = layoutManager.tv ? 'scrollY smoothScrollY hiddenScrollY' : 'scrollY';
|
const scrollClassName = layoutManager.tv ? 'scrollY smoothScrollY hiddenScrollY' : 'scrollY';
|
||||||
var style = '';
|
let style = '';
|
||||||
|
|
||||||
// Admittedly a hack but right now the scrollbar is being factored into the width which is causing truncation
|
// Admittedly a hack but right now the scrollbar is being factored into the width which is causing truncation
|
||||||
if (options.items.length > 20) {
|
if (options.items.length > 20) {
|
||||||
var minWidth = dom.getWindowSize().innerWidth >= 300 ? 240 : 200;
|
const minWidth = dom.getWindowSize().innerWidth >= 300 ? 240 : 200;
|
||||||
style += "min-width:" + minWidth + "px;";
|
style += "min-width:" + minWidth + "px;";
|
||||||
}
|
}
|
||||||
|
|
||||||
var renderIcon = false;
|
let renderIcon = false;
|
||||||
var icons = [];
|
let icons = [];
|
||||||
var itemIcon;
|
let itemIcon;
|
||||||
for (let item of options.items) {
|
for (let item of options.items) {
|
||||||
|
|
||||||
itemIcon = item.icon || (item.selected ? 'check' : null);
|
itemIcon = item.icon || (item.selected ? 'check' : null);
|
||||||
|
@ -159,7 +157,7 @@ export function show(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If any items have an icon, give them all an icon just to make sure they're all lined up evenly
|
// If any items have an icon, give them all an icon just to make sure they're all lined up evenly
|
||||||
var center = options.title && (!renderIcon /*|| itemsWithIcons.length != options.items.length*/);
|
const center = options.title && (!renderIcon /*|| itemsWithIcons.length != options.items.length*/);
|
||||||
|
|
||||||
if (center || layoutManager.tv) {
|
if (center || layoutManager.tv) {
|
||||||
html += '<div class="actionSheetContent actionSheetContent-centered">';
|
html += '<div class="actionSheetContent actionSheetContent-centered">';
|
||||||
|
@ -169,23 +167,19 @@ export function show(options) {
|
||||||
|
|
||||||
if (options.title) {
|
if (options.title) {
|
||||||
|
|
||||||
html += '<h1 class="actionSheetTitle">';
|
html += '<h1 class="actionSheetTitle">' + options.title + '</h1>';
|
||||||
html += options.title;
|
|
||||||
html += '</h1>';
|
|
||||||
}
|
}
|
||||||
if (options.text) {
|
if (options.text) {
|
||||||
html += '<p class="actionSheetText">';
|
html += '<p class="actionSheetText">' + options.text + '</p>'
|
||||||
html += options.text;
|
|
||||||
html += '</p>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var scrollerClassName = 'actionSheetScroller';
|
let scrollerClassName = 'actionSheetScroller';
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
scrollerClassName += ' actionSheetScroller-tv focuscontainer-x focuscontainer-y';
|
scrollerClassName += ' actionSheetScroller-tv focuscontainer-x focuscontainer-y';
|
||||||
}
|
}
|
||||||
html += '<div class="' + scrollerClassName + ' ' + scrollClassName + '" style="' + style + '">';
|
html += '<div class="' + scrollerClassName + ' ' + scrollClassName + '" style="' + style + '">';
|
||||||
|
|
||||||
var menuItemClass = 'listItem listItem-button actionSheetMenuItem';
|
let menuItemClass = 'listItem listItem-button actionSheetMenuItem';
|
||||||
|
|
||||||
if (options.border || options.shaded) {
|
if (options.border || options.shaded) {
|
||||||
menuItemClass += ' listItem-border';
|
menuItemClass += ' listItem-border';
|
||||||
|
@ -211,10 +205,10 @@ export function show(options) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var autoFocus = item.selected && layoutManager.tv ? ' autoFocus' : '';
|
const autoFocus = item.selected && layoutManager.tv ? ' autoFocus' : '';
|
||||||
|
|
||||||
// Check for null in case int 0 was passed in
|
// Check for null in case int 0 was passed in
|
||||||
var optionId = item.id == null || item.id === '' ? item.value : item.id;
|
const optionId = item.id == null || item.id === '' ? item.value : item.id;
|
||||||
html += '<button' + autoFocus + ' is="emby-button" type="button" class="' + menuItemClass + '" data-id="' + optionId + '">';
|
html += '<button' + autoFocus + ' is="emby-button" type="button" class="' + menuItemClass + '" data-id="' + optionId + '">';
|
||||||
|
|
||||||
itemIcon = icons[i];
|
itemIcon = icons[i];
|
||||||
|
@ -233,17 +227,13 @@ export function show(options) {
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
if (item.secondaryText) {
|
if (item.secondaryText) {
|
||||||
html += '<div class="listItemBodyText secondary">';
|
html += '<div class="listItemBodyText secondary">' + item.secondaryText + '</div>';
|
||||||
html += item.secondaryText;
|
|
||||||
html += '</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
if (item.asideText) {
|
if (item.asideText) {
|
||||||
html += '<div class="listItemAside actionSheetItemAsideText">';
|
html += '<div class="listItemAside actionSheetItemAsideText">' + item.asideText + '</div>';
|
||||||
html += item.asideText;
|
|
||||||
html += '</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</button>';
|
html += '</button>';
|
||||||
|
@ -262,18 +252,18 @@ export function show(options) {
|
||||||
centerFocus(dlg.querySelector('.actionSheetScroller'), false, true);
|
centerFocus(dlg.querySelector('.actionSheetScroller'), false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var btnCloseActionSheet = dlg.querySelector('.btnCloseActionSheet');
|
let btnCloseActionSheet = dlg.querySelector('.btnCloseActionSheet');
|
||||||
if (btnCloseActionSheet) {
|
if (btnCloseActionSheet) {
|
||||||
dlg.querySelector('.btnCloseActionSheet').addEventListener('click', function () {
|
btnCloseActionSheet.addEventListener('click', function () {
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seeing an issue in some non-chrome browsers where this is requiring a double click
|
// Seeing an issue in some non-chrome browsers where this is requiring a double click
|
||||||
//var eventName = browser.firefox ? 'mousedown' : 'click';
|
//var eventName = browser.firefox ? 'mousedown' : 'click';
|
||||||
var selectedId;
|
let selectedId;
|
||||||
|
|
||||||
var timeout;
|
let timeout;
|
||||||
if (options.timeout) {
|
if (options.timeout) {
|
||||||
timeout = setTimeout(function () {
|
timeout = setTimeout(function () {
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
|
@ -282,11 +272,11 @@ export function show(options) {
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
var isResolved;
|
let isResolved;
|
||||||
|
|
||||||
dlg.addEventListener('click', function (e) {
|
dlg.addEventListener('click', function (e) {
|
||||||
|
|
||||||
var actionSheetMenuItem = dom.parentWithClass(e.target, 'actionSheetMenuItem');
|
const actionSheetMenuItem = dom.parentWithClass(e.target, 'actionSheetMenuItem');
|
||||||
|
|
||||||
if (actionSheetMenuItem) {
|
if (actionSheetMenuItem) {
|
||||||
selectedId = actionSheetMenuItem.getAttribute('data-id');
|
selectedId = actionSheetMenuItem.getAttribute('data-id');
|
||||||
|
@ -338,7 +328,7 @@ export function show(options) {
|
||||||
|
|
||||||
dialogHelper.open(dlg);
|
dialogHelper.open(dlg);
|
||||||
|
|
||||||
var pos = options.positionTo && dialogOptions.size !== 'fullscreen' ? getPosition(options, dlg) : null;
|
const pos = options.positionTo && dialogOptions.size !== 'fullscreen' ? getPosition(options, dlg) : null;
|
||||||
|
|
||||||
if (pos) {
|
if (pos) {
|
||||||
dlg.style.position = 'fixed';
|
dlg.style.position = 'fixed';
|
||||||
|
|
|
@ -15,10 +15,10 @@ function alertText(options) {
|
||||||
|
|
||||||
export function deleteItem(options) {
|
export function deleteItem(options) {
|
||||||
|
|
||||||
var item = options.item;
|
const item = options.item;
|
||||||
var parentId = item.SeasonId || item.SeriesId || item.ParentId;
|
const parentId = item.SeasonId || item.SeriesId || item.ParentId;
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(item.ServerId);
|
let apiClient = connectionManager.getApiClient(item.ServerId);
|
||||||
|
|
||||||
return confirm({
|
return confirm({
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ export function deleteItem(options) {
|
||||||
}
|
}
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
|
|
||||||
var result = function () {
|
let result = function () {
|
||||||
return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -17,22 +17,32 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getProgressHtml(pct, options) {
|
export function getProgressHtml(pct, options) {
|
||||||
var containerClass = options && options.containerClass ? 'itemProgressBar ' + options.containerClass : 'itemProgressBar';
|
let containerClass = 'itemProgressBar ';
|
||||||
|
if(options && options.containerClass) {
|
||||||
|
containerClass += options.containerClass
|
||||||
|
}
|
||||||
|
|
||||||
return '<div class="' + containerClass + '"><div class="itemProgressBarForeground" style="width:' + pct + '%;"></div></div>';
|
return '<div class="' + containerClass + '"><div class="itemProgressBarForeground" style="width:' + pct + '%;"></div></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAutoTimeProgressHtml(pct, options, isRecording, start, end) {
|
function getAutoTimeProgressHtml(pct, options, isRecording, start, end) {
|
||||||
var containerClass = options && options.containerClass ? 'itemProgressBar ' + options.containerClass : 'itemProgressBar';
|
let containerClass = 'itemProgressBar ';
|
||||||
var foregroundClass = isRecording ? 'itemProgressBarForeground itemProgressBarForeground-recording' : 'itemProgressBarForeground';
|
if(options && options.containerClass) {
|
||||||
|
containerClass += options.containerClass
|
||||||
|
}
|
||||||
|
|
||||||
|
let foregroundClass = 'itemProgressBarForeground ';
|
||||||
|
if (isRecording) {
|
||||||
|
foregroundClass += 'itemProgressBarForeground-recording';
|
||||||
|
}
|
||||||
|
|
||||||
return '<div is="emby-progressbar" data-automode="time" data-starttime="' + start + '" data-endtime="' + end + '" class="' + containerClass + '"><div class="' + foregroundClass + '" style="width:' + pct + '%;"></div></div>';
|
return '<div is="emby-progressbar" data-automode="time" data-starttime="' + start + '" data-endtime="' + end + '" class="' + containerClass + '"><div class="' + foregroundClass + '" style="width:' + pct + '%;"></div></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getProgressBarHtml(item, options) {
|
export function getProgressBarHtml(item, options) {
|
||||||
var pct;
|
let pct;
|
||||||
if (enableProgressIndicator(item) && item.Type !== "Recording") {
|
if (enableProgressIndicator(item) && item.Type !== "Recording") {
|
||||||
var userData = options ? (options.userData || item.UserData) : item.UserData;
|
const userData = options && options.userData ? options.UserData : item.UserData;
|
||||||
if (userData) {
|
if (userData) {
|
||||||
pct = userData.PlayedPercentage;
|
pct = userData.PlayedPercentage;
|
||||||
if (pct && pct < 100) {
|
if (pct && pct < 100) {
|
||||||
|
@ -42,8 +52,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((item.Type === 'Program' || item.Type === 'Timer' || item.Type === 'Recording') && item.StartDate && item.EndDate) {
|
if ((item.Type === 'Program' || item.Type === 'Timer' || item.Type === 'Recording') && item.StartDate && item.EndDate) {
|
||||||
var startDate = 0;
|
let startDate = 0;
|
||||||
var endDate = 1;
|
let endDate = 1;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
startDate = datetime.parseISO8601Date(item.StartDate).getTime();
|
startDate = datetime.parseISO8601Date(item.StartDate).getTime();
|
||||||
|
@ -52,12 +62,12 @@
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
var now = new Date().getTime();
|
const now = new Date().getTime();
|
||||||
var total = endDate - startDate;
|
const total = endDate - startDate;
|
||||||
pct = 100 * ((now - startDate) / total);
|
pct = 100 * ((now - startDate) / total);
|
||||||
|
|
||||||
if (pct > 0 && pct < 100) {
|
if (pct > 0 && pct < 100) {
|
||||||
var isRecording = item.Type === 'Timer' || item.Type === 'Recording' || item.TimerId;
|
const isRecording = item.Type === 'Timer' || item.Type === 'Recording' || item.TimerId;
|
||||||
return getAutoTimeProgressHtml(pct, options, isRecording, startDate, endDate);
|
return getAutoTimeProgressHtml(pct, options, isRecording, startDate, endDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,11 +81,11 @@
|
||||||
|
|
||||||
export function getPlayedIndicatorHtml(item) {
|
export function getPlayedIndicatorHtml(item) {
|
||||||
if (enablePlayedIndicator(item)) {
|
if (enablePlayedIndicator(item)) {
|
||||||
var userData = item.UserData || {};
|
let userData = item.UserData || {};
|
||||||
if (userData.UnplayedItemCount) {
|
if (userData.UnplayedItemCount) {
|
||||||
return '<div class="countIndicator indicator">' + userData.UnplayedItemCount + '</div>';
|
return '<div class="countIndicator indicator">' + userData.UnplayedItemCount + '</div>';
|
||||||
}
|
}
|
||||||
|
windowSize
|
||||||
if (userData.PlayedPercentage && userData.PlayedPercentage >= 100 || (userData.Played)) {
|
if (userData.PlayedPercentage && userData.PlayedPercentage >= 100 || (userData.Played)) {
|
||||||
return '<div class="playedIndicator indicator"><i class="material-icons indicatorIcon">check</i></div>';
|
return '<div class="playedIndicator indicator"><i class="material-icons indicatorIcon">check</i></div>';
|
||||||
}
|
}
|
||||||
|
@ -85,7 +95,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getChildCountIndicatorHtml(item, options) {
|
export function getChildCountIndicatorHtml(item, options) {
|
||||||
var minCount = options ? options.minCount : 0;
|
const minCount = options && options.minCount ? options.minCount : 0;
|
||||||
|
|
||||||
if (item.ChildCount && item.ChildCount > minCount) {
|
if (item.ChildCount && item.ChildCount > minCount) {
|
||||||
return '<div class="countIndicator indicator">' + item.ChildCount + '</div>';
|
return '<div class="countIndicator indicator">' + item.ChildCount + '</div>';
|
||||||
|
@ -95,7 +105,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTimerIndicator(item) {
|
export function getTimerIndicator(item) {
|
||||||
var status;
|
let status;
|
||||||
|
|
||||||
if (item.Type === 'SeriesTimer') {
|
if (item.Type === 'SeriesTimer') {
|
||||||
return '<span class="material-icons timerIndicator indicatorIcon fiber_smart_record"></span>';
|
return '<span class="material-icons timerIndicator indicatorIcon fiber_smart_record"></span>';
|
||||||
|
@ -136,14 +146,15 @@
|
||||||
'Photo' : 'photo'
|
'Photo' : 'photo'
|
||||||
}
|
}
|
||||||
|
|
||||||
return iconT[item.iconType] ? '<div class="indicator videoIndicator"><span class="material-icons indicatorIcon '+ iconT[item.iconType] +'"></span></div>' : '';
|
const icon = iconT[item.iconType];
|
||||||
|
return icon ? '<div class="indicator videoIndicator"><span class="material-icons indicatorIcon '+ icon +'"></span></div>' : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMissingIndicator(item) {
|
export function getMissingIndicator(item) {
|
||||||
if (item.Type === 'Episode' && item.LocationType === 'Virtual') {
|
if (item.Type === 'Episode' && item.LocationType === 'Virtual') {
|
||||||
if (item.PremiereDate) {
|
if (item.PremiereDate) {
|
||||||
try {
|
try {
|
||||||
var premiereDate = datetime.parseISO8601Date(item.PremiereDate).getTime();
|
const premiereDate = datetime.parseISO8601Date(item.PremiereDate).getTime();
|
||||||
if (premiereDate > new Date().getTime()) {
|
if (premiereDate > new Date().getTime()) {
|
||||||
return '<div class="unairedIndicator">Unaired</div>';
|
return '<div class="unairedIndicator">Unaired</div>';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue