mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add eslint radix rule for parseInt
This commit is contained in:
parent
9e784034d3
commit
329cf77c81
42 changed files with 90 additions and 91 deletions
|
@ -19,7 +19,7 @@ import template from './accessSchedule.template.html';
|
|||
const pct = hours % 1;
|
||||
|
||||
if (pct) {
|
||||
minutes = parseInt(60 * pct);
|
||||
minutes = parseInt(60 * pct, 10);
|
||||
}
|
||||
|
||||
return datetime.getDisplayTime(new Date(2000, 1, 1, hours, minutes, 0, 0));
|
||||
|
|
|
@ -64,10 +64,10 @@ import { toBoolean } from '../utils/string.ts';
|
|||
|
||||
function reloadData(instance, elem, apiClient, startIndex, limit) {
|
||||
if (startIndex == null) {
|
||||
startIndex = parseInt(elem.getAttribute('data-activitystartindex') || '0');
|
||||
startIndex = parseInt(elem.getAttribute('data-activitystartindex') || '0', 10);
|
||||
}
|
||||
|
||||
limit = limit || parseInt(elem.getAttribute('data-activitylimit') || '7');
|
||||
limit = limit || parseInt(elem.getAttribute('data-activitylimit') || '7', 10);
|
||||
const minDate = new Date();
|
||||
const hasUserId = toBoolean(elem.getAttribute('data-useractivity'), true);
|
||||
|
||||
|
|
|
@ -663,7 +663,7 @@ import { appRouter } from '../appRouter';
|
|||
const character = String(str.slice(charIndex, charIndex + 1).charCodeAt());
|
||||
let sum = 0;
|
||||
for (let i = 0; i < character.length; i++) {
|
||||
sum += parseInt(character.charAt(i));
|
||||
sum += parseInt(character.charAt(i), 10);
|
||||
}
|
||||
const index = String(sum).slice(-1);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import ServerConnections from './ServerConnections';
|
|||
const playedIndicator = card.querySelector('.playedIndicator');
|
||||
const playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null;
|
||||
const options = {
|
||||
Limit: parseInt(playedIndicatorHtml || '10'),
|
||||
Limit: parseInt(playedIndicatorHtml || '10', 10),
|
||||
Fields: 'PrimaryImageAspectRatio,DateCreated',
|
||||
ParentId: itemId,
|
||||
GroupItems: false
|
||||
|
|
|
@ -1149,12 +1149,12 @@ function Guide(options) {
|
|||
guideContext.querySelector('.guideDateTabs').addEventListener('tabchange', function (e) {
|
||||
const allTabButtons = e.target.querySelectorAll('.guide-date-tab-button');
|
||||
|
||||
const tabButton = allTabButtons[parseInt(e.detail.selectedTabIndex)];
|
||||
const tabButton = allTabButtons[parseInt(e.detail.selectedTabIndex, 10)];
|
||||
if (tabButton) {
|
||||
const previousButton = e.detail.previousIndex == null ? null : allTabButtons[parseInt(e.detail.previousIndex)];
|
||||
const previousButton = e.detail.previousIndex == null ? null : allTabButtons[parseInt(e.detail.previousIndex, 10)];
|
||||
|
||||
const date = new Date();
|
||||
date.setTime(parseInt(tabButton.getAttribute('data-date')));
|
||||
date.setTime(parseInt(tabButton.getAttribute('data-date'), 10));
|
||||
|
||||
const scrollWidth = programGrid.scrollWidth;
|
||||
let scrollToTimeMs;
|
||||
|
@ -1166,7 +1166,7 @@ function Guide(options) {
|
|||
|
||||
if (previousButton) {
|
||||
const previousDate = new Date();
|
||||
previousDate.setTime(parseInt(previousButton.getAttribute('data-date')));
|
||||
previousDate.setTime(parseInt(previousButton.getAttribute('data-date'), 10));
|
||||
|
||||
scrollToTimeMs += (previousDate.getHours() * 60 * 60 * 1000);
|
||||
scrollToTimeMs += (previousDate.getMinutes() * 60 * 1000);
|
||||
|
|
|
@ -278,9 +278,9 @@ import template from './imageeditor.template.html';
|
|||
const apiClient = ServerConnections.getApiClient(serverId);
|
||||
|
||||
const type = imageCard.getAttribute('data-imagetype');
|
||||
const index = parseInt(imageCard.getAttribute('data-index'));
|
||||
const providerCount = parseInt(imageCard.getAttribute('data-providers'));
|
||||
const numImages = parseInt(imageCard.getAttribute('data-numimages'));
|
||||
const index = parseInt(imageCard.getAttribute('data-index'), 10);
|
||||
const providerCount = parseInt(imageCard.getAttribute('data-providers'), 10);
|
||||
const numImages = parseInt(imageCard.getAttribute('data-numimages'), 10);
|
||||
|
||||
import('../actionSheet/actionSheet').then(({default: actionSheet}) => {
|
||||
const commands = [];
|
||||
|
@ -385,7 +385,7 @@ import template from './imageeditor.template.html';
|
|||
addListeners(context, 'btnDeleteImage', 'click', function () {
|
||||
const type = this.getAttribute('data-imagetype');
|
||||
let index = this.getAttribute('data-index');
|
||||
index = index === 'null' ? null : parseInt(index);
|
||||
index = index === 'null' ? null : parseInt(index, 10);
|
||||
const apiClient = ServerConnections.getApiClient(currentItem.ServerId);
|
||||
deleteImage(context, currentItem.Id, type, index, apiClient, true);
|
||||
});
|
||||
|
|
|
@ -138,7 +138,7 @@ const attributeDelimiterHtml = layoutManager.tv ? '' : '<span class="hide">: </s
|
|||
attributes.push(createAttribute(globalize.translate('MediaInfoChannels'), `${stream.Channels} ch`));
|
||||
}
|
||||
if (stream.BitRate) {
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoBitrate'), `${parseInt(stream.BitRate / 1000)} kbps`));
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoBitrate'), `${parseInt(stream.BitRate / 1000, 10)} kbps`));
|
||||
}
|
||||
if (stream.SampleRate) {
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoSampleRate'), `${stream.SampleRate} Hz`));
|
||||
|
|
|
@ -52,7 +52,7 @@ import datetime from '../../scripts/datetime';
|
|||
|
||||
if (value) {
|
||||
if (identifyField[i].type === 'number') {
|
||||
value = parseInt(value);
|
||||
value = parseInt(value, 10);
|
||||
}
|
||||
|
||||
lookupInfo[identifyField[i].getAttribute('data-lookup')] = value;
|
||||
|
@ -123,7 +123,7 @@ import datetime from '../../scripts/datetime';
|
|||
elem.innerHTML = html;
|
||||
|
||||
function onSearchImageClick() {
|
||||
const index = parseInt(this.getAttribute('data-index'));
|
||||
const index = parseInt(this.getAttribute('data-index'), 10);
|
||||
|
||||
const currentResult = results[index];
|
||||
|
||||
|
|
|
@ -531,7 +531,7 @@ import template from './libraryoptionseditor.template.html';
|
|||
PreferredMetadataLanguage: parent.querySelector('#selectLanguage').value,
|
||||
MetadataCountryCode: parent.querySelector('#selectCountry').value,
|
||||
SeasonZeroDisplayName: parent.querySelector('#txtSeasonZeroName').value,
|
||||
AutomaticRefreshIntervalDays: parseInt(parent.querySelector('#selectAutoRefreshInterval').value),
|
||||
AutomaticRefreshIntervalDays: parseInt(parent.querySelector('#selectAutoRefreshInterval').value, 10),
|
||||
EnableEmbeddedTitles: parent.querySelector('#chkEnableEmbeddedTitles').checked,
|
||||
EnableEmbeddedExtrasTitles: parent.querySelector('#chkEnableEmbeddedExtrasTitles').checked,
|
||||
EnableEmbeddedEpisodeInfos: parent.querySelector('#chkEnableEmbeddedEpisodeInfos').checked,
|
||||
|
|
|
@ -168,7 +168,7 @@ import template from './mediaLibraryCreator.template.html';
|
|||
|
||||
function onRemoveClick(e) {
|
||||
const button = dom.parentWithClass(e.target, 'btnRemovePath');
|
||||
const index = parseInt(button.getAttribute('data-index'));
|
||||
const index = parseInt(button.getAttribute('data-index'), 10);
|
||||
const location = pathInfos[index].Path;
|
||||
const locationLower = location.toLowerCase();
|
||||
pathInfos = pathInfos.filter(p => {
|
||||
|
|
|
@ -93,7 +93,7 @@ import template from './mediaLibraryEditor.template.html';
|
|||
const listItem = dom.parentWithClass(e.target, 'listItem');
|
||||
|
||||
if (listItem) {
|
||||
const index = parseInt(listItem.getAttribute('data-index'));
|
||||
const index = parseInt(listItem.getAttribute('data-index'), 10);
|
||||
const pathInfos = (currentOptions.library.LibraryOptions || {}).PathInfos || [];
|
||||
const pathInfo = index == null ? {} : pathInfos[index] || {};
|
||||
const originalPath = pathInfo.Path || (index == null ? null : currentOptions.library.Locations[index]);
|
||||
|
|
|
@ -357,14 +357,14 @@ import template from './metadataEditor.template.html';
|
|||
let index;
|
||||
const btnDeletePerson = dom.parentWithClass(e.target, 'btnDeletePerson');
|
||||
if (btnDeletePerson) {
|
||||
index = parseInt(btnDeletePerson.getAttribute('data-index'));
|
||||
index = parseInt(btnDeletePerson.getAttribute('data-index'), 10);
|
||||
currentItem.People.splice(index, 1);
|
||||
populatePeople(context, currentItem.People);
|
||||
}
|
||||
|
||||
const btnEditPerson = dom.parentWithClass(e.target, 'btnEditPerson');
|
||||
if (btnEditPerson) {
|
||||
index = parseInt(btnEditPerson.getAttribute('data-index'));
|
||||
index = parseInt(btnEditPerson.getAttribute('data-index'), 10);
|
||||
editPerson(context, currentItem.People[index], index);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -114,8 +114,8 @@ import shell from '../../scripts/shell';
|
|||
const itemId = item.Id;
|
||||
|
||||
// Convert to ms
|
||||
const duration = parseInt(item.RunTimeTicks ? (item.RunTimeTicks / 10000) : 0);
|
||||
const currentTime = parseInt(playState.PositionTicks ? (playState.PositionTicks / 10000) : 0);
|
||||
const duration = parseInt(item.RunTimeTicks ? (item.RunTimeTicks / 10000) : 0, 10);
|
||||
const currentTime = parseInt(playState.PositionTicks ? (playState.PositionTicks / 10000) : 0, 10);
|
||||
|
||||
const isPaused = playState.IsPaused || false;
|
||||
const canSeek = playState.CanSeek || false;
|
||||
|
@ -247,7 +247,7 @@ import shell from '../../scripts/shell';
|
|||
navigator.mediaSession.setActionHandler('seekto', function (object) {
|
||||
const item = playbackManager.getPlayerState(currentPlayer).NowPlayingItem;
|
||||
// Convert to ms
|
||||
const duration = parseInt(item.RunTimeTicks ? (item.RunTimeTicks / 10000) : 0);
|
||||
const duration = parseInt(item.RunTimeTicks ? (item.RunTimeTicks / 10000) : 0, 10);
|
||||
const wantedTime = object.seekTime * 1000;
|
||||
playbackManager.seekPercent(wantedTime / duration * 100, currentPlayer);
|
||||
});
|
||||
|
|
|
@ -1690,7 +1690,7 @@ class PlaybackManager {
|
|||
|
||||
function changeStream(player, ticks, params) {
|
||||
if (canPlayerSeek(player) && params == null) {
|
||||
player.currentTime(parseInt(ticks / 10000));
|
||||
player.currentTime(parseInt(ticks / 10000, 10));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1714,7 +1714,7 @@ class PlaybackManager {
|
|||
const apiClient = ServerConnections.getApiClient(currentItem.ServerId);
|
||||
|
||||
if (ticks) {
|
||||
ticks = parseInt(ticks);
|
||||
ticks = parseInt(ticks, 10);
|
||||
}
|
||||
|
||||
const maxBitrate = params.MaxStreamingBitrate || self.getMaxStreamingBitrate(player);
|
||||
|
@ -3645,7 +3645,7 @@ class PlaybackManager {
|
|||
|
||||
percent /= 100;
|
||||
ticks *= percent;
|
||||
this.seek(parseInt(ticks), player);
|
||||
this.seek(parseInt(ticks, 10), player);
|
||||
}
|
||||
|
||||
seekMs(ms, player = this._currentPlayer) {
|
||||
|
@ -4032,13 +4032,13 @@ class PlaybackManager {
|
|||
this.setBrightness(cmd.Arguments.Brightness, player);
|
||||
break;
|
||||
case 'SetAudioStreamIndex':
|
||||
this.setAudioStreamIndex(parseInt(cmd.Arguments.Index), player);
|
||||
this.setAudioStreamIndex(parseInt(cmd.Arguments.Index, 10), player);
|
||||
break;
|
||||
case 'SetSubtitleStreamIndex':
|
||||
this.setSubtitleStreamIndex(parseInt(cmd.Arguments.Index), player);
|
||||
this.setSubtitleStreamIndex(parseInt(cmd.Arguments.Index, 10), player);
|
||||
break;
|
||||
case 'SetMaxStreamingBitrate':
|
||||
this.setMaxStreamingBitrate(parseInt(cmd.Arguments.Bitrate), player);
|
||||
this.setMaxStreamingBitrate(parseInt(cmd.Arguments.Bitrate, 10), player);
|
||||
break;
|
||||
case 'ToggleFullscreen':
|
||||
this.toggleFullscreen(player);
|
||||
|
|
|
@ -43,7 +43,7 @@ function showQualityMenu(player, btn) {
|
|||
items: menuItems,
|
||||
positionTo: btn
|
||||
}).then(function (id) {
|
||||
const bitrate = parseInt(id);
|
||||
const bitrate = parseInt(id, 10);
|
||||
if (bitrate !== selectedBitrate) {
|
||||
playbackManager.setMaxStreamingBitrate({
|
||||
enableAutomaticBitrateDetection: bitrate ? false : true,
|
||||
|
|
|
@ -20,8 +20,6 @@ import ServerConnections from '../ServerConnections';
|
|||
import toast from '../toast/toast';
|
||||
import { appRouter } from '../appRouter';
|
||||
|
||||
/*eslint prefer-const: "error"*/
|
||||
|
||||
let showMuteButton = true;
|
||||
let showVolumeSlider = true;
|
||||
|
||||
|
@ -46,7 +44,7 @@ function showAudioMenu(context, player, button) {
|
|||
items: menuItems,
|
||||
positionTo: button,
|
||||
callback: function (id) {
|
||||
playbackManager.setAudioStreamIndex(parseInt(id), player);
|
||||
playbackManager.setAudioStreamIndex(parseInt(id, 10), player);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -78,7 +76,7 @@ function showSubtitleMenu(context, player, button) {
|
|||
items: menuItems,
|
||||
positionTo: button,
|
||||
callback: function (id) {
|
||||
playbackManager.setSubtitleStreamIndex(parseInt(id), player);
|
||||
playbackManager.setSubtitleStreamIndex(parseInt(id, 10), player);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -150,7 +150,7 @@ import toast from './toast/toast';
|
|||
StartDate: card.getAttribute('data-startdate'),
|
||||
EndDate: card.getAttribute('data-enddate'),
|
||||
UserData: {
|
||||
PlaybackPositionTicks: parseInt(card.getAttribute('data-positionticks') || '0')
|
||||
PlaybackPositionTicks: parseInt(card.getAttribute('data-positionticks') || '0', 10)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ import toast from './toast/toast';
|
|||
ServerId: serverId
|
||||
});
|
||||
} else if (action === 'play' || action === 'resume') {
|
||||
const startPositionTicks = parseInt(card.getAttribute('data-positionticks') || '0');
|
||||
const startPositionTicks = parseInt(card.getAttribute('data-positionticks') || '0', 10);
|
||||
|
||||
if (playbackManager.canPlay(item)) {
|
||||
playbackManager.play({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue