mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
indicator migrated to es6
This commit is contained in:
parent
66a18f93d8
commit
eb29d0b6a7
3 changed files with 30 additions and 47 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -9,3 +9,6 @@ node_modules
|
||||||
# ide
|
# ide
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
|
#log
|
||||||
|
yarn-error.log
|
||||||
|
|
|
@ -104,7 +104,8 @@
|
||||||
"src/scripts/inputManager.js",
|
"src/scripts/inputManager.js",
|
||||||
"src/components/deleteHelper.js",
|
"src/components/deleteHelper.js",
|
||||||
"src/components/actionSheet/actionSheet.js",
|
"src/components/actionSheet/actionSheet.js",
|
||||||
"src/components/playMenu.js"
|
"src/components/playMenu.js",
|
||||||
|
"src/components/indicators/indicators.js"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@babel/plugin-transform-modules-amd"
|
"@babel/plugin-transform-modules-amd"
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
define(['datetime', 'itemHelper', 'emby-progressbar', 'css!./indicators.css', 'material-icons'], function (datetime, itemHelper) {
|
import datetime from 'datetime';
|
||||||
'use strict';
|
import itemHelper from 'itemHelper';
|
||||||
|
import 'emby-progressbar';
|
||||||
|
import 'css!./indicators.css';
|
||||||
|
import 'material-icons';
|
||||||
|
|
||||||
function enableProgressIndicator(item) {
|
export function enableProgressIndicator(item) {
|
||||||
if (item.MediaType === 'Video') {
|
if (item.MediaType === 'Video' && item.Type !== 'TvChannel') {
|
||||||
if (item.Type !== 'TvChannel') {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (item.Type === 'AudioBook' || item.Type === 'AudioPodcast') {
|
if (item.Type === 'AudioBook' || item.Type === 'AudioPodcast') {
|
||||||
return true;
|
return true;
|
||||||
|
@ -15,34 +16,20 @@ define(['datetime', 'itemHelper', 'emby-progressbar', 'css!./indicators.css', 'm
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProgressHtml(pct, options) {
|
export function getProgressHtml(pct, options) {
|
||||||
var containerClass = 'itemProgressBar';
|
var containerClass = options && options.containerClass ? 'itemProgressBar ' + options.containerClass : 'itemProgressBar';
|
||||||
if (options) {
|
|
||||||
if (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 = 'itemProgressBar';
|
var containerClass = options && options.containerClass ? 'itemProgressBar ' + options.containerClass : 'itemProgressBar';
|
||||||
if (options) {
|
var foregroundClass = isRecording ? 'itemProgressBarForeground itemProgressBarForeground-recording' : 'itemProgressBarForeground';
|
||||||
if (options.containerClass) {
|
|
||||||
containerClass += ' ' + options.containerClass;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var 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>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProgressBarHtml(item, options) {
|
export function getProgressBarHtml(item, options) {
|
||||||
var pct;
|
var pct;
|
||||||
if (enableProgressIndicator(item) && item.Type !== "Recording") {
|
if (enableProgressIndicator(item) && item.Type !== "Recording") {
|
||||||
var userData = options ? (options.userData || item.UserData) : item.UserData;
|
var userData = options ? (options.userData || item.UserData) : item.UserData;
|
||||||
|
@ -78,11 +65,11 @@ define(['datetime', 'itemHelper', 'emby-progressbar', 'css!./indicators.css', 'm
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function enablePlayedIndicator(item) {
|
export function enablePlayedIndicator(item) {
|
||||||
return itemHelper.canMarkPlayed(item);
|
return itemHelper.canMarkPlayed(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPlayedIndicator(item) {
|
export function getPlayedIndicatorHtml(item) {
|
||||||
if (enablePlayedIndicator(item)) {
|
if (enablePlayedIndicator(item)) {
|
||||||
var userData = item.UserData || {};
|
var userData = item.UserData || {};
|
||||||
if (userData.UnplayedItemCount) {
|
if (userData.UnplayedItemCount) {
|
||||||
|
@ -97,24 +84,17 @@ define(['datetime', 'itemHelper', 'emby-progressbar', 'css!./indicators.css', 'm
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCountIndicatorHtml(count) {
|
export function getChildCountIndicatorHtml(item, options) {
|
||||||
return '<div class="countIndicator indicator">' + count + '</div>';
|
var minCount = options ? options.minCount : 0;
|
||||||
}
|
|
||||||
|
|
||||||
function getChildCountIndicatorHtml(item, options) {
|
|
||||||
var minCount = 0;
|
|
||||||
if (options) {
|
|
||||||
minCount = options.minCount || minCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.ChildCount && item.ChildCount > minCount) {
|
if (item.ChildCount && item.ChildCount > minCount) {
|
||||||
return getCountIndicatorHtml(item.ChildCount);
|
return '<div class="countIndicator indicator">' + item.ChildCount + '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTimerIndicator(item) {
|
export function getTimerIndicator(item) {
|
||||||
var status;
|
var status;
|
||||||
|
|
||||||
if (item.Type === 'SeriesTimer') {
|
if (item.Type === 'SeriesTimer') {
|
||||||
|
@ -138,7 +118,7 @@ define(['datetime', 'itemHelper', 'emby-progressbar', 'css!./indicators.css', 'm
|
||||||
return '<i class="material-icons timerIndicator indicatorIcon fiber_manual_record"></i>';
|
return '<i class="material-icons timerIndicator indicatorIcon fiber_manual_record"></i>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSyncIndicator(item) {
|
export function getSyncIndicator(item) {
|
||||||
if (item.SyncPercent === 100) {
|
if (item.SyncPercent === 100) {
|
||||||
return '<div class="syncIndicator indicator fullSyncIndicator"><i class="material-icons indicatorIcon file_download"></i></div>';
|
return '<div class="syncIndicator indicator fullSyncIndicator"><i class="material-icons indicatorIcon file_download"></i></div>';
|
||||||
} else if (item.SyncPercent != null) {
|
} else if (item.SyncPercent != null) {
|
||||||
|
@ -148,7 +128,7 @@ define(['datetime', 'itemHelper', 'emby-progressbar', 'css!./indicators.css', 'm
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTypeIndicator(item) {
|
export function getTypeIndicator(item) {
|
||||||
if (item.Type === 'Video') {
|
if (item.Type === 'Video') {
|
||||||
return '<div class="indicator videoIndicator"><i class="material-icons indicatorIcon">videocam</i></div>';
|
return '<div class="indicator videoIndicator"><i class="material-icons indicatorIcon">videocam</i></div>';
|
||||||
}
|
}
|
||||||
|
@ -165,7 +145,7 @@ define(['datetime', 'itemHelper', 'emby-progressbar', 'css!./indicators.css', 'm
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
@ -183,10 +163,10 @@ define(['datetime', 'itemHelper', 'emby-progressbar', 'css!./indicators.css', 'm
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
getProgressHtml: getProgressHtml,
|
getProgressHtml: getProgressHtml,
|
||||||
getProgressBarHtml: getProgressBarHtml,
|
getProgressBarHtml: getProgressBarHtml,
|
||||||
getPlayedIndicatorHtml: getPlayedIndicator,
|
getPlayedIndicatorHtml: getPlayedIndicatorHtml,
|
||||||
getChildCountIndicatorHtml: getChildCountIndicatorHtml,
|
getChildCountIndicatorHtml: getChildCountIndicatorHtml,
|
||||||
enableProgressIndicator: enableProgressIndicator,
|
enableProgressIndicator: enableProgressIndicator,
|
||||||
getTimerIndicator: getTimerIndicator,
|
getTimerIndicator: getTimerIndicator,
|
||||||
|
@ -195,4 +175,3 @@ define(['datetime', 'itemHelper', 'emby-progressbar', 'css!./indicators.css', 'm
|
||||||
getTypeIndicator: getTypeIndicator,
|
getTypeIndicator: getTypeIndicator,
|
||||||
getMissingIndicator: getMissingIndicator
|
getMissingIndicator: getMissingIndicator
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue