Merge pull request #4773 from thornbill/consistent-curly-braces

This commit is contained in:
Bill Thornton 2023-09-14 10:51:21 -04:00 committed by GitHub
commit e382f72c21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 41 additions and 40 deletions

View File

@ -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 }],

View File

@ -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.`);
}

View File

@ -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);
}
}
/**

View File

@ -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>';
}

View File

@ -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>';

View File

@ -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>';
}

View File

@ -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>';

View File

@ -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

View File

@ -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) + '%';

View File

@ -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');

View File

@ -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;
}
}
}

View File

@ -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);

View File

@ -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) {