mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fix spacing, update variables
This commit is contained in:
parent
a5e4039db4
commit
b946259777
3 changed files with 53 additions and 53 deletions
|
@ -12,10 +12,10 @@ import 'listViewStyle';
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function getEntryHtml(entry, apiClient) {
|
function getEntryHtml(entry, apiClient) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<div class="listItem listItem-border">';
|
html += '<div class="listItem listItem-border">';
|
||||||
var color = '#00a4dc';
|
let color = '#00a4dc';
|
||||||
var icon = 'notifications';
|
let icon = 'notifications';
|
||||||
|
|
||||||
if ('Error' == entry.Severity || 'Fatal' == entry.Severity || 'Warn' == entry.Severity) {
|
if ('Error' == entry.Severity || 'Fatal' == entry.Severity || 'Warn' == entry.Severity) {
|
||||||
color = '#cc0000';
|
color = '#cc0000';
|
||||||
|
@ -66,8 +66,8 @@ import 'listViewStyle';
|
||||||
}
|
}
|
||||||
|
|
||||||
limit = limit || parseInt(elem.getAttribute('data-activitylimit') || '7');
|
limit = limit || parseInt(elem.getAttribute('data-activitylimit') || '7');
|
||||||
var minDate = new Date();
|
const minDate = new Date();
|
||||||
var hasUserId = 'false' !== elem.getAttribute('data-useractivity');
|
const hasUserId = 'false' !== elem.getAttribute('data-useractivity');
|
||||||
|
|
||||||
if (hasUserId) {
|
if (hasUserId) {
|
||||||
minDate.setTime(minDate.getTime() - 24 * 60 * 60 * 1000); // one day back
|
minDate.setTime(minDate.getTime() - 24 * 60 * 60 * 1000); // one day back
|
||||||
|
@ -84,7 +84,7 @@ import 'listViewStyle';
|
||||||
elem.setAttribute('data-activitystartindex', startIndex);
|
elem.setAttribute('data-activitystartindex', startIndex);
|
||||||
elem.setAttribute('data-activitylimit', limit);
|
elem.setAttribute('data-activitylimit', limit);
|
||||||
if (!startIndex) {
|
if (!startIndex) {
|
||||||
var activityContainer = dom.parentWithClass(elem, 'activityContainer');
|
const activityContainer = dom.parentWithClass(elem, 'activityContainer');
|
||||||
|
|
||||||
if (activityContainer) {
|
if (activityContainer) {
|
||||||
if (result.Items.length) {
|
if (result.Items.length) {
|
||||||
|
@ -101,7 +101,7 @@ import 'listViewStyle';
|
||||||
}
|
}
|
||||||
|
|
||||||
function onActivityLogUpdate(e, apiClient, data) {
|
function onActivityLogUpdate(e, apiClient, data) {
|
||||||
var options = this.options;
|
const options = this.options;
|
||||||
|
|
||||||
if (options && options.serverId === apiClient.serverId()) {
|
if (options && options.serverId === apiClient.serverId()) {
|
||||||
reloadData(this, options.element, apiClient);
|
reloadData(this, options.element, apiClient);
|
||||||
|
@ -109,14 +109,14 @@ import 'listViewStyle';
|
||||||
}
|
}
|
||||||
|
|
||||||
function onListClick(e) {
|
function onListClick(e) {
|
||||||
var btnEntryInfo = dom.parentWithClass(e.target, 'btnEntryInfo');
|
const btnEntryInfo = dom.parentWithClass(e.target, 'btnEntryInfo');
|
||||||
|
|
||||||
if (btnEntryInfo) {
|
if (btnEntryInfo) {
|
||||||
var id = btnEntryInfo.getAttribute('data-id');
|
const id = btnEntryInfo.getAttribute('data-id');
|
||||||
var items = this.items;
|
const items = this.items;
|
||||||
|
|
||||||
if (items) {
|
if (items) {
|
||||||
var item = items.filter(function (i) {
|
const item = items.filter(function (i) {
|
||||||
return i.Id.toString() === id;
|
return i.Id.toString() === id;
|
||||||
})[0];
|
})[0];
|
||||||
|
|
||||||
|
@ -138,25 +138,25 @@ import 'listViewStyle';
|
||||||
class ActivityLog {
|
class ActivityLog {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
var element = options.element;
|
const element = options.element;
|
||||||
element.classList.add('activityLogListWidget');
|
element.classList.add('activityLogListWidget');
|
||||||
element.addEventListener('click', onListClick.bind(this));
|
element.addEventListener('click', onListClick.bind(this));
|
||||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
const apiClient = connectionManager.getApiClient(options.serverId);
|
||||||
reloadData(this, element, apiClient);
|
reloadData(this, element, apiClient);
|
||||||
var onUpdate = onActivityLogUpdate.bind(this);
|
const onUpdate = onActivityLogUpdate.bind(this);
|
||||||
this.updateFn = onUpdate;
|
this.updateFn = onUpdate;
|
||||||
events.on(serverNotifications, 'ActivityLogEntry', onUpdate);
|
events.on(serverNotifications, 'ActivityLogEntry', onUpdate);
|
||||||
apiClient.sendMessage('ActivityLogEntryStart', '0,1500');
|
apiClient.sendMessage('ActivityLogEntryStart', '0,1500');
|
||||||
}
|
}
|
||||||
destroy() {
|
destroy() {
|
||||||
var options = this.options;
|
const options = this.options;
|
||||||
|
|
||||||
if (options) {
|
if (options) {
|
||||||
options.element.classList.remove('activityLogListWidget');
|
options.element.classList.remove('activityLogListWidget');
|
||||||
connectionManager.getApiClient(options.serverId).sendMessage('ActivityLogEntryStop', '0,1500');
|
connectionManager.getApiClient(options.serverId).sendMessage('ActivityLogEntryStop', '0,1500');
|
||||||
}
|
}
|
||||||
|
|
||||||
var onUpdate = this.updateFn;
|
const onUpdate = this.updateFn;
|
||||||
|
|
||||||
if (onUpdate) {
|
if (onUpdate) {
|
||||||
events.off(serverNotifications, 'ActivityLogEntry', onUpdate);
|
events.off(serverNotifications, 'ActivityLogEntry', onUpdate);
|
||||||
|
@ -169,4 +169,4 @@ class ActivityLog {
|
||||||
|
|
||||||
export default ActivityLog;
|
export default ActivityLog;
|
||||||
|
|
||||||
/*eslint-enable indent */
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -2,16 +2,16 @@ import browser from 'browser';
|
||||||
import dialog from 'dialog';
|
import dialog from 'dialog';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
|
|
||||||
/*eslint-disable indent*/
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function replaceAll(originalString, strReplace, strWith) {
|
function replaceAll(originalString, strReplace, strWith) {
|
||||||
var reg = new RegExp(strReplace, 'ig');
|
const reg = new RegExp(strReplace, 'ig');
|
||||||
return originalString.replace(reg, strWith);
|
return originalString.replace(reg, strWith);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function (text, title) {
|
export default function (text, title) {
|
||||||
|
|
||||||
var options;
|
let options;
|
||||||
if (typeof text === 'string') {
|
if (typeof text === 'string') {
|
||||||
options = {
|
options = {
|
||||||
title: title,
|
title: title,
|
||||||
|
@ -24,7 +24,7 @@ import globalize from 'globalize';
|
||||||
if (browser.tv && window.alert) {
|
if (browser.tv && window.alert) {
|
||||||
alert(replaceAll(options.text || '', '<br/>', '\n'));
|
alert(replaceAll(options.text || '', '<br/>', '\n'));
|
||||||
} else {
|
} else {
|
||||||
var items = [];
|
const items = [];
|
||||||
|
|
||||||
items.push({
|
items.push({
|
||||||
name: globalize.translate('ButtonGotIt'),
|
name: globalize.translate('ButtonGotIt'),
|
||||||
|
@ -46,4 +46,4 @@ import globalize from 'globalize';
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*eslint-enable indent*/
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
|
|
||||||
/*eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
export function parseISO8601Date(s, toLocal) {
|
export function parseISO8601Date(s, toLocal) {
|
||||||
|
|
||||||
|
@ -8,9 +8,9 @@ import globalize from 'globalize';
|
||||||
// year month day hours minutes seconds
|
// year month day hours minutes seconds
|
||||||
// dotmilliseconds
|
// dotmilliseconds
|
||||||
// tzstring plusminus hours minutes
|
// tzstring plusminus hours minutes
|
||||||
var re = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?(Z|([+-])(\d{2}):(\d{2}))?/;
|
const re = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?(Z|([+-])(\d{2}):(\d{2}))?/;
|
||||||
|
|
||||||
var d = s.match(re);
|
const d = s.match(re);
|
||||||
|
|
||||||
// "2010-12-07T11:00:00.000-09:00" parses to:
|
// "2010-12-07T11:00:00.000-09:00" parses to:
|
||||||
// ["2010-12-07T11:00:00.000-09:00", "2010", "12", "07", "11",
|
// ["2010-12-07T11:00:00.000-09:00", "2010", "12", "07", "11",
|
||||||
|
@ -25,8 +25,8 @@ import globalize from 'globalize';
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse strings, leading zeros into proper ints
|
// parse strings, leading zeros into proper ints
|
||||||
var a = [1, 2, 3, 4, 5, 6, 10, 11];
|
const a = [1, 2, 3, 4, 5, 6, 10, 11];
|
||||||
for (var i in a) {
|
for (let i in a) {
|
||||||
d[a[i]] = parseInt(d[a[i]], 10);
|
d[a[i]] = parseInt(d[a[i]], 10);
|
||||||
}
|
}
|
||||||
d[7] = parseFloat(d[7]);
|
d[7] = parseFloat(d[7]);
|
||||||
|
@ -34,7 +34,7 @@ import globalize from 'globalize';
|
||||||
// Date.UTC(year, month[, date[, hrs[, min[, sec[, ms]]]]])
|
// Date.UTC(year, month[, date[, hrs[, min[, sec[, ms]]]]])
|
||||||
// note that month is 0-11, not 1-12
|
// note that month is 0-11, not 1-12
|
||||||
// see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/UTC
|
// see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/UTC
|
||||||
var ms = Date.UTC(d[1], d[2] - 1, d[3], d[4], d[5], d[6]);
|
let ms = Date.UTC(d[1], d[2] - 1, d[3], d[4], d[5], d[6]);
|
||||||
|
|
||||||
// if there are milliseconds, add them
|
// if there are milliseconds, add them
|
||||||
if (d[7] > 0) {
|
if (d[7] > 0) {
|
||||||
|
@ -43,7 +43,7 @@ import globalize from 'globalize';
|
||||||
|
|
||||||
// if there's a timezone, calculate it
|
// if there's a timezone, calculate it
|
||||||
if (d[8] !== 'Z' && d[10]) {
|
if (d[8] !== 'Z' && d[10]) {
|
||||||
var offset = d[10] * 60 * 60 * 1000;
|
let offset = d[10] * 60 * 60 * 1000;
|
||||||
if (d[11]) {
|
if (d[11]) {
|
||||||
offset += d[11] * 60 * 1000;
|
offset += d[11] * 60 * 1000;
|
||||||
}
|
}
|
||||||
|
@ -60,13 +60,13 @@ import globalize from 'globalize';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDisplayRunningTime(ticks) {
|
export function getDisplayRunningTime(ticks) {
|
||||||
var ticksPerHour = 36000000000;
|
const ticksPerHour = 36000000000;
|
||||||
var ticksPerMinute = 600000000;
|
const ticksPerMinute = 600000000;
|
||||||
var ticksPerSecond = 10000000;
|
const ticksPerSecond = 10000000;
|
||||||
|
|
||||||
var parts = [];
|
const parts = [];
|
||||||
|
|
||||||
var hours = ticks / ticksPerHour;
|
let hours = ticks / ticksPerHour;
|
||||||
hours = Math.floor(hours);
|
hours = Math.floor(hours);
|
||||||
|
|
||||||
if (hours) {
|
if (hours) {
|
||||||
|
@ -75,7 +75,7 @@ import globalize from 'globalize';
|
||||||
|
|
||||||
ticks -= (hours * ticksPerHour);
|
ticks -= (hours * ticksPerHour);
|
||||||
|
|
||||||
var minutes = ticks / ticksPerMinute;
|
let minutes = ticks / ticksPerMinute;
|
||||||
minutes = Math.floor(minutes);
|
minutes = Math.floor(minutes);
|
||||||
|
|
||||||
ticks -= (minutes * ticksPerMinute);
|
ticks -= (minutes * ticksPerMinute);
|
||||||
|
@ -85,7 +85,7 @@ import globalize from 'globalize';
|
||||||
}
|
}
|
||||||
parts.push(minutes);
|
parts.push(minutes);
|
||||||
|
|
||||||
var seconds = ticks / ticksPerSecond;
|
let seconds = ticks / ticksPerSecond;
|
||||||
seconds = Math.floor(seconds);
|
seconds = Math.floor(seconds);
|
||||||
|
|
||||||
if (seconds < 10) {
|
if (seconds < 10) {
|
||||||
|
@ -96,7 +96,7 @@ import globalize from 'globalize';
|
||||||
return parts.join(':');
|
return parts.join(':');
|
||||||
}
|
}
|
||||||
|
|
||||||
var toLocaleTimeStringSupportsLocales = function () {
|
const toLocaleTimeStringSupportsLocales = function () {
|
||||||
try {
|
try {
|
||||||
new Date().toLocaleTimeString('i');
|
new Date().toLocaleTimeString('i');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -107,9 +107,9 @@ import globalize from 'globalize';
|
||||||
|
|
||||||
function getOptionList(options) {
|
function getOptionList(options) {
|
||||||
|
|
||||||
var list = [];
|
const list = [];
|
||||||
|
|
||||||
for (var i in options) {
|
for (const i in options) {
|
||||||
list.push({
|
list.push({
|
||||||
name: i,
|
name: i,
|
||||||
value: options[i]
|
value: options[i]
|
||||||
|
@ -129,7 +129,7 @@ import globalize from 'globalize';
|
||||||
|
|
||||||
if (toLocaleTimeStringSupportsLocales) {
|
if (toLocaleTimeStringSupportsLocales) {
|
||||||
|
|
||||||
var currentLocale = globalize.getCurrentDateTimeLocale();
|
const currentLocale = globalize.getCurrentDateTimeLocale();
|
||||||
|
|
||||||
if (currentLocale) {
|
if (currentLocale) {
|
||||||
return date.toLocaleString(currentLocale, options);
|
return date.toLocaleString(currentLocale, options);
|
||||||
|
@ -149,7 +149,7 @@ import globalize from 'globalize';
|
||||||
|
|
||||||
if (toLocaleTimeStringSupportsLocales) {
|
if (toLocaleTimeStringSupportsLocales) {
|
||||||
|
|
||||||
var currentLocale = globalize.getCurrentDateTimeLocale();
|
const currentLocale = globalize.getCurrentDateTimeLocale();
|
||||||
|
|
||||||
if (currentLocale) {
|
if (currentLocale) {
|
||||||
return date.toLocaleDateString(currentLocale, options);
|
return date.toLocaleDateString(currentLocale, options);
|
||||||
|
@ -157,9 +157,9 @@ import globalize from 'globalize';
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is essentially a hard-coded polyfill
|
// This is essentially a hard-coded polyfill
|
||||||
var optionList = getOptionList(options);
|
const optionList = getOptionList(options);
|
||||||
if (optionList.length === 1 && optionList[0].name === 'weekday') {
|
if (optionList.length === 1 && optionList[0].name === 'weekday') {
|
||||||
var weekday = [];
|
const weekday = [];
|
||||||
weekday[0] = 'Sun';
|
weekday[0] = 'Sun';
|
||||||
weekday[1] = 'Mon';
|
weekday[1] = 'Mon';
|
||||||
weekday[2] = 'Tue';
|
weekday[2] = 'Tue';
|
||||||
|
@ -183,7 +183,7 @@ import globalize from 'globalize';
|
||||||
|
|
||||||
if (toLocaleTimeStringSupportsLocales) {
|
if (toLocaleTimeStringSupportsLocales) {
|
||||||
|
|
||||||
var currentLocale = globalize.getCurrentDateTimeLocale();
|
const currentLocale = globalize.getCurrentDateTimeLocale();
|
||||||
|
|
||||||
if (currentLocale) {
|
if (currentLocale) {
|
||||||
return date.toLocaleTimeString(currentLocale, options);
|
return date.toLocaleTimeString(currentLocale, options);
|
||||||
|
@ -218,19 +218,19 @@ import globalize from 'globalize';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var time = toLocaleTimeString(date);
|
let time = toLocaleTimeString(date);
|
||||||
|
|
||||||
var timeLower = time.toLowerCase();
|
const timeLower = time.toLowerCase();
|
||||||
|
|
||||||
if (timeLower.indexOf('am') !== -1 || timeLower.indexOf('pm') !== -1) {
|
if (timeLower.indexOf('am') !== -1 || timeLower.indexOf('pm') !== -1) {
|
||||||
|
|
||||||
time = timeLower;
|
time = timeLower;
|
||||||
var hour = date.getHours() % 12;
|
let hour = date.getHours() % 12;
|
||||||
var suffix = date.getHours() > 11 ? 'pm' : 'am';
|
const suffix = date.getHours() > 11 ? 'pm' : 'am';
|
||||||
if (!hour) {
|
if (!hour) {
|
||||||
hour = 12;
|
hour = 12;
|
||||||
}
|
}
|
||||||
var minutes = date.getMinutes();
|
let minutes = date.getMinutes();
|
||||||
|
|
||||||
if (minutes < 10) {
|
if (minutes < 10) {
|
||||||
minutes = '0' + minutes;
|
minutes = '0' + minutes;
|
||||||
|
@ -240,7 +240,7 @@ import globalize from 'globalize';
|
||||||
time = hour + minutes + suffix;
|
time = hour + minutes + suffix;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
var timeParts = time.split(':');
|
const timeParts = time.split(':');
|
||||||
|
|
||||||
// Trim off seconds
|
// Trim off seconds
|
||||||
if (timeParts.length > 2) {
|
if (timeParts.length > 2) {
|
||||||
|
@ -260,8 +260,8 @@ import globalize from 'globalize';
|
||||||
throw new Error('date cannot be null');
|
throw new Error('date cannot be null');
|
||||||
}
|
}
|
||||||
|
|
||||||
var yesterday = new Date();
|
const yesterday = new Date();
|
||||||
var day = yesterday.getDate() + offsetInDays;
|
const day = yesterday.getDate() + offsetInDays;
|
||||||
|
|
||||||
yesterday.setDate(day); // automatically adjusts month/year appropriately
|
yesterday.setDate(day); // automatically adjusts month/year appropriately
|
||||||
|
|
||||||
|
@ -281,4 +281,4 @@ import globalize from 'globalize';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*eslint-enable indent */
|
/* eslint-enable indent */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue