mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix lint errors
This commit is contained in:
parent
7d9acf30b6
commit
4730a30c3d
29 changed files with 53 additions and 23 deletions
|
@ -17,6 +17,7 @@ const GenresItemsContainer: FC<GenresItemsContainerProps> = ({
|
||||||
parentId,
|
parentId,
|
||||||
collectionType,
|
collectionType,
|
||||||
itemType
|
itemType
|
||||||
|
// eslint-disable-next-line sonarjs/function-return-type
|
||||||
}) => {
|
}) => {
|
||||||
const { isLoading, data: genresResult } = useGetGenres(itemType, parentId);
|
const { isLoading, data: genresResult } = useGetGenres(itemType, parentId);
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import SectionContainer from 'components/common/SectionContainer';
|
||||||
import { CardShape } from 'utils/card';
|
import { CardShape } from 'utils/card';
|
||||||
import type { LibraryViewProps } from 'types/library';
|
import type { LibraryViewProps } from 'types/library';
|
||||||
|
|
||||||
|
// eslint-disable-next-line sonarjs/function-return-type
|
||||||
const UpcomingView: FC<LibraryViewProps> = ({ parentId }) => {
|
const UpcomingView: FC<LibraryViewProps> = ({ parentId }) => {
|
||||||
const { isLoading, data: groupsUpcomingEpisodes } =
|
const { isLoading, data: groupsUpcomingEpisodes } =
|
||||||
useGetGroupsUpcomingEpisodes(parentId);
|
useGetGroupsUpcomingEpisodes(parentId);
|
||||||
|
|
|
@ -17,6 +17,7 @@ export interface MovedItem {
|
||||||
playlistItemId: string
|
playlistItemId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line sonarjs/redundant-type-aliases
|
||||||
export type PlayerErrorCode = string;
|
export type PlayerErrorCode = string;
|
||||||
|
|
||||||
export interface PlayerStopInfo {
|
export interface PlayerStopInfo {
|
||||||
|
|
|
@ -16,6 +16,7 @@ const MarkdownBox: FC<MarkdownBoxProps> = ({
|
||||||
<Box
|
<Box
|
||||||
dangerouslySetInnerHTML={
|
dangerouslySetInnerHTML={
|
||||||
markdown ?
|
markdown ?
|
||||||
|
// eslint-disable-next-line sonarjs/disabled-auto-escaping
|
||||||
{ __html: DOMPurify.sanitize(markdownIt({ html: true }).render(markdown)) } :
|
{ __html: DOMPurify.sanitize(markdownIt({ html: true }).render(markdown)) } :
|
||||||
undefined
|
undefined
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ interface CardTextProps {
|
||||||
|
|
||||||
const CardText: FC<CardTextProps> = ({ className, textLine }) => {
|
const CardText: FC<CardTextProps> = ({ className, textLine }) => {
|
||||||
const { title, titleAction } = textLine;
|
const { title, titleAction } = textLine;
|
||||||
|
// eslint-disable-next-line sonarjs/function-return-type
|
||||||
const renderCardText = () => {
|
const renderCardText = () => {
|
||||||
if (titleAction) {
|
if (titleAction) {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -323,7 +323,7 @@ function shouldShowMediaTitle(
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldShowExtraType(itemExtraType: NullableString) {
|
function shouldShowExtraType(itemExtraType: NullableString) {
|
||||||
return itemExtraType && itemExtraType !== 'Unknown';
|
return !!(itemExtraType && itemExtraType !== 'Unknown');
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldShowSeriesYearOrYear(
|
function shouldShowSeriesYearOrYear(
|
||||||
|
@ -351,7 +351,7 @@ function shouldShowPersonRoleOrType(
|
||||||
showPersonRoleOrType: boolean | undefined,
|
showPersonRoleOrType: boolean | undefined,
|
||||||
item: ItemDto
|
item: ItemDto
|
||||||
) {
|
) {
|
||||||
return showPersonRoleOrType && (item as BaseItemPerson).Role;
|
return !!(showPersonRoleOrType && (item as BaseItemPerson).Role);
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldShowParentTitle(
|
function shouldShowParentTitle(
|
||||||
|
|
|
@ -195,6 +195,7 @@ function buildCardsHtmlInternal(items, options) {
|
||||||
if (isVertical) {
|
if (isVertical) {
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line sonarjs/no-dead-store
|
||||||
hasOpenSection = false;
|
hasOpenSection = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,6 +216,7 @@ function buildCardsHtmlInternal(items, options) {
|
||||||
if (options.rows && itemsInRow === 0) {
|
if (options.rows && itemsInRow === 0) {
|
||||||
if (hasOpenRow) {
|
if (hasOpenRow) {
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
// eslint-disable-next-line sonarjs/no-dead-store
|
||||||
hasOpenRow = false;
|
hasOpenRow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import globalize from '../../../lib/globalize';
|
||||||
import IconButtonElement from '../../../elements/IconButtonElement';
|
import IconButtonElement from '../../../elements/IconButtonElement';
|
||||||
|
|
||||||
type AccessScheduleListProps = {
|
type AccessScheduleListProps = {
|
||||||
index: number;
|
index?: number;
|
||||||
DayOfWeek?: string;
|
DayOfWeek?: string;
|
||||||
StartHour?: number ;
|
StartHour?: number ;
|
||||||
EndHour?: number;
|
EndHour?: number;
|
||||||
|
|
|
@ -3,7 +3,6 @@ import globalize from 'lib/globalize';
|
||||||
import { getBackdropShape, getPortraitShape, getSquareShape } from 'utils/card';
|
import { getBackdropShape, getPortraitShape, getSquareShape } from 'utils/card';
|
||||||
import { getParameterByName } from 'utils/url';
|
import { getParameterByName } from 'utils/url';
|
||||||
|
|
||||||
import { appHost } from './apphost';
|
|
||||||
import cardBuilder from './cardbuilder/cardBuilder';
|
import cardBuilder from './cardbuilder/cardBuilder';
|
||||||
import imageLoader from './images/imageLoader';
|
import imageLoader from './images/imageLoader';
|
||||||
import layoutManager from './layoutManager';
|
import layoutManager from './layoutManager';
|
||||||
|
@ -160,8 +159,10 @@ function loadSection(elem, userId, topParentId, section, isSingleSection) {
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer vertical-wrap padded-left padded-right">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer vertical-wrap padded-left padded-right">';
|
||||||
}
|
}
|
||||||
|
|
||||||
let cardLayout = appHost.preferVisualCards && section.autoCardLayout && section.showTitle;
|
// NOTE: Why is card layout always disabled?
|
||||||
cardLayout = false;
|
// let cardLayout = appHost.preferVisualCards && section.autoCardLayout && section.showTitle;
|
||||||
|
const cardLayout = false;
|
||||||
|
|
||||||
html += cardBuilder.getCardsHtml(result.Items, {
|
html += cardBuilder.getCardsHtml(result.Items, {
|
||||||
preferThumb: section.preferThumb,
|
preferThumb: section.preferThumb,
|
||||||
shape: section.shape,
|
shape: section.shape,
|
||||||
|
|
|
@ -74,6 +74,7 @@ function fetchWithTimeout(url, options, timeoutMs) {
|
||||||
*/
|
*/
|
||||||
function paramsToString(params) {
|
function paramsToString(params) {
|
||||||
return Object.entries(params)
|
return Object.entries(params)
|
||||||
|
// eslint-disable-next-line sonarjs/different-types-comparison
|
||||||
.filter(([, v]) => v !== null && v !== undefined && v !== '')
|
.filter(([, v]) => v !== null && v !== undefined && v !== '')
|
||||||
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
|
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
|
||||||
.join('&');
|
.join('&');
|
||||||
|
|
|
@ -389,6 +389,7 @@ function intersectsInternal(a1, a2, b1, b2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function intersects(a1, a2, b1, b2) {
|
function intersects(a1, a2, b1, b2) {
|
||||||
|
// eslint-disable-next-line sonarjs/arguments-order
|
||||||
return intersectsInternal(a1, a2, b1, b2) || intersectsInternal(b1, b2, a1, a2);
|
return intersectsInternal(a1, a2, b1, b2) || intersectsInternal(b1, b2, a1, a2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ export function handleHlsJsMediaError(instance, reject) {
|
||||||
let now = Date.now();
|
let now = Date.now();
|
||||||
|
|
||||||
if (window.performance?.now) {
|
if (window.performance?.now) {
|
||||||
now = performance.now(); // eslint-disable-line compat/compat
|
now = performance.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!recoverDecodingErrorDate || (now - recoverDecodingErrorDate) > 3000) {
|
if (!recoverDecodingErrorDate || (now - recoverDecodingErrorDate) > 3000) {
|
||||||
|
@ -373,6 +373,7 @@ export function getBufferedRanges(instance, elem) {
|
||||||
start = 0;
|
start = 0;
|
||||||
}
|
}
|
||||||
if (!isValidDuration(end)) {
|
if (!isValidDuration(end)) {
|
||||||
|
// eslint-disable-next-line sonarjs/no-dead-store
|
||||||
end = 0;
|
end = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -417,6 +417,7 @@ export function getListViewHtml(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableOverview && item.Overview) {
|
if (enableOverview && item.Overview) {
|
||||||
|
// eslint-disable-next-line sonarjs/disabled-auto-escaping
|
||||||
const overview = DOMPurify.sanitize(markdownIt({ html: true }).render(item.Overview || ''));
|
const overview = DOMPurify.sanitize(markdownIt({ html: true }).render(item.Overview || ''));
|
||||||
html += '<div class="secondary listItem-overview listItemBodyText">';
|
html += '<div class="secondary listItem-overview listItemBodyText">';
|
||||||
html += '<bdi>' + overview + '</bdi>';
|
html += '<bdi>' + overview + '</bdi>';
|
||||||
|
|
|
@ -13,6 +13,7 @@ interface MediaInfoItemProps {
|
||||||
const MediaInfoItem: FC<MediaInfoItemProps> = ({ className, miscInfo }) => {
|
const MediaInfoItem: FC<MediaInfoItemProps> = ({ className, miscInfo }) => {
|
||||||
const { text, textAction, cssClass, type } = miscInfo;
|
const { text, textAction, cssClass, type } = miscInfo;
|
||||||
|
|
||||||
|
// eslint-disable-next-line sonarjs/function-return-type
|
||||||
const renderText = () => {
|
const renderText = () => {
|
||||||
if (textAction) {
|
if (textAction) {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -208,6 +208,7 @@ function getMimeType(type, container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getParam(name, url) {
|
function getParam(name, url) {
|
||||||
|
// eslint-disable-next-line sonarjs/single-char-in-character-classes
|
||||||
name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
|
name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
|
||||||
const regexS = '[\\?&]' + name + '=([^&#]*)';
|
const regexS = '[\\?&]' + name + '=([^&#]*)';
|
||||||
const regex = new RegExp(regexS, 'i');
|
const regex = new RegExp(regexS, 'i');
|
||||||
|
@ -2115,6 +2116,7 @@ export class PlaybackManager {
|
||||||
|
|
||||||
if (!state) {
|
if (!state) {
|
||||||
playerStates[player.name] = {};
|
playerStates[player.name] = {};
|
||||||
|
// eslint-disable-next-line sonarjs/no-dead-store
|
||||||
state = playerStates[player.name];
|
state = playerStates[player.name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,7 @@ class SkipSegment extends PlaybackSubscriber {
|
||||||
elem.classList.remove('no-transition');
|
elem.classList.remove('no-transition');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line sonarjs/void-use
|
||||||
void elem.offsetWidth;
|
void elem.offsetWidth;
|
||||||
|
|
||||||
const hasFocus = document.activeElement && focusManager.isCurrentlyFocusable(document.activeElement);
|
const hasFocus = document.activeElement && focusManager.isCurrentlyFocusable(document.activeElement);
|
||||||
|
@ -111,6 +112,7 @@ class SkipSegment extends PlaybackSubscriber {
|
||||||
const elem = this.skipElement;
|
const elem = this.skipElement;
|
||||||
if (elem) {
|
if (elem) {
|
||||||
elem.classList.remove('no-transition');
|
elem.classList.remove('no-transition');
|
||||||
|
// eslint-disable-next-line sonarjs/void-use
|
||||||
void elem.offsetWidth;
|
void elem.offsetWidth;
|
||||||
|
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
// TODO: Check if needed and move to external dependency
|
// TODO: Check if needed and move to external dependency
|
||||||
// From https://github.com/parshap/node-sanitize-filename
|
// From https://github.com/parshap/node-sanitize-filename
|
||||||
|
|
||||||
|
// eslint-disable-next-line sonarjs/duplicates-in-character-class
|
||||||
const illegalRe = /[/?<>\\:*|":]/g;
|
const illegalRe = /[/?<>\\:*|":]/g;
|
||||||
// eslint-disable-next-line no-control-regex
|
// eslint-disable-next-line no-control-regex, sonarjs/no-control-regex
|
||||||
const controlRe = /[\x00-\x1f\x80-\x9f]/g;
|
const controlRe = /[\x00-\x1f\x80-\x9f]/g;
|
||||||
const reservedRe = /^\.+$/;
|
const reservedRe = /^\.+$/;
|
||||||
|
// eslint-disable-next-line sonarjs/concise-regex
|
||||||
const windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;
|
const windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;
|
||||||
|
// eslint-disable-next-line sonarjs/slow-regex
|
||||||
const windowsTrailingRe = /[. ]+$/;
|
const windowsTrailingRe = /[. ]+$/;
|
||||||
|
|
||||||
function isHighSurrogate(codePoint) {
|
function isHighSurrogate(codePoint) {
|
||||||
|
@ -64,6 +67,7 @@ function truncate(string, byteLength) {
|
||||||
segment = string[i];
|
segment = string[i];
|
||||||
|
|
||||||
if (isHighSurrogate(codePoint) && isLowSurrogate(string.charCodeAt(i + 1))) {
|
if (isHighSurrogate(codePoint) && isLowSurrogate(string.charCodeAt(i + 1))) {
|
||||||
|
// eslint-disable-next-line sonarjs/updated-loop-counter
|
||||||
i += 1;
|
i += 1;
|
||||||
segment += string[i];
|
segment += string[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { appHost } from 'components/apphost';
|
|
||||||
import cardBuilder from 'components/cardbuilder/cardBuilder';
|
import cardBuilder from 'components/cardbuilder/cardBuilder';
|
||||||
import focusManager from 'components/focusManager';
|
import focusManager from 'components/focusManager';
|
||||||
import layoutManager from 'components/layoutManager';
|
import layoutManager from 'components/layoutManager';
|
||||||
|
@ -202,8 +201,9 @@ function getRouteUrl(section, serverId) {
|
||||||
|
|
||||||
function getItemsHtmlFn(section) {
|
function getItemsHtmlFn(section) {
|
||||||
return function (items) {
|
return function (items) {
|
||||||
let cardLayout = appHost.preferVisualCards && section.autoCardLayout && section.showTitle;
|
// NOTE: Why is card layout always disabled?
|
||||||
cardLayout = false;
|
// let cardLayout = appHost.preferVisualCards && section.autoCardLayout && section.showTitle;
|
||||||
|
const cardLayout = false;
|
||||||
const serverId = this.apiClient.serverId();
|
const serverId = this.apiClient.serverId();
|
||||||
const leadingButtons = layoutManager.tv ? [{
|
const leadingButtons = layoutManager.tv ? [{
|
||||||
name: globalize.translate('All'),
|
name: globalize.translate('All'),
|
||||||
|
|
|
@ -877,6 +877,7 @@ function renderOverview(page, item) {
|
||||||
const overviewElements = page.querySelectorAll('.overview');
|
const overviewElements = page.querySelectorAll('.overview');
|
||||||
|
|
||||||
if (overviewElements.length > 0) {
|
if (overviewElements.length > 0) {
|
||||||
|
// eslint-disable-next-line sonarjs/disabled-auto-escaping
|
||||||
const overview = DOMPurify.sanitize(markdownIt({ html: true }).render(item.Overview || ''));
|
const overview = DOMPurify.sanitize(markdownIt({ html: true }).render(item.Overview || ''));
|
||||||
|
|
||||||
if (overview) {
|
if (overview) {
|
||||||
|
@ -1378,6 +1379,7 @@ function renderChildren(page, item) {
|
||||||
if (item.Type == 'MusicAlbum') {
|
if (item.Type == 'MusicAlbum') {
|
||||||
let showArtist = false;
|
let showArtist = false;
|
||||||
for (const track of result.Items) {
|
for (const track of result.Items) {
|
||||||
|
// eslint-disable-next-line sonarjs/no-alphabetical-sort
|
||||||
if (!isEqual(track.ArtistItems.map(x => x.Id).sort(), track.AlbumArtists.map(x => x.Id).sort())) {
|
if (!isEqual(track.ArtistItems.map(x => x.Id).sort(), track.AlbumArtists.map(x => x.Id).sort())) {
|
||||||
showArtist = true;
|
showArtist = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -36,6 +36,7 @@ function handleConnectionResult(page, result) {
|
||||||
|
|
||||||
function submitServer(page) {
|
function submitServer(page) {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
// eslint-disable-next-line sonarjs/slow-regex
|
||||||
const host = page.querySelector('#txtServerHost').value.replace(/\/+$/, '');
|
const host = page.querySelector('#txtServerHost').value.replace(/\/+$/, '');
|
||||||
ServerConnections.connectToAddress(host, {
|
ServerConnections.connectToAddress(host, {
|
||||||
enableAutoLogin: appSettings.enableAutoLogin()
|
enableAutoLogin: appSettings.enableAutoLogin()
|
||||||
|
|
|
@ -292,6 +292,7 @@ export default function (view, params) {
|
||||||
apiClient.getJSON(apiClient.getUrl('Branding/Configuration')).then(function (options) {
|
apiClient.getJSON(apiClient.getUrl('Branding/Configuration')).then(function (options) {
|
||||||
const loginDisclaimer = view.querySelector('.loginDisclaimer');
|
const loginDisclaimer = view.querySelector('.loginDisclaimer');
|
||||||
|
|
||||||
|
// eslint-disable-next-line sonarjs/disabled-auto-escaping
|
||||||
loginDisclaimer.innerHTML = DOMPurify.sanitize(markdownIt({ html: true }).render(options.LoginDisclaimer || ''));
|
loginDisclaimer.innerHTML = DOMPurify.sanitize(markdownIt({ html: true }).render(options.LoginDisclaimer || ''));
|
||||||
|
|
||||||
for (const elem of loginDisclaimer.querySelectorAll('a')) {
|
for (const elem of loginDisclaimer.querySelectorAll('a')) {
|
||||||
|
|
|
@ -13,7 +13,8 @@ function slideDownToShow(button, elem) {
|
||||||
elem.style.height = '0';
|
elem.style.height = '0';
|
||||||
// trigger reflow
|
// trigger reflow
|
||||||
// TODO: Find a better way to do this
|
// TODO: Find a better way to do this
|
||||||
const newHeight = elem.offsetHeight; /* eslint-disable-line no-unused-vars */
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, sonarjs/no-unused-vars, sonarjs/no-dead-store
|
||||||
|
const newHeight = elem.offsetHeight;
|
||||||
elem.style.height = height;
|
elem.style.height = height;
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
@ -35,7 +36,8 @@ function slideUpToHide(button, elem) {
|
||||||
elem.style.height = elem.offsetHeight + 'px';
|
elem.style.height = elem.offsetHeight + 'px';
|
||||||
// trigger reflow
|
// trigger reflow
|
||||||
// TODO: Find a better way to do this
|
// TODO: Find a better way to do this
|
||||||
const newHeight = elem.offsetHeight; /* eslint-disable-line no-unused-vars */
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, sonarjs/no-unused-vars, sonarjs/no-dead-store
|
||||||
|
const newHeight = elem.offsetHeight;
|
||||||
elem.classList.remove('expanded');
|
elem.classList.remove('expanded');
|
||||||
elem.style.height = '0';
|
elem.style.height = '0';
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,7 @@ function updateValues(isValueSet) {
|
||||||
if (!!isValueSet && !supportsValueAutoSnap) {
|
if (!!isValueSet && !supportsValueAutoSnap) {
|
||||||
const value = snapValue(this, parseFloat(this.value)).toString();
|
const value = snapValue(this, parseFloat(this.value)).toString();
|
||||||
|
|
||||||
|
// eslint-disable-next-line sonarjs/different-types-comparison
|
||||||
if (this.value !== value) {
|
if (this.value !== value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
const realPlay = HTMLMediaElementPrototype.play;
|
const realPlay = HTMLMediaElementPrototype.play;
|
||||||
|
|
||||||
HTMLMediaElementPrototype.play = function () {
|
HTMLMediaElementPrototype.play = function () {
|
||||||
|
// eslint-disable-next-line sonarjs/no-try-promise
|
||||||
try {
|
try {
|
||||||
const promise = realPlay.apply(this, arguments);
|
const promise = realPlay.apply(this, arguments);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ function type(value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof value === 'object' || typeof value === 'function') {
|
if (typeof value === 'object' || typeof value === 'function') {
|
||||||
|
// eslint-disable-next-line sonarjs/prefer-regexp-exec
|
||||||
return Object.prototype.toString.call(value).match(/\s([a-z]+)/i)[1].toLowerCase() || 'object';
|
return Object.prototype.toString.call(value).match(/\s([a-z]+)/i)[1].toLowerCase() || 'object';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ function iOSversion() {
|
||||||
/Version\/(\d+)/
|
/Version\/(\d+)/
|
||||||
];
|
];
|
||||||
for (const test of tests) {
|
for (const test of tests) {
|
||||||
const matches = (navigator.appVersion).match(test);
|
const matches = RegExp(test).exec(navigator.appVersion);
|
||||||
if (matches) {
|
if (matches) {
|
||||||
return [
|
return [
|
||||||
parseInt(matches[1], 10),
|
parseInt(matches[1], 10),
|
||||||
|
@ -163,6 +163,7 @@ function supportsCssAnimation(allowPrefix) {
|
||||||
const domPrefixes = ['Webkit', 'O', 'Moz'];
|
const domPrefixes = ['Webkit', 'O', 'Moz'];
|
||||||
const elm = document.createElement('div');
|
const elm = document.createElement('div');
|
||||||
|
|
||||||
|
// eslint-disable-next-line sonarjs/different-types-comparison
|
||||||
if (elm.style.animationName !== undefined) {
|
if (elm.style.animationName !== undefined) {
|
||||||
animation = true;
|
animation = true;
|
||||||
}
|
}
|
||||||
|
@ -298,7 +299,7 @@ if (browser.web0s) {
|
||||||
delete browser.chrome;
|
delete browser.chrome;
|
||||||
delete browser.safari;
|
delete browser.safari;
|
||||||
} else if (browser.tizen) {
|
} else if (browser.tizen) {
|
||||||
const v = (navigator.appVersion).match(/Tizen (\d+).(\d+)/);
|
const v = RegExp(/Tizen (\d+).(\d+)/).exec(navigator.appVersion);
|
||||||
browser.tizenVersion = parseInt(v[1], 10);
|
browser.tizenVersion = parseInt(v[1], 10);
|
||||||
|
|
||||||
// UserAgent string contains 'Chrome' and 'Safari', but we only want 'tizen' to be true
|
// UserAgent string contains 'Chrome' and 'Safari', but we only want 'tizen' to be true
|
||||||
|
@ -319,7 +320,6 @@ if (browser.mobile || browser.tv) {
|
||||||
browser.slow = true;
|
browser.slow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-disable-next-line compat/compat */
|
|
||||||
if (typeof document !== 'undefined' && ('ontouchstart' in window) || (navigator.maxTouchPoints > 0)) {
|
if (typeof document !== 'undefined' && ('ontouchstart' in window) || (navigator.maxTouchPoints > 0)) {
|
||||||
browser.touch = true;
|
browser.touch = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,8 @@ function supportsVc1(videoTestElement) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function supportsHdr10(options) {
|
function supportsHdr10(options) {
|
||||||
return options.supportsHdr10 ?? (false // eslint-disable-line sonarjs/no-redundant-boolean
|
// eslint-disable-next-line no-constant-binary-expression, sonarjs/no-redundant-boolean
|
||||||
|
return options.supportsHdr10 ?? (false
|
||||||
|| browser.vidaa
|
|| browser.vidaa
|
||||||
|| browser.tizen
|
|| browser.tizen
|
||||||
|| browser.web0s
|
|| browser.web0s
|
||||||
|
@ -253,7 +254,8 @@ function supportsHlg(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function supportsDolbyVision(options) {
|
function supportsDolbyVision(options) {
|
||||||
return options.supportsDolbyVision ?? (false // eslint-disable-line sonarjs/no-redundant-boolean
|
// eslint-disable-next-line no-constant-binary-expression, sonarjs/no-redundant-boolean
|
||||||
|
return options.supportsDolbyVision ?? (false
|
||||||
|| browser.safari && ((browser.iOS && browser.iOSVersion >= 13) || browser.osx)
|
|| browser.safari && ((browser.iOS && browser.iOSVersion >= 13) || browser.osx)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -512,10 +514,8 @@ export default function (options) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-disable compat/compat */
|
|
||||||
let maxVideoWidth = browser.xboxOne ? window.screen?.width : null;
|
let maxVideoWidth = browser.xboxOne ? window.screen?.width : null;
|
||||||
|
|
||||||
/* eslint-enable compat/compat */
|
|
||||||
if (options.maxVideoWidth) {
|
if (options.maxVideoWidth) {
|
||||||
maxVideoWidth = options.maxVideoWidth;
|
maxVideoWidth = options.maxVideoWidth;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ function textAreaCopy(text) {
|
||||||
} else {
|
} else {
|
||||||
ret = Promise.reject();
|
ret = Promise.reject();
|
||||||
}
|
}
|
||||||
} catch (_) {
|
} catch {
|
||||||
ret = Promise.reject();
|
ret = Promise.reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,11 +48,10 @@ function textAreaCopy(text) {
|
||||||
* @returns {Promise<void>} Promise.
|
* @returns {Promise<void>} Promise.
|
||||||
*/
|
*/
|
||||||
export function copy(text) {
|
export function copy(text) {
|
||||||
/* eslint-disable-next-line compat/compat */
|
// eslint-disable-next-line sonarjs/different-types-comparison
|
||||||
if (navigator.clipboard === undefined) {
|
if (navigator.clipboard === undefined) {
|
||||||
return textAreaCopy(text);
|
return textAreaCopy(text);
|
||||||
} else {
|
} else {
|
||||||
/* eslint-disable-next-line compat/compat */
|
|
||||||
return navigator.clipboard.writeText(text).catch(() => {
|
return navigator.clipboard.writeText(text).catch(() => {
|
||||||
return textAreaCopy(text);
|
return textAreaCopy(text);
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,6 +23,7 @@ const DEV_MODE = process.env.NODE_ENV !== 'production';
|
||||||
let COMMIT_SHA = '';
|
let COMMIT_SHA = '';
|
||||||
try {
|
try {
|
||||||
COMMIT_SHA = require('child_process')
|
COMMIT_SHA = require('child_process')
|
||||||
|
// eslint-disable-next-line sonarjs/no-os-command-from-path
|
||||||
.execSync('git describe --always --dirty')
|
.execSync('git describe --always --dirty')
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue