mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update video osd
This commit is contained in:
parent
e9b1b4ad5f
commit
0444d44461
6 changed files with 128 additions and 222 deletions
|
@ -220,9 +220,9 @@ _:-ms-input-placeholder, :root .mdl-slider {
|
|||
|
||||
.sliderBubble {
|
||||
position: absolute;
|
||||
top: -3.7em;
|
||||
top: 0;
|
||||
left: 0;
|
||||
padding: .5em 1em;
|
||||
transform: translate3d(-48%, -115%, 0);
|
||||
background: #282828;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
|
@ -232,4 +232,5 @@ _:-ms-input-placeholder, :root .mdl-slider {
|
|||
|
||||
.sliderBubbleText {
|
||||
margin: 0;
|
||||
padding: .5em .75em;
|
||||
}
|
||||
|
|
|
@ -38,15 +38,20 @@
|
|||
|
||||
function updateBubble(range, value, bubble, bubbleText) {
|
||||
|
||||
bubble.style.left = (value - 1) + '%';
|
||||
bubble.style.left = value + '%';
|
||||
|
||||
if (range.getBubbleText) {
|
||||
value = range.getBubbleText(value);
|
||||
if (range.getBubbleHtml) {
|
||||
value = range.getBubbleHtml(value);
|
||||
} else {
|
||||
value = Math.round(value);
|
||||
if (range.getBubbleText) {
|
||||
value = range.getBubbleText(value);
|
||||
} else {
|
||||
value = Math.round(value);
|
||||
}
|
||||
value = '<h1 class="sliderBubbleText">' + value + '</h1>';
|
||||
}
|
||||
|
||||
bubbleText.innerHTML = value;
|
||||
bubble.innerHTML = value;
|
||||
}
|
||||
|
||||
EmbySliderPrototype.attachedCallback = function () {
|
||||
|
@ -73,21 +78,20 @@
|
|||
htmlToInsert += '<div class="mdl-slider__background-flex"><div class="mdl-slider__background-lower"></div><div class="mdl-slider__background-upper"></div></div>';
|
||||
}
|
||||
|
||||
htmlToInsert += '<div class="sliderBubble hide"><h1 class="sliderBubbleText"></h1></div>';
|
||||
htmlToInsert += '<div class="sliderBubble hide"></div>';
|
||||
|
||||
containerElement.insertAdjacentHTML('beforeend', htmlToInsert);
|
||||
|
||||
var backgroundLower = containerElement.querySelector('.mdl-slider__background-lower');
|
||||
var backgroundUpper = containerElement.querySelector('.mdl-slider__background-upper');
|
||||
var sliderBubble = containerElement.querySelector('.sliderBubble');
|
||||
var sliderBubbleText = containerElement.querySelector('.sliderBubbleText');
|
||||
|
||||
var hasHideClass = sliderBubble.classList.contains('hide');
|
||||
|
||||
dom.addEventListener(this, 'input', function (e) {
|
||||
this.dragging = true;
|
||||
|
||||
updateBubble(this, this.value, sliderBubble, sliderBubbleText);
|
||||
updateBubble(this, this.value, sliderBubble);
|
||||
|
||||
if (hasHideClass) {
|
||||
sliderBubble.classList.remove('hide');
|
||||
|
@ -117,7 +121,7 @@
|
|||
var clientX = e.clientX;
|
||||
var bubbleValue = (clientX - rect.left) / rect.width;
|
||||
bubbleValue *= 100;
|
||||
updateBubble(this, bubbleValue, sliderBubble, sliderBubbleText);
|
||||
updateBubble(this, bubbleValue, sliderBubble);
|
||||
|
||||
if (hasHideClass) {
|
||||
sliderBubble.classList.remove('hide');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue