mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-15 09:58:18 -07:00
Merge pull request #4773 from thornbill/consistent-curly-braces
This commit is contained in:
commit
e382f72c21
@ -30,6 +30,7 @@ module.exports = {
|
||||
'brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
|
||||
'comma-dangle': ['error', 'never'],
|
||||
'comma-spacing': ['error'],
|
||||
'curly': ['error', 'multi-line', 'consistent'],
|
||||
'default-case-last': ['error'],
|
||||
'eol-last': ['error'],
|
||||
'indent': ['error', 4, { 'SwitchCase': 1 }],
|
||||
|
@ -2324,30 +2324,23 @@ class PlaybackManager {
|
||||
|
||||
let prevRelIndex = 0;
|
||||
for (const stream of prevSource.MediaStreams) {
|
||||
if (stream.Type != streamType)
|
||||
continue;
|
||||
if (stream.Type != streamType) continue;
|
||||
|
||||
if (stream.Index == prevIndex)
|
||||
break;
|
||||
if (stream.Index == prevIndex) break;
|
||||
|
||||
prevRelIndex += 1;
|
||||
}
|
||||
|
||||
let newRelIndex = 0;
|
||||
for (const stream of mediaSource.MediaStreams) {
|
||||
if (stream.Type != streamType)
|
||||
continue;
|
||||
if (stream.Type != streamType) continue;
|
||||
|
||||
let score = 0;
|
||||
|
||||
if (prevStream.Codec == stream.Codec)
|
||||
score += 1;
|
||||
if (prevRelIndex == newRelIndex)
|
||||
score += 1;
|
||||
if (prevStream.DisplayTitle && prevStream.DisplayTitle == stream.DisplayTitle)
|
||||
score += 2;
|
||||
if (prevStream.Language && prevStream.Language != 'und' && prevStream.Language == stream.Language)
|
||||
score += 2;
|
||||
if (prevStream.Codec == stream.Codec) score += 1;
|
||||
if (prevRelIndex == newRelIndex) score += 1;
|
||||
if (prevStream.DisplayTitle && prevStream.DisplayTitle == stream.DisplayTitle) score += 2;
|
||||
if (prevStream.Language && prevStream.Language != 'und' && prevStream.Language == stream.Language) score += 2;
|
||||
|
||||
console.debug(`AutoSet ${streamType} - Score ${score} for ${stream.Index} - ${stream.DisplayTitle}`);
|
||||
if (score > bestStreamScore && score >= 3) {
|
||||
@ -2367,8 +2360,9 @@ class PlaybackManager {
|
||||
mediaSource.DefaultSubtitleStreamIndex = bestStreamIndex;
|
||||
}
|
||||
}
|
||||
if (streamType == 'Audio')
|
||||
if (streamType == 'Audio') {
|
||||
mediaSource.DefaultAudioStreamIndex = bestStreamIndex;
|
||||
}
|
||||
} else {
|
||||
console.debug(`AutoSet ${streamType} - Threshold not met. Using default.`);
|
||||
}
|
||||
|
@ -514,10 +514,12 @@ export default function (options) {
|
||||
function toggleFullscreenButtons(isFullscreen) {
|
||||
const btnFullscreen = dialog.querySelector('.btnFullscreen');
|
||||
const btnFullscreenExit = dialog.querySelector('.btnFullscreenExit');
|
||||
if (btnFullscreen)
|
||||
if (btnFullscreen) {
|
||||
btnFullscreen.classList.toggle('hide', isFullscreen);
|
||||
if (btnFullscreenExit)
|
||||
}
|
||||
if (btnFullscreenExit) {
|
||||
btnFullscreenExit.classList.toggle('hide', !isFullscreen);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,10 +110,11 @@ function load(page, devices) {
|
||||
deviceHtml += '<div class="cardFooter">';
|
||||
|
||||
if (canDelete(device.Id)) {
|
||||
if (globalize.getIsRTL())
|
||||
if (globalize.getIsRTL()) {
|
||||
deviceHtml += '<div style="text-align:left; float:left;padding-top:5px;">';
|
||||
else
|
||||
} else {
|
||||
deviceHtml += '<div style="text-align:right; float:right;padding-top:5px;">';
|
||||
}
|
||||
deviceHtml += '<button type="button" is="paper-icon-button-light" data-id="' + escapeHtml(device.Id) + '" title="' + globalize.translate('Menu') + '" class="btnDeviceMenu"><span class="material-icons more_vert" aria-hidden="true"></span></button>';
|
||||
deviceHtml += '</div>';
|
||||
}
|
||||
|
@ -309,9 +309,7 @@ function getVirtualFolderHtml(page, virtualFolder, index) {
|
||||
html += '<div class="cardFooter visualCardBox-cardFooter">'; // always show menu unless explicitly hidden
|
||||
|
||||
if (virtualFolder.showMenu !== false) {
|
||||
let dirTextAlign = 'right';
|
||||
if (globalize.getIsRTL())
|
||||
dirTextAlign = 'left';
|
||||
const dirTextAlign = globalize.getIsRTL() ? 'left' : 'right';
|
||||
html += '<div style="text-align:' + dirTextAlign + '; float:' + dirTextAlign + ';padding-top:5px;">';
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnCardMenu autoSize"><span class="material-icons more_vert" aria-hidden="true"></span></button>';
|
||||
html += '</div>';
|
||||
|
@ -83,10 +83,11 @@ function getPluginCardHtml(plugin, pluginConfigurationPages) {
|
||||
html += '<div class="cardFooter">';
|
||||
|
||||
if (configPage || plugin.CanUninstall) {
|
||||
if (globalize.getIsRTL())
|
||||
if (globalize.getIsRTL()) {
|
||||
html += '<div style="text-align:left; float:left;padding-top:5px;">';
|
||||
else
|
||||
} else {
|
||||
html += '<div style="text-align:right; float:right;padding-top:5px;">';
|
||||
}
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnCardMenu autoSize"><span class="material-icons more_vert" aria-hidden="true"></span></button>';
|
||||
html += '</div>';
|
||||
}
|
||||
|
@ -57,9 +57,7 @@ function populateList(page, tasks) {
|
||||
html += '<span class="material-icons listItemIcon schedule" aria-hidden="true"></span>';
|
||||
html += '</a>';
|
||||
html += '<div class="listItemBody two-line">';
|
||||
let textAlignStyle = 'left';
|
||||
if (globalize.getIsRTL())
|
||||
textAlignStyle = 'right';
|
||||
const textAlignStyle = globalize.getIsRTL() ? 'right' : 'left';
|
||||
html += "<a class='clearLink' style='margin:0;padding:0;display:block;text-align:" + textAlignStyle + ";' is='emby-linkbutton' href='scheduledtask.html?id=" + task.Id + "'>";
|
||||
html += "<h3 class='listItemBodyText'>" + task.Name + '</h3>';
|
||||
html += "<div class='secondary listItemBodyText' id='taskProgress" + task.Id + "'>" + getTaskProgressHtml(task) + '</div>';
|
||||
|
@ -306,8 +306,7 @@ export default function (view) {
|
||||
|
||||
function onHideAnimationComplete(e) {
|
||||
const elem = e.target;
|
||||
if (elem != osdBottomElement)
|
||||
return;
|
||||
if (elem != osdBottomElement) return;
|
||||
elem.classList.add('hide');
|
||||
dom.removeEventListener(elem, transitionEndEventName, onHideAnimationComplete, {
|
||||
once: true
|
||||
|
@ -30,8 +30,9 @@ function mapClientToFraction(range, clientX) {
|
||||
const rect = range.sliderBubbleTrack.getBoundingClientRect();
|
||||
|
||||
let fraction = (clientX - rect.left) / rect.width;
|
||||
if (globalize.getIsElementRTL(range))
|
||||
if (globalize.getIsElementRTL(range)) {
|
||||
fraction = (rect.right - clientX) / rect.width;
|
||||
}
|
||||
|
||||
// Snap to step
|
||||
const valueRange = range.max - range.min;
|
||||
@ -490,10 +491,11 @@ EmbySliderPrototype.setKeyboardSteps = function (stepDown, stepUp) {
|
||||
|
||||
function setRange(elem, startPercent, endPercent) {
|
||||
const style = elem.style;
|
||||
if (globalize.getIsRTL())
|
||||
if (globalize.getIsRTL()) {
|
||||
style.right = Math.max(startPercent, 0) + '%';
|
||||
else
|
||||
} else {
|
||||
style.left = Math.max(startPercent, 0) + '%';
|
||||
}
|
||||
|
||||
const widthPercent = endPercent - startPercent;
|
||||
style.width = Math.max(Math.min(widthPercent, 100), 0) + '%';
|
||||
|
@ -206,10 +206,11 @@ class NavDrawer {
|
||||
|
||||
options.target.classList.add('touch-menu-la');
|
||||
options.target.style.width = options.width + 'px';
|
||||
if (globalize.getIsRTL())
|
||||
if (globalize.getIsRTL()) {
|
||||
options.target.style.right = -options.width + 'px';
|
||||
else
|
||||
} else {
|
||||
options.target.style.left = -options.width + 'px';
|
||||
}
|
||||
|
||||
if (!options.disableMask) {
|
||||
this.mask = document.createElement('div');
|
||||
|
@ -189,8 +189,9 @@ const scrollerFactory = function (frame, options) {
|
||||
|
||||
// Set position limits & relatives
|
||||
self._pos.end = Math.max(slideeSize - frameSize, 0);
|
||||
if (globalize.getIsRTL())
|
||||
if (globalize.getIsRTL()) {
|
||||
self._pos.end *= -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,10 +95,11 @@ export class ComicsPlayer {
|
||||
onDirChanged = () => {
|
||||
let langDir = this.comicsPlayerSettings.langDir;
|
||||
|
||||
if (!langDir || langDir === 'ltr')
|
||||
if (!langDir || langDir === 'ltr') {
|
||||
langDir = 'rtl';
|
||||
else
|
||||
} else {
|
||||
langDir = 'ltr';
|
||||
}
|
||||
|
||||
this.changeLanguageDirection(langDir);
|
||||
|
||||
@ -125,10 +126,11 @@ export class ComicsPlayer {
|
||||
onViewChanged = () => {
|
||||
let view = this.comicsPlayerSettings.pagesPerView;
|
||||
|
||||
if (!view || view === 1)
|
||||
if (!view || view === 1) {
|
||||
view = 2;
|
||||
else
|
||||
} else {
|
||||
view = 1;
|
||||
}
|
||||
|
||||
this.changeView(view);
|
||||
|
||||
|
@ -64,8 +64,9 @@ function checkAndProcessDir(culture) {
|
||||
function setDocumentDirection(direction) {
|
||||
document.getElementsByTagName('body')[0].setAttribute('dir', direction);
|
||||
document.getElementsByTagName('html')[0].setAttribute('dir', direction);
|
||||
if (direction === Direction.rtl)
|
||||
if (direction === Direction.rtl) {
|
||||
import('../styles/rtl.scss');
|
||||
}
|
||||
}
|
||||
|
||||
export function getIsElementRTL(element) {
|
||||
|
Loading…
Reference in New Issue
Block a user