Fix curly bracket issues

This commit is contained in:
Bill Thornton 2023-09-12 17:29:03 -04:00
parent 101abc762b
commit d6bcc7466b
12 changed files with 40 additions and 40 deletions

View file

@ -2345,30 +2345,23 @@ class PlaybackManager {
let prevRelIndex = 0; let prevRelIndex = 0;
for (const stream of prevSource.MediaStreams) { for (const stream of prevSource.MediaStreams) {
if (stream.Type != streamType) if (stream.Type != streamType) continue;
continue;
if (stream.Index == prevIndex) if (stream.Index == prevIndex) break;
break;
prevRelIndex += 1; prevRelIndex += 1;
} }
let newRelIndex = 0; let newRelIndex = 0;
for (const stream of mediaSource.MediaStreams) { for (const stream of mediaSource.MediaStreams) {
if (stream.Type != streamType) if (stream.Type != streamType) continue;
continue;
let score = 0; let score = 0;
if (prevStream.Codec == stream.Codec) if (prevStream.Codec == stream.Codec) score += 1;
score += 1; if (prevRelIndex == newRelIndex) score += 1;
if (prevRelIndex == newRelIndex) if (prevStream.DisplayTitle && prevStream.DisplayTitle == stream.DisplayTitle) score += 2;
score += 1; if (prevStream.Language && prevStream.Language != 'und' && prevStream.Language == stream.Language) score += 2;
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}`); console.debug(`AutoSet ${streamType} - Score ${score} for ${stream.Index} - ${stream.DisplayTitle}`);
if (score > bestStreamScore && score >= 3) { if (score > bestStreamScore && score >= 3) {
@ -2388,8 +2381,9 @@ class PlaybackManager {
mediaSource.DefaultSubtitleStreamIndex = bestStreamIndex; mediaSource.DefaultSubtitleStreamIndex = bestStreamIndex;
} }
} }
if (streamType == 'Audio') if (streamType == 'Audio') {
mediaSource.DefaultAudioStreamIndex = bestStreamIndex; mediaSource.DefaultAudioStreamIndex = bestStreamIndex;
}
} else { } else {
console.debug(`AutoSet ${streamType} - Threshold not met. Using default.`); console.debug(`AutoSet ${streamType} - Threshold not met. Using default.`);
} }

View file

@ -514,11 +514,13 @@ export default function (options) {
function toggleFullscreenButtons(isFullscreen) { function toggleFullscreenButtons(isFullscreen) {
const btnFullscreen = dialog.querySelector('.btnFullscreen'); const btnFullscreen = dialog.querySelector('.btnFullscreen');
const btnFullscreenExit = dialog.querySelector('.btnFullscreenExit'); const btnFullscreenExit = dialog.querySelector('.btnFullscreenExit');
if (btnFullscreen) if (btnFullscreen) {
btnFullscreen.classList.toggle('hide', isFullscreen); btnFullscreen.classList.toggle('hide', isFullscreen);
if (btnFullscreenExit) }
if (btnFullscreenExit) {
btnFullscreenExit.classList.toggle('hide', !isFullscreen); btnFullscreenExit.classList.toggle('hide', !isFullscreen);
} }
}
/** /**
* Starts the autoplay feature of the Swiper instance. * Starts the autoplay feature of the Swiper instance.

View file

@ -110,10 +110,11 @@ function load(page, devices) {
deviceHtml += '<div class="cardFooter">'; deviceHtml += '<div class="cardFooter">';
if (canDelete(device.Id)) { if (canDelete(device.Id)) {
if (globalize.getIsRTL()) if (globalize.getIsRTL()) {
deviceHtml += '<div style="text-align:left; float:left;padding-top:5px;">'; 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 += '<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 += '<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>'; 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 html += '<div class="cardFooter visualCardBox-cardFooter">'; // always show menu unless explicitly hidden
if (virtualFolder.showMenu !== false) { if (virtualFolder.showMenu !== false) {
let dirTextAlign = 'right'; const dirTextAlign = globalize.getIsRTL() ? 'left' : 'right';
if (globalize.getIsRTL())
dirTextAlign = 'left';
html += '<div style="text-align:' + dirTextAlign + '; float:' + dirTextAlign + ';padding-top:5px;">'; 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 += '<button type="button" is="paper-icon-button-light" class="btnCardMenu autoSize"><span class="material-icons more_vert" aria-hidden="true"></span></button>';
html += '</div>'; html += '</div>';

View file

@ -83,10 +83,11 @@ function getPluginCardHtml(plugin, pluginConfigurationPages) {
html += '<div class="cardFooter">'; html += '<div class="cardFooter">';
if (configPage || plugin.CanUninstall) { if (configPage || plugin.CanUninstall) {
if (globalize.getIsRTL()) if (globalize.getIsRTL()) {
html += '<div style="text-align:left; float:left;padding-top:5px;">'; 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 += '<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 += '<button type="button" is="paper-icon-button-light" class="btnCardMenu autoSize"><span class="material-icons more_vert" aria-hidden="true"></span></button>';
html += '</div>'; html += '</div>';
} }

View file

@ -57,9 +57,7 @@ function populateList(page, tasks) {
html += '<span class="material-icons listItemIcon schedule" aria-hidden="true"></span>'; html += '<span class="material-icons listItemIcon schedule" aria-hidden="true"></span>';
html += '</a>'; html += '</a>';
html += '<div class="listItemBody two-line">'; html += '<div class="listItemBody two-line">';
let textAlignStyle = 'left'; const textAlignStyle = globalize.getIsRTL() ? 'right' : 'left';
if (globalize.getIsRTL())
textAlignStyle = 'right';
html += "<a class='clearLink' style='margin:0;padding:0;display:block;text-align:" + textAlignStyle + ";' is='emby-linkbutton' href='scheduledtask.html?id=" + task.Id + "'>"; 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 += "<h3 class='listItemBodyText'>" + task.Name + '</h3>';
html += "<div class='secondary listItemBodyText' id='taskProgress" + task.Id + "'>" + getTaskProgressHtml(task) + '</div>'; 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) { function onHideAnimationComplete(e) {
const elem = e.target; const elem = e.target;
if (elem != osdBottomElement) if (elem != osdBottomElement) return;
return;
elem.classList.add('hide'); elem.classList.add('hide');
dom.removeEventListener(elem, transitionEndEventName, onHideAnimationComplete, { dom.removeEventListener(elem, transitionEndEventName, onHideAnimationComplete, {
once: true once: true

View file

@ -30,8 +30,9 @@ function mapClientToFraction(range, clientX) {
const rect = range.sliderBubbleTrack.getBoundingClientRect(); const rect = range.sliderBubbleTrack.getBoundingClientRect();
let fraction = (clientX - rect.left) / rect.width; let fraction = (clientX - rect.left) / rect.width;
if (globalize.getIsElementRTL(range)) if (globalize.getIsElementRTL(range)) {
fraction = (rect.right - clientX) / rect.width; fraction = (rect.right - clientX) / rect.width;
}
// Snap to step // Snap to step
const valueRange = range.max - range.min; const valueRange = range.max - range.min;
@ -490,10 +491,11 @@ EmbySliderPrototype.setKeyboardSteps = function (stepDown, stepUp) {
function setRange(elem, startPercent, endPercent) { function setRange(elem, startPercent, endPercent) {
const style = elem.style; const style = elem.style;
if (globalize.getIsRTL()) if (globalize.getIsRTL()) {
style.right = Math.max(startPercent, 0) + '%'; style.right = Math.max(startPercent, 0) + '%';
else } else {
style.left = Math.max(startPercent, 0) + '%'; style.left = Math.max(startPercent, 0) + '%';
}
const widthPercent = endPercent - startPercent; const widthPercent = endPercent - startPercent;
style.width = Math.max(Math.min(widthPercent, 100), 0) + '%'; 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.classList.add('touch-menu-la');
options.target.style.width = options.width + 'px'; options.target.style.width = options.width + 'px';
if (globalize.getIsRTL()) if (globalize.getIsRTL()) {
options.target.style.right = -options.width + 'px'; options.target.style.right = -options.width + 'px';
else } else {
options.target.style.left = -options.width + 'px'; options.target.style.left = -options.width + 'px';
}
if (!options.disableMask) { if (!options.disableMask) {
this.mask = document.createElement('div'); this.mask = document.createElement('div');

View file

@ -189,10 +189,11 @@ const scrollerFactory = function (frame, options) {
// Set position limits & relatives // Set position limits & relatives
self._pos.end = Math.max(slideeSize - frameSize, 0); self._pos.end = Math.max(slideeSize - frameSize, 0);
if (globalize.getIsRTL()) if (globalize.getIsRTL()) {
self._pos.end *= -1; self._pos.end *= -1;
} }
} }
}
/** /**
* Loading function. * Loading function.

View file

@ -95,10 +95,11 @@ export class ComicsPlayer {
onDirChanged = () => { onDirChanged = () => {
let langDir = this.comicsPlayerSettings.langDir; let langDir = this.comicsPlayerSettings.langDir;
if (!langDir || langDir === 'ltr') if (!langDir || langDir === 'ltr') {
langDir = 'rtl'; langDir = 'rtl';
else } else {
langDir = 'ltr'; langDir = 'ltr';
}
this.changeLanguageDirection(langDir); this.changeLanguageDirection(langDir);
@ -125,10 +126,11 @@ export class ComicsPlayer {
onViewChanged = () => { onViewChanged = () => {
let view = this.comicsPlayerSettings.pagesPerView; let view = this.comicsPlayerSettings.pagesPerView;
if (!view || view === 1) if (!view || view === 1) {
view = 2; view = 2;
else } else {
view = 1; view = 1;
}
this.changeView(view); this.changeView(view);

View file

@ -64,8 +64,9 @@ function checkAndProcessDir(culture) {
function setDocumentDirection(direction) { function setDocumentDirection(direction) {
document.getElementsByTagName('body')[0].setAttribute('dir', direction); document.getElementsByTagName('body')[0].setAttribute('dir', direction);
document.getElementsByTagName('html')[0].setAttribute('dir', direction); document.getElementsByTagName('html')[0].setAttribute('dir', direction);
if (direction === Direction.rtl) if (direction === Direction.rtl) {
import('../styles/rtl.scss'); import('../styles/rtl.scss');
}
} }
export function getIsElementRTL(element) { export function getIsElementRTL(element) {