1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fixed all reported issues

This commit is contained in:
Hadi Charara 2022-10-13 13:59:48 -04:00
parent aed7feda2b
commit 892f5b73cf
6 changed files with 28 additions and 26 deletions

View file

@ -194,7 +194,7 @@
<h2 style="margin:.6em 0;vertical-align:middle;display:inline-block;"> <h2 style="margin:.6em 0;vertical-align:middle;display:inline-block;">
${Genres} ${Genres}
</h2> </h2>
<button is="emby-button" type="button" class="fab btnAddTextItem submit marginLeft" title="${Add}"> <button is="emby-button" type="button" class="fab btnAddTextItem submit marginStart" title="${Add}">
<span class="material-icons add" aria-hidden="true"></span> <span class="material-icons add" aria-hidden="true"></span>
</button> </button>
<div class="paperList" id="listGenres"></div> <div class="paperList" id="listGenres"></div>
@ -203,7 +203,7 @@
<h2 style="margin:.6em 0;vertical-align:middle;display:inline-block;"> <h2 style="margin:.6em 0;vertical-align:middle;display:inline-block;">
${People} ${People}
</h2> </h2>
<button is="emby-button" type="button" id="btnAddPerson" class="fab btnAddPerson marginLeft" title="${Add}"> <button is="emby-button" type="button" id="btnAddPerson" class="fab btnAddPerson marginStart" title="${Add}">
<span class="material-icons add" aria-hidden="true"></span> <span class="material-icons add" aria-hidden="true"></span>
</button> </button>
<div id="peopleList" class="paperList"> <div id="peopleList" class="paperList">
@ -213,7 +213,7 @@
<h2 style="margin:.6em 0;vertical-align:middle;display:inline-block;"> <h2 style="margin:.6em 0;vertical-align:middle;display:inline-block;">
${Studios} ${Studios}
</h2> </h2>
<button is="emby-button" type="button" class="fab btnAddTextItem submit marginLeft" title="${Add}"> <button is="emby-button" type="button" class="fab btnAddTextItem submit marginStart" title="${Add}">
<span class="material-icons add" aria-hidden="true"></span> <span class="material-icons add" aria-hidden="true"></span>
</button> </button>
<div class="paperList" id="listStudios"></div> <div class="paperList" id="listStudios"></div>
@ -222,7 +222,7 @@
<h2 style="margin:.6em 0;vertical-align:middle;display:inline-block;"> <h2 style="margin:.6em 0;vertical-align:middle;display:inline-block;">
${Tags} ${Tags}
</h2> </h2>
<button is="emby-button" type="button" class="fab btnAddTextItem submit marginLeft" title="${Add}"> <button is="emby-button" type="button" class="fab btnAddTextItem submit marginStart" title="${Add}">
<span class="material-icons add" aria-hidden="true"></span> <span class="material-icons add" aria-hidden="true"></span>
</button> </button>
<div class="paperList" id="listTags"></div> <div class="paperList" id="listTags"></div>

View file

@ -8,7 +8,7 @@
} }
} }
.marginLeft { .metadataFormFields .marginStart {
[dir="ltr"] & { [dir="ltr"] & {
margin-left: 1em; margin-left: 1em;
} }

View file

@ -40,13 +40,13 @@ const EmbyScrollButtonsPrototype = Object.create(HTMLDivElement.prototype);
} }
function updateScrollButtons(scrollButtons, scrollSize, scrollPos, scrollWidth) { function updateScrollButtons(scrollButtons, scrollSize, scrollPos, scrollWidth) {
// TODO: Check if hack is really needed
// hack alert add twenty for rounding errors
let localeAwarePos = scrollPos; let localeAwarePos = scrollPos;
if (globalize.getElementIsRTL(scrollButtons)) { if (globalize.getIsElementRTL(scrollButtons)) {
localeAwarePos *= -1; localeAwarePos *= -1;
} }
// TODO: Check if hack is really needed
// hack alert add twenty for rounding errors
if (scrollWidth <= scrollSize + 20) { if (scrollWidth <= scrollSize + 20) {
scrollButtons.scrollButtonsLeft.classList.add('hide'); scrollButtons.scrollButtonsLeft.classList.add('hide');
scrollButtons.scrollButtonsRight.classList.add('hide'); scrollButtons.scrollButtonsRight.classList.add('hide');

View file

@ -32,7 +32,7 @@ import globalize from '../../scripts/globalize';
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.getElementIsRTL(range)) if (globalize.getIsElementRTL(range))
fraction = (rect.right - clientX) / rect.width; fraction = (rect.right - clientX) / rect.width;
// Snap to step // Snap to step
@ -121,7 +121,7 @@ import globalize from '../../scripts/globalize';
const bubbleRect = bubble.getBoundingClientRect(); const bubbleRect = bubble.getBoundingClientRect();
let bubblePos = bubbleTrackRect.width * value / 100; let bubblePos = bubbleTrackRect.width * value / 100;
if (globalize.getElementIsRTL(range)) { if (globalize.getIsElementRTL(range)) {
bubblePos = bubbleTrackRect.width - bubblePos; bubblePos = bubbleTrackRect.width - bubblePos;
} }
bubblePos = Math.min(Math.max(bubblePos, bubbleRect.width / 2), bubbleTrackRect.width - bubbleRect.width / 2); bubblePos = Math.min(Math.max(bubblePos, bubbleRect.width / 2), bubbleTrackRect.width - bubbleRect.width / 2);

View file

@ -206,7 +206,10 @@ 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';
options.target.style.insetInlineStart = -options.width + 'px'; if (globalize.getIsRTL())
options.target.style.right = -options.width + 'px';
else
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

@ -3,6 +3,11 @@ import isEmpty from 'lodash-es/isEmpty';
import { currentSettings as userSettings } from './settings/userSettings'; import { currentSettings as userSettings } from './settings/userSettings';
const Direction = {
rtl: "rtl",
ltr: "ltr"
};
/* eslint-disable indent */ /* eslint-disable indent */
const fallbackCulture = 'en-us'; const fallbackCulture = 'en-us';
@ -46,6 +51,7 @@ import { currentSettings as userSettings } from './settings/userSettings';
function checkAndProcessDir(culture) { function checkAndProcessDir(culture) {
isRTL = false; isRTL = false;
console.log(culture);
for (const lang of RTL_LANGS) { for (const lang of RTL_LANGS) {
if (culture.includes(lang)) { if (culture.includes(lang)) {
isRTL = true; isRTL = true;
@ -53,24 +59,17 @@ import { currentSettings as userSettings } from './settings/userSettings';
} }
} }
if (isRTL) setDocumentDirection(isRTL ? Direction.rtl : Direction.ltr);
processIsRTL();
else
processIsLTR();
} }
function processIsRTL() { function setDocumentDirection(direction) {
document.getElementsByTagName('body')[0].setAttribute('dir', 'rtl'); document.getElementsByTagName('body')[0].setAttribute('dir', direction);
document.getElementsByTagName('html')[0].setAttribute('dir', 'rtl'); document.getElementsByTagName('html')[0].setAttribute('dir', direction);
import('../styles/rtl.scss'); if (direction === Direction.rtl)
import('../styles/rtl.scss');
} }
function processIsLTR() { export function getIsElementRTL(element) {
document.getElementsByTagName('body')[0].setAttribute('dir', 'ltr');
document.getElementsByTagName('html')[0].setAttribute('dir', 'ltr');
}
export function getElementIsRTL(element) {
if (window.getComputedStyle) { // all browsers if (window.getComputedStyle) { // all browsers
return window.getComputedStyle(element, null).getPropertyValue('direction') == 'rtl'; return window.getComputedStyle(element, null).getPropertyValue('direction') == 'rtl';
} }
@ -299,7 +298,7 @@ export default {
register, register,
updateCurrentCulture, updateCurrentCulture,
getIsRTL, getIsRTL,
getElementIsRTL getIsElementRTL
}; };
/* eslint-enable indent */ /* eslint-enable indent */