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

First separation commit.

Added LICENSE, README.md, CONTRIBUTORS.md
This commit is contained in:
Erwin de Haan 2019-01-09 12:36:54 +01:00
parent 09513af31b
commit 4678528d00
657 changed files with 422 additions and 0 deletions

View file

@ -0,0 +1,67 @@
.emby-scrollbuttons-scroller {
position: relative
}
.scrollbuttoncontainer {
position: absolute;
top: 0;
bottom: 0;
-webkit-box-align: center;
-webkit-align-items: center;
align-items: center;
-webkit-box-pack: center;
-webkit-justify-content: center;
justify-content: center;
z-index: 1;
font-size: 3em;
color: #fff;
display: none;
overflow: hidden
}
.scrollbuttoncontainer-left {
background: rgba(20, 20, 20, .5);
background: -webkit-linear-gradient(left, #000 0, rgba(0, 0, 0, 0) 100%);
background: -webkit-gradient(linear, left top, right top, from(#000), to(rgba(0, 0, 0, 0)));
background: -webkit-linear-gradient(left, #000, rgba(0, 0, 0, 0));
background: -o-linear-gradient(left, #000, rgba(0, 0, 0, 0));
background: linear-gradient(to right, #000, rgba(0, 0, 0, 0));
left: 0
}
.scrollbuttoncontainer-right {
background: rgba(20, 20, 20, .5);
background: -webkit-linear-gradient(right, #000 0, rgba(0, 0, 0, 0) 100%);
background: -webkit-gradient(linear, right top, left top, from(#000), to(rgba(0, 0, 0, 0)));
background: -webkit-linear-gradient(right, #000, rgba(0, 0, 0, 0));
background: -o-linear-gradient(right, #000, rgba(0, 0, 0, 0));
background: linear-gradient(to left, #000, rgba(0, 0, 0, 0));
right: 0
}
.emby-scrollbuttons-scroller:hover .scrollbuttoncontainer {
display: -webkit-box;
display: -webkit-flex;
display: flex
}
.emby-scrollbuttons-scrollbutton {
margin: 0 -.2em;
-webkit-transition: -webkit-transform 160ms ease-out;
-o-transition: transform 160ms ease-out;
transition: transform 160ms ease-out
}
.scrollbuttoncontainer:hover>.emby-scrollbuttons-scrollbutton {
-webkit-transform: scale(1.3, 1.3);
transform: scale(1.3, 1.3)
}
.emby-scrollbuttons-scrollbutton:after {
content: '';
display: none !important
}
.emby-scrollbuttons-scrollbutton:focus {
color: inherit !important
}

View file

@ -0,0 +1,75 @@
define(["layoutManager", "dom", "css!./emby-scrollbuttons", "registerElement", "paper-icon-button-light"], function(layoutManager, dom) {
"use strict";
function getScrollButtonContainerHtml(direction) {
var html = "";
html += '<div class="scrollbuttoncontainer scrollbuttoncontainer-' + direction + ("left" === direction ? " hide" : "") + '">';
var icon = "left" === direction ? "&#xE5CB;" : "&#xE5CC;";
return html += '<button type="button" is="paper-icon-button-light" data-ripple="false" data-direction="' + direction + '" class="emby-scrollbuttons-scrollbutton">', html += '<i class="md-icon">' + icon + "</i>", html += "</button>", html += "</div>"
}
function getScrollPosition(parent) {
return parent.getScrollPosition ? parent.getScrollPosition() : 0
}
function getScrollWidth(parent) {
return parent.getScrollSize ? parent.getScrollSize() : 0
}
function onScrolledToPosition(scrollButtons, pos, scrollWidth) {
pos > 0 ? scrollButtons.scrollButtonsLeft.classList.remove("hide") : scrollButtons.scrollButtonsLeft.classList.add("hide"), scrollWidth > 0 && (pos += scrollButtons.offsetWidth, pos >= scrollWidth ? scrollButtons.scrollButtonsRight.classList.add("hide") : scrollButtons.scrollButtonsRight.classList.remove("hide"))
}
function onScroll(e) {
var scrollButtons = this,
scroller = this.scroller;
onScrolledToPosition(scrollButtons, getScrollPosition(scroller), getScrollWidth(scroller))
}
function getStyleValue(style, name) {
var value = style.getPropertyValue(name);
return value && (value = value.replace("px", "")) ? (value = parseInt(value), isNaN(value) ? 0 : value) : 0
}
function getScrollSize(elem) {
var scrollSize = elem.offsetWidth,
style = window.getComputedStyle(elem, null),
paddingLeft = getStyleValue(style, "padding-left");
paddingLeft && (scrollSize -= paddingLeft);
var paddingRight = getStyleValue(style, "padding-right");
paddingRight && (scrollSize -= paddingRight);
var slider = elem.getScrollSlider();
return style = window.getComputedStyle(slider, null), paddingLeft = getStyleValue(style, "padding-left"), paddingLeft && (scrollSize -= paddingLeft), paddingRight = getStyleValue(style, "padding-right"), paddingRight && (scrollSize -= paddingRight), scrollSize
}
function onScrollButtonClick(e) {
var newPos, parent = dom.parentWithAttribute(this, "is", "emby-scroller"),
direction = this.getAttribute("data-direction"),
scrollSize = getScrollSize(parent),
pos = getScrollPosition(parent);
newPos = "left" === direction ? Math.max(0, pos - scrollSize) : pos + scrollSize, parent.scrollToPosition(newPos, !1)
}
var EmbyScrollButtonsPrototype = Object.create(HTMLDivElement.prototype);
EmbyScrollButtonsPrototype.createdCallback = function() {}, EmbyScrollButtonsPrototype.attachedCallback = function() {
var parent = dom.parentWithAttribute(this, "is", "emby-scroller");
this.scroller = parent, parent.classList.add("emby-scrollbuttons-scroller"), this.innerHTML = getScrollButtonContainerHtml("left") + getScrollButtonContainerHtml("right");
var scrollHandler = onScroll.bind(this);
this.scrollHandler = scrollHandler;
var buttons = this.querySelectorAll(".emby-scrollbuttons-scrollbutton");
buttons[0].addEventListener("click", onScrollButtonClick), buttons[1].addEventListener("click", onScrollButtonClick), buttons = this.querySelectorAll(".scrollbuttoncontainer"), this.scrollButtonsLeft = buttons[0], this.scrollButtonsRight = buttons[1], parent.addScrollEventListener(scrollHandler, {
capture: !1,
passive: !0
})
}, EmbyScrollButtonsPrototype.detachedCallback = function() {
var parent = this.scroller;
this.scroller = null;
var scrollHandler = this.scrollHandler;
parent && scrollHandler && parent.removeScrollEventListener(scrollHandler, {
capture: !1,
passive: !0
}), this.scrollHandler = null, this.scrollButtonsLeft = null, this.scrollButtonsRight = null
}, document.registerElement("emby-scrollbuttons", {
prototype: EmbyScrollButtonsPrototype,
extends: "div"
})
});