Merge remote-tracking branch 'upstream/master' into fix-subtitle-line-spacing

Conflicts:
	src/components/subtitlesettings/subtitleappearancehelper.js
	src/plugins/htmlVideoPlayer/plugin.js
This commit is contained in:
Dmitry Lyzo 2020-07-30 17:49:07 +03:00
commit 48886918d3
278 changed files with 2125 additions and 5109 deletions

View file

@ -7,55 +7,54 @@ import 'emby-button';
const EmbyButtonPrototype = Object.create(HTMLDivElement.prototype);
function slideDownToShow(button, elem) {
elem.classList.remove('hide');
elem.classList.add('expanded');
elem.style.height = 'auto';
const height = elem.offsetHeight + 'px';
elem.style.height = '0';
// trigger reflow
const newHeight = elem.offsetHeight;
elem.style.height = height;
setTimeout(function () {
if (elem.classList.contains('expanded')) {
elem.classList.remove('hide');
} else {
elem.classList.add('hide');
}
requestAnimationFrame(() => {
elem.classList.remove('hide');
elem.classList.add('expanded');
elem.style.height = 'auto';
}, 300);
const height = elem.offsetHeight + 'px';
elem.style.height = '0';
// trigger reflow
// TODO: Find a better way to do this
const newHeight = elem.offsetHeight; /* eslint-disable-line no-unused-vars */
elem.style.height = height;
const icon = button.querySelector('.material-icons');
//icon.innerHTML = 'expand_less';
icon.classList.add('emby-collapse-expandIconExpanded');
setTimeout(function () {
if (elem.classList.contains('expanded')) {
elem.classList.remove('hide');
} else {
elem.classList.add('hide');
}
elem.style.height = 'auto';
}, 300);
const icon = button.querySelector('.material-icons');
icon.classList.add('emby-collapse-expandIconExpanded');
});
}
function slideUpToHide(button, elem) {
requestAnimationFrame(() => {
elem.style.height = elem.offsetHeight + 'px';
// trigger reflow
// TODO: Find a better way to do this
const newHeight = elem.offsetHeight; /* eslint-disable-line no-unused-vars */
elem.classList.remove('expanded');
elem.style.height = '0';
elem.style.height = elem.offsetHeight + 'px';
// trigger reflow
const newHeight = elem.offsetHeight;
setTimeout(function () {
if (elem.classList.contains('expanded')) {
elem.classList.remove('hide');
} else {
elem.classList.add('hide');
}
}, 300);
elem.classList.remove('expanded');
elem.style.height = '0';
setTimeout(function () {
if (elem.classList.contains('expanded')) {
elem.classList.remove('hide');
} else {
elem.classList.add('hide');
}
}, 300);
const icon = button.querySelector('.material-icons');
//icon.innerHTML = 'expand_more';
icon.classList.remove('emby-collapse-expandIconExpanded');
const icon = button.querySelector('.material-icons');
icon.classList.remove('emby-collapse-expandIconExpanded');
});
}
function onButtonClick(e) {
const button = this;
const collapseContent = button.parentNode.querySelector('.collapseContent');
@ -69,7 +68,6 @@ import 'emby-button';
}
EmbyButtonPrototype.attachedCallback = function () {
if (this.classList.contains('emby-collapse')) {
return;
}

View file

@ -11,7 +11,6 @@ import 'webcomponents';
let supportsFloatingLabel = false;
if (Object.getOwnPropertyDescriptor && Object.defineProperty) {
const descriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
// descriptor returning null in webos
@ -94,16 +93,13 @@ import 'webcomponents';
}
}
}
};
function onChange() {
const label = this.labelElement;
if (this.value) {
label.classList.remove('inputLabel-float');
} else {
const instanceSupportsFloat = supportsFloatingLabel && this.type !== 'date' && this.type !== 'time';
if (instanceSupportsFloat) {

View file

@ -7,14 +7,12 @@ import 'webcomponents';
/* eslint-disable indent */
function addNotificationEvent(instance, name, handler) {
const localHandler = handler.bind(instance);
events.on(serverNotifications, name, localHandler);
instance[name] = localHandler;
}
function removeNotificationEvent(instance, name) {
const handler = instance[name];
if (handler) {
events.off(serverNotifications, name, handler);
@ -23,7 +21,6 @@ import 'webcomponents';
}
function onRefreshProgress(e, apiClient, info) {
const indicator = this;
if (!indicator.itemId) {
@ -31,7 +28,6 @@ import 'webcomponents';
}
if (info.ItemId === indicator.itemId) {
const progress = parseFloat(info.Progress);
if (progress && progress < 100) {
@ -40,14 +36,13 @@ import 'webcomponents';
this.classList.add('hide');
}
this.setProgress(progress);
this.setAttribute('data-progress', progress);
}
}
let EmbyItemRefreshIndicatorPrototype = Object.create(EmbyProgressRing);
EmbyItemRefreshIndicatorPrototype.createdCallback = function () {
// base method
if (EmbyProgressRing.createdCallback) {
EmbyProgressRing.createdCallback.call(this);
@ -57,7 +52,6 @@ import 'webcomponents';
};
EmbyItemRefreshIndicatorPrototype.attachedCallback = function () {
// base method
if (EmbyProgressRing.attachedCallback) {
EmbyProgressRing.attachedCallback.call(this);
@ -65,7 +59,6 @@ import 'webcomponents';
};
EmbyItemRefreshIndicatorPrototype.detachedCallback = function () {
// base method
if (EmbyProgressRing.detachedCallback) {
EmbyProgressRing.detachedCallback.call(this);

View file

@ -18,7 +18,6 @@ import 'webcomponents';
function onClick(e) {
const itemsContainer = this;
const target = e.target;
let multiSelect = itemsContainer.multiSelect;
if (multiSelect) {
@ -148,7 +147,6 @@ import 'webcomponents';
};
function onUserDataChanged(e, apiClient, userData) {
const itemsContainer = this;
import('cardBuilder').then(({default: cardBuilder}) => {
@ -175,7 +173,6 @@ import 'webcomponents';
}
function onTimerCreated(e, apiClient, data) {
const itemsContainer = this;
if (getEventsToMonitor(itemsContainer).indexOf('timers') !== -1) {
@ -361,7 +358,6 @@ import 'webcomponents';
let refreshIntervalEndTime = this.refreshIntervalEndTime;
if (refreshIntervalEndTime) {
const remainingMs = refreshIntervalEndTime - new Date().getTime();
if (remainingMs > 0 && !this.needsRefresh) {
resetRefreshInterval(this, remainingMs);

View file

@ -21,7 +21,6 @@ import EmbyButtonPrototype from 'emby-button';
}
function onClick(e) {
const button = this;
const id = button.getAttribute('data-id');
const serverId = button.getAttribute('data-serverid');
@ -70,7 +69,6 @@ import EmbyButtonPrototype from 'emby-button';
}
function setTitle(button, itemType) {
if (itemType !== 'AudioBook' && itemType !== 'AudioPodcast') {
button.title = globalize.translate('Watched');
} else {
@ -84,13 +82,11 @@ import EmbyButtonPrototype from 'emby-button';
}
function clearEvents(button) {
button.removeEventListener('click', onClick);
removeNotificationEvent(button, 'UserDataChanged');
}
function bindEvents(button) {
clearEvents(button);
button.addEventListener('click', onClick);
@ -100,7 +96,6 @@ import EmbyButtonPrototype from 'emby-button';
const EmbyPlaystateButtonPrototype = Object.create(EmbyButtonPrototype);
EmbyPlaystateButtonPrototype.createdCallback = function () {
// base method
if (EmbyButtonPrototype.createdCallback) {
EmbyButtonPrototype.createdCallback.call(this);
@ -108,7 +103,6 @@ import EmbyButtonPrototype from 'emby-button';
};
EmbyPlaystateButtonPrototype.attachedCallback = function () {
// base method
if (EmbyButtonPrototype.attachedCallback) {
EmbyButtonPrototype.attachedCallback.call(this);
@ -117,7 +111,6 @@ import EmbyButtonPrototype from 'emby-button';
const itemId = this.getAttribute('data-id');
const serverId = this.getAttribute('data-serverid');
if (itemId && serverId) {
setState(this, this.getAttribute('data-played') === 'true', false);
bindEvents(this);
setTitle(this, this.getAttribute('data-type'));
@ -125,7 +118,6 @@ import EmbyButtonPrototype from 'emby-button';
};
EmbyPlaystateButtonPrototype.detachedCallback = function () {
// base method
if (EmbyButtonPrototype.detachedCallback) {
EmbyButtonPrototype.detachedCallback.call(this);
@ -136,9 +128,7 @@ import EmbyButtonPrototype from 'emby-button';
};
EmbyPlaystateButtonPrototype.setItem = function (item) {
if (item) {
this.setAttribute('data-id', item.Id);
this.setAttribute('data-serverid', item.ServerId);
@ -147,9 +137,7 @@ import EmbyButtonPrototype from 'emby-button';
bindEvents(this);
setTitle(this, item.Type);
} else {
this.removeAttribute('data-id');
this.removeAttribute('data-serverid');
this.removeAttribute('data-played');

View file

@ -6,37 +6,34 @@ import 'webcomponents';
let EmbyProgressRing = Object.create(HTMLDivElement.prototype);
EmbyProgressRing.createdCallback = function () {
this.classList.add('progressring');
const instance = this;
import('text!./emby-progressring.template.html').then(({default: template}) => {
instance.innerHTML = template;
//if (window.MutationObserver) {
// // create an observer instance
// var observer = new MutationObserver(function (mutations) {
// mutations.forEach(function (mutation) {
if (window.MutationObserver) {
// create an observer instance
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
instance.setProgress(parseFloat(instance.getAttribute('data-progress') || '0'));
});
});
// instance.setProgress(parseFloat(instance.getAttribute('data-progress') || '0'));
// });
// });
// configuration of the observer:
var config = { attributes: true, childList: false, characterData: false };
// // configuration of the observer:
// var config = { attributes: true, childList: false, characterData: false };
// pass in the target node, as well as the observer options
observer.observe(instance, config);
// // pass in the target node, as well as the observer options
// observer.observe(instance, config);
// instance.observer = observer;
//}
instance.observer = observer;
}
instance.setProgress(parseFloat(instance.getAttribute('data-progress') || '0'));
});
};
EmbyProgressRing.setProgress = function (progress) {
progress = Math.floor(progress);
let angle;
@ -50,7 +47,6 @@ import 'webcomponents';
this.querySelector('.animate-50-75-b').style.transform = 'rotate(-90deg)';
this.querySelector('.animate-75-100-b').style.transform = 'rotate(-90deg)';
} else if (progress >= 25 && progress < 50) {
angle = -90 + ((progress - 25) / 100) * 360;
this.querySelector('.animate-0-25-b').style.transform = 'none';
@ -83,7 +79,6 @@ import 'webcomponents';
};
EmbyProgressRing.detachedCallback = function () {
let observer = this.observer;
if (observer) {

View file

@ -7,7 +7,6 @@ import 'webcomponents';
let EmbyRadioPrototype = Object.create(HTMLInputElement.prototype);
function onKeyDown(e) {
// Don't submit form on enter
// Real (non-emulator) Tizen does nothing on Space
if (e.keyCode === 13 || e.keyCode === 32) {
@ -37,7 +36,6 @@ import 'webcomponents';
this.classList.add('mdl-radio__button');
let labelElement = this.parentNode;
//labelElement.classList.add('"mdl-radio mdl-js-radio mdl-js-ripple-effect');
labelElement.classList.add('mdl-radio');
labelElement.classList.add('mdl-js-radio');
labelElement.classList.add('mdl-js-ripple-effect');

View file

@ -7,14 +7,12 @@ import EmbyButtonPrototype from 'emby-button';
/* eslint-disable indent */
function addNotificationEvent(instance, name, handler) {
const localHandler = handler.bind(instance);
events.on(serverNotifications, name, localHandler);
instance[name] = localHandler;
}
function removeNotificationEvent(instance, name) {
const handler = instance[name];
if (handler) {
events.off(serverNotifications, name, handler);
@ -23,12 +21,10 @@ import EmbyButtonPrototype from 'emby-button';
}
function showPicker(button, apiClient, itemId, likes, isFavorite) {
return apiClient.updateFavoriteStatus(apiClient.getCurrentUserId(), itemId, !isFavorite);
}
function onClick(e) {
const button = this;
const id = button.getAttribute('data-id');
const serverId = button.getAttribute('data-serverid');
@ -45,58 +41,44 @@ import EmbyButtonPrototype from 'emby-button';
}
showPicker(button, apiClient, id, likes, isFavorite).then(function (userData) {
setState(button, userData.Likes, userData.IsFavorite);
});
}
function onUserDataChanged(e, apiClient, userData) {
const button = this;
if (userData.ItemId === button.getAttribute('data-id')) {
setState(button, userData.Likes, userData.IsFavorite);
}
}
function setState(button, likes, isFavorite, updateAttribute) {
const icon = button.querySelector('.material-icons');
if (isFavorite) {
if (icon) {
icon.classList.add('favorite');
icon.classList.add('ratingbutton-icon-withrating');
}
button.classList.add('ratingbutton-withrating');
} else if (likes) {
if (icon) {
icon.classList.add('favorite');
icon.classList.remove('ratingbutton-icon-withrating');
//icon.innerHTML = 'thumb_up';
}
button.classList.remove('ratingbutton-withrating');
} else if (likes === false) {
if (icon) {
icon.classList.add('favorite');
icon.classList.remove('ratingbutton-icon-withrating');
//icon.innerHTML = 'thumb_down';
}
button.classList.remove('ratingbutton-withrating');
} else {
if (icon) {
icon.classList.add('favorite');
icon.classList.remove('ratingbutton-icon-withrating');
//icon.innerHTML = 'thumbs_up_down';
}
button.classList.remove('ratingbutton-withrating');
}
@ -118,13 +100,11 @@ import EmbyButtonPrototype from 'emby-button';
}
function clearEvents(button) {
button.removeEventListener('click', onClick);
removeNotificationEvent(button, 'UserDataChanged');
}
function bindEvents(button) {
clearEvents(button);
button.addEventListener('click', onClick);
@ -134,7 +114,6 @@ import EmbyButtonPrototype from 'emby-button';
const EmbyRatingButtonPrototype = Object.create(EmbyButtonPrototype);
EmbyRatingButtonPrototype.createdCallback = function () {
// base method
if (EmbyButtonPrototype.createdCallback) {
EmbyButtonPrototype.createdCallback.call(this);
@ -142,7 +121,6 @@ import EmbyButtonPrototype from 'emby-button';
};
EmbyRatingButtonPrototype.attachedCallback = function () {
// base method
if (EmbyButtonPrototype.attachedCallback) {
EmbyButtonPrototype.attachedCallback.call(this);
@ -151,7 +129,6 @@ import EmbyButtonPrototype from 'emby-button';
const itemId = this.getAttribute('data-id');
const serverId = this.getAttribute('data-serverid');
if (itemId && serverId) {
let likes = this.getAttribute('data-likes');
const isFavorite = this.getAttribute('data-isfavorite') === 'true';
if (likes === 'true') {
@ -170,7 +147,6 @@ import EmbyButtonPrototype from 'emby-button';
};
EmbyRatingButtonPrototype.detachedCallback = function () {
// base method
if (EmbyButtonPrototype.detachedCallback) {
EmbyButtonPrototype.detachedCallback.call(this);
@ -180,18 +156,14 @@ import EmbyButtonPrototype from 'emby-button';
};
EmbyRatingButtonPrototype.setItem = function (item) {
if (item) {
this.setAttribute('data-id', item.Id);
this.setAttribute('data-serverid', item.ServerId);
const userData = item.UserData || {};
setState(this, userData.Likes, userData.IsFavorite);
bindEvents(this);
} else {
this.removeAttribute('data-id');
this.removeAttribute('data-serverid');
this.removeAttribute('data-likes');

View file

@ -36,6 +36,7 @@ const EmbyScrollButtonsPrototype = Object.create(HTMLDivElement.prototype);
}
function updateScrollButtons(scrollButtons, scrollSize, scrollPos, scrollWidth) {
// TODO: Check if hack is really needed
// hack alert add twenty for rounding errors
if (scrollWidth <= scrollSize + 20) {
scrollButtons.scrollButtonsLeft.classList.add('hide');
@ -122,7 +123,6 @@ const EmbyScrollButtonsPrototype = Object.create(HTMLDivElement.prototype);
const direction = this.getAttribute('data-direction');
const scrollSize = getScrollSize(scroller);
const scrollPos = getScrollPosition(scroller);
const scrollWidth = getScrollWidth(scroller);
let newPos;
if (direction === 'left') {

View file

@ -9,7 +9,6 @@ import 'webcomponents';
const EmbySelectPrototype = Object.create(HTMLSelectElement.prototype);
function enableNativeMenu() {
if (browser.edgeUwp || browser.xboxOne) {
return true;
}
@ -38,12 +37,10 @@ import 'webcomponents';
}
function setValue(select, value) {
select.value = value;
}
function showActionSheet(select) {
const labelElem = getLabel(select);
const title = labelElem ? (labelElem.textContent || labelElem.innerText) : null;
@ -112,7 +109,6 @@ import 'webcomponents';
let inputId = 0;
EmbySelectPrototype.createdCallback = function () {
if (!this.id) {
this.id = 'embyselect' + inputId;
inputId++;
@ -132,7 +128,6 @@ import 'webcomponents';
};
EmbySelectPrototype.attachedCallback = function () {
if (this.classList.contains('emby-select')) {
return;
}
@ -151,7 +146,6 @@ import 'webcomponents';
};
EmbySelectPrototype.setLabel = function (text) {
const label = this.parentNode.querySelector('label');
label.innerHTML = text;

View file

@ -12,10 +12,7 @@ import 'emby-input';
let supportsValueSetOverride = false;
let enableWidthWithTransform;
if (Object.getOwnPropertyDescriptor && Object.defineProperty) {
const descriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
// descriptor returning null in webos
if (descriptor && descriptor.configurable) {
@ -85,7 +82,6 @@ import 'emby-input';
* @param {boolean} [isValueSet] update by 'valueset' event or by timer
*/
function updateValues(isValueSet) {
// Do not update values by 'valueset' in case of soft-implemented dragging
if (!!isValueSet && (!!this.keyboardDragging || !!this.touched)) {
return;
@ -98,24 +94,18 @@ import 'emby-input';
// Keep only one per slider frame request
cancelAnimationFrame(range.updateValuesFrame);
range.updateValuesFrame = requestAnimationFrame(function () {
let backgroundLower = range.backgroundLower;
if (backgroundLower) {
let fraction = (value - range.min) / (range.max - range.min);
if (enableWidthWithTransform) {
backgroundLower.style.transform = 'scaleX(' + (fraction) + ')';
} else {
fraction *= 100;
backgroundLower.style.width = fraction + '%';
}
fraction *= 100;
backgroundLower.style.width = fraction + '%';
}
});
}
function updateBubble(range, value, bubble, bubbleText) {
requestAnimationFrame(function () {
const bubbleTrackRect = range.sliderBubbleTrack.getBoundingClientRect();
const bubbleRect = bubble.getBoundingClientRect();
@ -141,15 +131,10 @@ import 'emby-input';
}
EmbySliderPrototype.attachedCallback = function () {
if (this.getAttribute('data-embyslider') === 'true') {
return;
}
if (enableWidthWithTransform == null) {
//enableWidthWithTransform = browser.supportsCssAnimation();
}
this.setAttribute('data-embyslider', 'true');
this.classList.add('mdl-slider');
@ -187,11 +172,7 @@ import 'emby-input';
// the more of these, the more ranges we can display
htmlToInsert += '<div class="mdl-slider-background-upper"></div>';
if (enableWidthWithTransform) {
htmlToInsert += '<div class="mdl-slider-background-lower mdl-slider-background-lower-withtransform"></div>';
} else {
htmlToInsert += '<div class="mdl-slider-background-lower"></div>';
}
htmlToInsert += '<div class="mdl-slider-background-lower"></div>';
htmlToInsert += '</div>';
htmlToInsert += '</div>';
@ -235,14 +216,12 @@ import 'emby-input';
sliderBubble.classList.add('hide');
hasHideClass = true;
}, {
passive: true
});
/* eslint-disable-next-line compat/compat */
dom.addEventListener(this, (window.PointerEvent ? 'pointermove' : 'mousemove'), function (e) {
if (!this.dragging) {
const bubbleValue = mapClientToFraction(this, e.clientX) * 100;
@ -253,7 +232,6 @@ import 'emby-input';
hasHideClass = false;
}
}
}, {
passive: true
});
@ -432,7 +410,6 @@ import 'emby-input';
};
function setRange(elem, startPercent, endPercent) {
const style = elem.style;
style.left = Math.max(startPercent, 0) + '%';
@ -441,13 +418,11 @@ import 'emby-input';
}
function mapRangesFromRuntimeToPercent(ranges, runtime) {
if (!runtime) {
return [];
}
return ranges.map(function (r) {
return {
start: (r.start / runtime) * 100,
end: (r.end / runtime) * 100
@ -456,7 +431,6 @@ import 'emby-input';
}
EmbySliderPrototype.setBufferedRanges = function (ranges, runtime, position) {
const elem = this.backgroundUpper;
if (!elem) {
return;
@ -469,7 +443,6 @@ import 'emby-input';
}
for (const range in ranges) {
if (position != null) {
if (position >= range.end) {
continue;
@ -484,7 +457,6 @@ import 'emby-input';
};
EmbySliderPrototype.setIsClear = function (isClear) {
const backgroundLower = this.backgroundLower;
if (backgroundLower) {
if (isClear) {
@ -504,7 +476,6 @@ import 'emby-input';
}
EmbySliderPrototype.detachedCallback = function () {
const interval = this.interval;
if (interval) {
clearInterval(interval);

View file

@ -13,12 +13,10 @@ import 'scrollStyles';
const activeButtonClass = buttonClass + '-active';
function setActiveTabButton(tabs, newButton, oldButton, animate) {
newButton.classList.add(activeButtonClass);
}
function getTabPanel(tabs, index) {
return null;
}
@ -29,15 +27,7 @@ import 'scrollStyles';
}
}
function addActivePanelClass(tabs, index) {
let tabPanel = getTabPanel(tabs, index);
if (tabPanel) {
tabPanel.classList.add('is-active');
}
}
function fadeInRight(elem) {
const pct = browser.mobile ? '4%' : '0.5%';
const keyframes = [
@ -52,7 +42,6 @@ import 'scrollStyles';
}
function triggerBeforeTabChange(tabs, index, previousIndex) {
tabs.dispatchEvent(new CustomEvent('beforetabchange', {
detail: {
selectedTabIndex: index,
@ -76,14 +65,12 @@ import 'scrollStyles';
}
function onClick(e) {
const tabs = this;
const current = tabs.querySelector('.' + activeButtonClass);
const tabButton = dom.parentWithClass(e.target, buttonClass);
if (tabButton && tabButton !== current) {
if (current) {
current.classList.remove(activeButtonClass);
}
@ -98,7 +85,6 @@ import 'scrollStyles';
// If toCenter is called syncronously within the click event, it sometimes ends up canceling it
setTimeout(function () {
tabs.selectedTabIndex = index;
tabs.dispatchEvent(new CustomEvent('tabchange', {
@ -112,12 +98,10 @@ import 'scrollStyles';
if (tabs.scroller) {
tabs.scroller.toCenter(tabButton, false);
}
}
}
function initScroller(tabs) {
if (tabs.scroller) {
return;
}
@ -153,7 +137,6 @@ import 'scrollStyles';
}
EmbyTabs.createdCallback = function () {
if (this.classList.contains('emby-tabs')) {
return;
}
@ -166,7 +149,6 @@ import 'scrollStyles';
};
EmbyTabs.focus = function () {
const selected = this.querySelector('.' + activeButtonClass);
if (selected) {
@ -177,21 +159,18 @@ import 'scrollStyles';
};
EmbyTabs.refresh = function () {
if (this.scroller) {
this.scroller.reload();
}
};
EmbyTabs.attachedCallback = function () {
initScroller(this);
const current = this.querySelector('.' + activeButtonClass);
const currentIndex = current ? parseInt(current.getAttribute('data-index')) : parseInt(this.getAttribute('data-index') || '0');
if (currentIndex !== -1) {
this.selectedTabIndex = currentIndex;
const tabButtons = this.querySelectorAll('.' + buttonClass);
@ -210,7 +189,6 @@ import 'scrollStyles';
};
EmbyTabs.detachedCallback = function () {
if (this.scroller) {
this.scroller.destroy();
this.scroller = null;
@ -222,16 +200,13 @@ import 'scrollStyles';
};
function getSelectedTabButton(elem) {
return elem.querySelector('.' + activeButtonClass);
}
EmbyTabs.selectedIndex = function (selected, triggerEvent) {
const tabs = this;
if (selected == null) {
return tabs.selectedTabIndex || 0;
}
@ -242,7 +217,6 @@ import 'scrollStyles';
const tabButtons = tabs.querySelectorAll('.' + buttonClass);
if (current === selected || triggerEvent === false) {
triggerBeforeTabChange(tabs, selected, current);
tabs.dispatchEvent(new CustomEvent('tabchange', {
@ -257,23 +231,18 @@ import 'scrollStyles';
if (current !== selected && currentTabButton) {
currentTabButton.classList.remove(activeButtonClass);
}
} else {
onClick.call(tabs, {
target: tabButtons[selected]
});
//tabButtons[selected].click();
}
};
function getSibling(elem, method) {
let sibling = elem[method];
while (sibling) {
if (sibling.classList.contains(buttonClass)) {
if (!sibling.classList.contains('hide')) {
return sibling;
}
@ -286,7 +255,6 @@ import 'scrollStyles';
}
EmbyTabs.selectNext = function () {
const current = getSelectedTabButton(this);
const sibling = getSibling(current, 'nextSibling');
@ -299,7 +267,6 @@ import 'scrollStyles';
};
EmbyTabs.selectPrevious = function () {
const current = getSelectedTabButton(this);
const sibling = getSibling(current, 'previousSibling');
@ -312,14 +279,12 @@ import 'scrollStyles';
};
EmbyTabs.triggerBeforeTabChange = function (selected) {
const tabs = this;
triggerBeforeTabChange(tabs, tabs.selectedIndex());
};
EmbyTabs.triggerTabChange = function (selected) {
const tabs = this;
tabs.dispatchEvent(new CustomEvent('tabchange', {
@ -330,8 +295,6 @@ import 'scrollStyles';
};
EmbyTabs.setTabEnabled = function (index, enabled) {
const tabs = this;
const btn = this.querySelector('.emby-tab-button[data-index="' + index + '"]');
if (enabled) {

View file

@ -47,7 +47,6 @@ import 'emby-input';
return;
}
let newHeight = 0;
let hasGrown = false;
if ((textarea.scrollHeight - offset) > self.maxAllowedHeight) {
textarea.style.overflowY = 'scroll';
@ -56,7 +55,6 @@ import 'emby-input';
textarea.style.overflowY = 'hidden';
textarea.style.height = 'auto';
newHeight = textarea.scrollHeight/* - offset*/;
hasGrown = true;
}
$('.customCssContainer').css('height', newHeight + 'px');
textarea.style.height = newHeight + 'px';
@ -75,7 +73,6 @@ import 'emby-input';
let elementId = 0;
if (Object.getOwnPropertyDescriptor && Object.defineProperty) {
const descriptor = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, 'value');
// descriptor returning null in webos
@ -95,7 +92,6 @@ import 'emby-input';
}
EmbyTextAreaPrototype.createdCallback = function () {
if (!this.id) {
this.id = 'embytextarea' + elementId;
elementId++;
@ -103,7 +99,6 @@ import 'emby-input';
};
EmbyTextAreaPrototype.attachedCallback = function () {
if (this.classList.contains('emby-textarea')) {
return;
}

View file

@ -6,7 +6,6 @@ import 'webcomponents';
const EmbyTogglePrototype = Object.create(HTMLInputElement.prototype);
function onKeyDown(e) {
// Don't submit form on enter
if (e.keyCode === 13) {
e.preventDefault();
@ -22,7 +21,6 @@ import 'webcomponents';
}
EmbyTogglePrototype.attachedCallback = function () {
if (this.getAttribute('data-embytoggle') === 'true') {
return;
}