mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge branch 'master' into hadicharara/added-support-for-rtl-layouts
This commit is contained in:
commit
104ad71ea7
128 changed files with 1242 additions and 1454 deletions
|
@ -85,13 +85,9 @@ import 'webcomponents.js/webcomponents-lite';
|
|||
passive: true
|
||||
});
|
||||
|
||||
if (browser.orsay) {
|
||||
if (this === document.activeElement) {
|
||||
//Make sure the IME pops up if this is the first/default element on the page
|
||||
if (document.attachIME) {
|
||||
document.attachIME(this);
|
||||
}
|
||||
}
|
||||
//Make sure the IME pops up if this is the first/default element on the page
|
||||
if (browser.orsay && this === document.activeElement && document.attachIME) {
|
||||
document.attachIME(this);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -21,10 +21,8 @@ import Sortable from 'sortablejs';
|
|||
const itemsContainer = this;
|
||||
const multiSelect = itemsContainer.multiSelect;
|
||||
|
||||
if (multiSelect) {
|
||||
if (multiSelect.onContainerClick.call(itemsContainer, e) === false) {
|
||||
return;
|
||||
}
|
||||
if (multiSelect?.onContainerClick.call(itemsContainer, e) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
itemShortcuts.onClick.call(itemsContainer, e);
|
||||
|
@ -155,9 +153,9 @@ import Sortable from 'sortablejs';
|
|||
const eventsToMonitor = getEventsToMonitor(itemsContainer);
|
||||
|
||||
// TODO: Check user data change reason?
|
||||
if (eventsToMonitor.indexOf('markfavorite') !== -1) {
|
||||
itemsContainer.notifyRefreshNeeded();
|
||||
} else if (eventsToMonitor.indexOf('markplayed') !== -1) {
|
||||
if (eventsToMonitor.indexOf('markfavorite') !== -1
|
||||
|| eventsToMonitor.indexOf('markplayed') !== -1
|
||||
) {
|
||||
itemsContainer.notifyRefreshNeeded();
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +190,6 @@ import Sortable from 'sortablejs';
|
|||
const itemsContainer = this;
|
||||
if (getEventsToMonitor(itemsContainer).indexOf('seriestimers') !== -1) {
|
||||
itemsContainer.notifyRefreshNeeded();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,11 +256,9 @@ import Sortable from 'sortablejs';
|
|||
itemsContainer.notifyRefreshNeeded(true);
|
||||
return;
|
||||
}
|
||||
} else if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Audio') {
|
||||
if (eventsToMonitor.indexOf('audioplayback') !== -1) {
|
||||
itemsContainer.notifyRefreshNeeded(true);
|
||||
return;
|
||||
}
|
||||
} else if (state.NowPlayingItem?.MediaType === 'Audio' && eventsToMonitor.indexOf('audioplayback') !== -1) {
|
||||
itemsContainer.notifyRefreshNeeded(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,10 +293,8 @@ import Sortable from 'sortablejs';
|
|||
}
|
||||
}
|
||||
|
||||
if (layoutManager.desktop || layoutManager.mobile) {
|
||||
if (this.getAttribute('data-multiselect') !== 'false') {
|
||||
this.enableMultiSelect(true);
|
||||
}
|
||||
if (layoutManager.desktop || layoutManager.mobile && this.getAttribute('data-multiselect') !== 'false') {
|
||||
this.enableMultiSelect(true);
|
||||
}
|
||||
|
||||
if (layoutManager.tv) {
|
||||
|
|
|
@ -63,18 +63,6 @@ import ServerConnections from '../../components/ServerConnections';
|
|||
}
|
||||
|
||||
button.classList.add('ratingbutton-withrating');
|
||||
} else if (likes) {
|
||||
if (icon) {
|
||||
icon.classList.add('favorite');
|
||||
icon.classList.remove('ratingbutton-icon-withrating');
|
||||
}
|
||||
button.classList.remove('ratingbutton-withrating');
|
||||
} else if (likes === false) {
|
||||
if (icon) {
|
||||
icon.classList.add('favorite');
|
||||
icon.classList.remove('ratingbutton-icon-withrating');
|
||||
}
|
||||
button.classList.remove('ratingbutton-withrating');
|
||||
} else {
|
||||
if (icon) {
|
||||
icon.classList.add('favorite');
|
||||
|
|
|
@ -23,11 +23,7 @@ import 'webcomponents.js/webcomponents-lite';
|
|||
return true;
|
||||
}
|
||||
|
||||
if (layoutManager.tv) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return !layoutManager.tv;
|
||||
}
|
||||
|
||||
function triggerChange(select) {
|
||||
|
|
|
@ -105,6 +105,13 @@ import globalize from '../../scripts/globalize';
|
|||
fraction *= 100;
|
||||
backgroundLower.style.width = fraction + '%';
|
||||
}
|
||||
|
||||
if (range.markerContainerElement) {
|
||||
if (!range.triedAddingMarkers) {
|
||||
addMarkers(range);
|
||||
}
|
||||
updateMarkers(range, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -136,6 +143,70 @@ import globalize from '../../scripts/globalize';
|
|||
});
|
||||
}
|
||||
|
||||
function setMarker(range, valueMarker, marker, valueProgress) {
|
||||
requestAnimationFrame(function () {
|
||||
const bubbleTrackRect = range.sliderBubbleTrack.getBoundingClientRect();
|
||||
const markerRect = marker.getBoundingClientRect();
|
||||
|
||||
if (!bubbleTrackRect.width || !markerRect.width) {
|
||||
// width is not set, most probably because the OSD is currently hidden
|
||||
return;
|
||||
}
|
||||
|
||||
let markerPos = (bubbleTrackRect.width * valueMarker / 100) - markerRect.width / 2;
|
||||
markerPos = Math.min(Math.max(markerPos, - markerRect.width / 2), bubbleTrackRect.width - markerRect.width / 2);
|
||||
|
||||
marker.style.left = markerPos + 'px';
|
||||
|
||||
if (valueProgress >= valueMarker) {
|
||||
marker.classList.remove('unwatched');
|
||||
marker.classList.add('watched');
|
||||
} else {
|
||||
marker.classList.add('unwatched');
|
||||
marker.classList.remove('watched');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateMarkers(range, currentValue) {
|
||||
if (range.markerInfo && range.markerInfo.length && range.markerElements && range.markerElements.length) {
|
||||
for (let i = 0, length = range.markerElements.length; i < length; i++) {
|
||||
if (range.markerInfo.length > i) {
|
||||
setMarker(range, mapFractionToValue(range, range.markerInfo[i].progress), range.markerElements[i], currentValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addMarkers(range) {
|
||||
range.markerInfo = [];
|
||||
if (range.getMarkerInfo) {
|
||||
range.markerInfo = range.getMarkerInfo();
|
||||
}
|
||||
|
||||
function getMarkerHtml(markerInfo) {
|
||||
let markerTypeSpecificClasses = '';
|
||||
|
||||
if (markerInfo.className === 'chapterMarker') {
|
||||
markerTypeSpecificClasses = markerInfo.className;
|
||||
|
||||
if (typeof markerInfo.name === 'string' && markerInfo.name.length) {
|
||||
// limit the class length in case the name contains half a novel
|
||||
markerTypeSpecificClasses = `${markerInfo.className} marker-${markerInfo.name.substring(0, 100).toLowerCase().replace(' ', '-')}`;
|
||||
}
|
||||
}
|
||||
|
||||
return `<span class="material-icons sliderMarker ${markerTypeSpecificClasses}" aria-hidden="true"></span>`;
|
||||
}
|
||||
|
||||
range.markerInfo.forEach(info => {
|
||||
range.markerContainerElement.insertAdjacentHTML('beforeend', getMarkerHtml(info));
|
||||
});
|
||||
|
||||
range.markerElements = range.markerContainerElement.querySelectorAll('.sliderMarker');
|
||||
range.triedAddingMarkers = true;
|
||||
}
|
||||
|
||||
EmbySliderPrototype.attachedCallback = function () {
|
||||
if (this.getAttribute('data-embyslider') === 'true') {
|
||||
return;
|
||||
|
@ -193,7 +264,9 @@ import globalize from '../../scripts/globalize';
|
|||
this.backgroundUpper = containerElement.querySelector('.mdl-slider-background-upper');
|
||||
const sliderBubble = containerElement.querySelector('.sliderBubble');
|
||||
|
||||
let hasHideClass = sliderBubble.classList.contains('hide');
|
||||
let hasHideBubbleClass = sliderBubble.classList.contains('hide');
|
||||
|
||||
this.markerContainerElement = containerElement.querySelector('.sliderMarkerContainer');
|
||||
|
||||
dom.addEventListener(this, 'input', function () {
|
||||
this.dragging = true;
|
||||
|
@ -205,9 +278,9 @@ import globalize from '../../scripts/globalize';
|
|||
const bubbleValue = mapValueToFraction(this, this.value) * 100;
|
||||
updateBubble(this, bubbleValue, sliderBubble);
|
||||
|
||||
if (hasHideClass) {
|
||||
if (hasHideBubbleClass) {
|
||||
sliderBubble.classList.remove('hide');
|
||||
hasHideClass = false;
|
||||
hasHideBubbleClass = false;
|
||||
}
|
||||
}, {
|
||||
passive: true
|
||||
|
@ -221,7 +294,7 @@ import globalize from '../../scripts/globalize';
|
|||
}
|
||||
|
||||
sliderBubble.classList.add('hide');
|
||||
hasHideClass = true;
|
||||
hasHideBubbleClass = true;
|
||||
}, {
|
||||
passive: true
|
||||
});
|
||||
|
@ -233,9 +306,9 @@ import globalize from '../../scripts/globalize';
|
|||
|
||||
updateBubble(this, bubbleValue, sliderBubble);
|
||||
|
||||
if (hasHideClass) {
|
||||
if (hasHideBubbleClass) {
|
||||
sliderBubble.classList.remove('hide');
|
||||
hasHideClass = false;
|
||||
hasHideBubbleClass = false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
|
@ -245,7 +318,7 @@ import globalize from '../../scripts/globalize';
|
|||
/* eslint-disable-next-line compat/compat */
|
||||
dom.addEventListener(this, (window.PointerEvent ? 'pointerleave' : 'mouseleave'), function () {
|
||||
sliderBubble.classList.add('hide');
|
||||
hasHideClass = true;
|
||||
hasHideBubbleClass = true;
|
||||
}, {
|
||||
passive: true
|
||||
});
|
||||
|
@ -452,10 +525,8 @@ import globalize from '../../scripts/globalize';
|
|||
}
|
||||
|
||||
for (const range of ranges) {
|
||||
if (position != null) {
|
||||
if (position >= range.end) {
|
||||
continue;
|
||||
}
|
||||
if (position != null && position >= range.end) {
|
||||
continue;
|
||||
}
|
||||
|
||||
setRange(elem, range.start, range.end);
|
||||
|
|
|
@ -266,3 +266,25 @@
|
|||
display: block;
|
||||
margin-bottom: 0.25em;
|
||||
}
|
||||
|
||||
.sliderMarkerContainer {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: 0 0.54em; /* half of slider thumb size */
|
||||
}
|
||||
|
||||
.sliderMarker {
|
||||
position: absolute;
|
||||
width: 2px;
|
||||
height: 0.5em;
|
||||
transform: translate3d(0, 25%, 0);
|
||||
}
|
||||
|
||||
.sliderMarker.unwatched {
|
||||
background-color: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.sliderMarker.watched {
|
||||
background-color: #00a4dc;
|
||||
}
|
||||
|
|
|
@ -272,10 +272,8 @@ import '../../assets/css/scrollstyles.scss';
|
|||
let sibling = elem[method];
|
||||
|
||||
while (sibling) {
|
||||
if (sibling.classList.contains(buttonClass)) {
|
||||
if (!sibling.classList.contains('hide')) {
|
||||
return sibling;
|
||||
}
|
||||
if (sibling.classList.contains(buttonClass) && !sibling.classList.contains('hide')) {
|
||||
return sibling;
|
||||
}
|
||||
|
||||
sibling = sibling[method];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue