mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update dialogs
This commit is contained in:
parent
b385aa2d95
commit
797ab3899b
23 changed files with 469 additions and 95 deletions
71
dashboard-ui/bower_components/emby-webcomponents/emby-input/emby-input.js
vendored
Normal file
71
dashboard-ui/bower_components/emby-webcomponents/emby-input/emby-input.js
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
define(['layoutManager', 'browser', 'css!./emby-input'], function (layoutManager, browser) {
|
||||
|
||||
var EmbyInputPrototype = Object.create(HTMLInputElement.prototype);
|
||||
|
||||
function getLabel(input) {
|
||||
var elem = input.previousSibling;
|
||||
while (elem && elem.tagName != 'LABEL') {
|
||||
elem = elem.previousSibling;
|
||||
}
|
||||
return elem;
|
||||
}
|
||||
|
||||
function onFocus(e) {
|
||||
var label = getLabel(this);
|
||||
if (label) {
|
||||
label.classList.add('inputLabelFocused');
|
||||
label.classList.remove('inputLabelUnfocused');
|
||||
}
|
||||
}
|
||||
|
||||
function onBlur(e) {
|
||||
var label = getLabel(this);
|
||||
if (label) {
|
||||
label.classList.add('inputLabelUnfocused');
|
||||
label.classList.remove('inputLabelFocused');
|
||||
}
|
||||
}
|
||||
|
||||
EmbyInputPrototype.createdCallback = function () {
|
||||
|
||||
var parent = this.parentNode;
|
||||
if (!parent.classList.contains('inputContainer')) {
|
||||
var div = this.ownerDocument.createElement('div');
|
||||
div.classList.add('inputContainer');
|
||||
parent.replaceChild(div, this);
|
||||
div.appendChild(this);
|
||||
}
|
||||
if (!this.id) {
|
||||
this.id = 'input' + new Date().getTime();
|
||||
}
|
||||
|
||||
this.removeEventListener('focus', onFocus);
|
||||
this.removeEventListener('blur', onBlur);
|
||||
|
||||
this.addEventListener('focus', onFocus);
|
||||
this.addEventListener('blur', onBlur);
|
||||
};
|
||||
|
||||
EmbyInputPrototype.attachedCallback = function () {
|
||||
|
||||
if (this.getAttribute('data-embyinput') != 'true') {
|
||||
this.setAttribute('data-embyinput', 'true');
|
||||
|
||||
var label = this.ownerDocument.createElement('label');
|
||||
label.innerHTML = this.getAttribute('label') || '';
|
||||
label.classList.add('inputLabel');
|
||||
label.classList.add('inputLabelUnfocused');
|
||||
label.htmlFor = this.id;
|
||||
this.parentNode.insertBefore(label, this);
|
||||
|
||||
var div = document.createElement('div');
|
||||
div.classList.add('emby-input-selectionbar');
|
||||
this.parentNode.insertBefore(div, this.nextSibling);
|
||||
}
|
||||
};
|
||||
|
||||
document.registerElement('emby-input', {
|
||||
prototype: EmbyInputPrototype,
|
||||
extends: 'input'
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue