mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Disallow block padding
This commit is contained in:
parent
454b81a037
commit
5e1b6acffe
126 changed files with 2 additions and 2127 deletions
|
@ -55,7 +55,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
@ -47,7 +43,6 @@ import 'webcomponents';
|
|||
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);
|
||||
|
|
|
@ -147,7 +147,6 @@ import 'webcomponents';
|
|||
};
|
||||
|
||||
function onUserDataChanged(e, apiClient, userData) {
|
||||
|
||||
const itemsContainer = this;
|
||||
|
||||
import('cardBuilder').then(({default: cardBuilder}) => {
|
||||
|
@ -174,7 +173,6 @@ import 'webcomponents';
|
|||
}
|
||||
|
||||
function onTimerCreated(e, apiClient, data) {
|
||||
|
||||
const itemsContainer = this;
|
||||
|
||||
if (getEventsToMonitor(itemsContainer).indexOf('timers') !== -1) {
|
||||
|
@ -360,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);
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -6,7 +6,6 @@ import 'webcomponents';
|
|||
let EmbyProgressRing = Object.create(HTMLDivElement.prototype);
|
||||
|
||||
EmbyProgressRing.createdCallback = function () {
|
||||
|
||||
this.classList.add('progressring');
|
||||
const instance = this;
|
||||
|
||||
|
@ -35,7 +34,6 @@ import 'webcomponents';
|
|||
};
|
||||
|
||||
EmbyProgressRing.setProgress = function (progress) {
|
||||
|
||||
progress = Math.floor(progress);
|
||||
|
||||
let angle;
|
||||
|
@ -49,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';
|
||||
|
@ -82,7 +79,6 @@ import 'webcomponents';
|
|||
};
|
||||
|
||||
EmbyProgressRing.detachedCallback = function () {
|
||||
|
||||
let observer = this.observer;
|
||||
|
||||
if (observer) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,52 +41,41 @@ 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');
|
||||
}
|
||||
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');
|
||||
icon.classList.remove('ratingbutton-icon-withrating');
|
||||
|
@ -115,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);
|
||||
|
@ -131,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);
|
||||
|
@ -139,7 +121,6 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
};
|
||||
|
||||
EmbyRatingButtonPrototype.attachedCallback = function () {
|
||||
|
||||
// base method
|
||||
if (EmbyButtonPrototype.attachedCallback) {
|
||||
EmbyButtonPrototype.attachedCallback.call(this);
|
||||
|
@ -148,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') {
|
||||
|
@ -167,7 +147,6 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
};
|
||||
|
||||
EmbyRatingButtonPrototype.detachedCallback = function () {
|
||||
|
||||
// base method
|
||||
if (EmbyButtonPrototype.detachedCallback) {
|
||||
EmbyButtonPrototype.detachedCallback.call(this);
|
||||
|
@ -177,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');
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -13,7 +13,6 @@ import 'emby-input';
|
|||
let supportsValueSetOverride = false;
|
||||
|
||||
if (Object.getOwnPropertyDescriptor && Object.defineProperty) {
|
||||
|
||||
const descriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
|
||||
// descriptor returning null in webos
|
||||
if (descriptor && descriptor.configurable) {
|
||||
|
@ -83,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;
|
||||
|
@ -96,7 +94,6 @@ import 'emby-input';
|
|||
// Keep only one per slider frame request
|
||||
cancelAnimationFrame(range.updateValuesFrame);
|
||||
range.updateValuesFrame = requestAnimationFrame(function () {
|
||||
|
||||
let backgroundLower = range.backgroundLower;
|
||||
|
||||
if (backgroundLower) {
|
||||
|
@ -109,7 +106,6 @@ import 'emby-input';
|
|||
}
|
||||
|
||||
function updateBubble(range, value, bubble, bubbleText) {
|
||||
|
||||
requestAnimationFrame(function () {
|
||||
const bubbleTrackRect = range.sliderBubbleTrack.getBoundingClientRect();
|
||||
const bubbleRect = bubble.getBoundingClientRect();
|
||||
|
@ -135,7 +131,6 @@ import 'emby-input';
|
|||
}
|
||||
|
||||
EmbySliderPrototype.attachedCallback = function () {
|
||||
|
||||
if (this.getAttribute('data-embyslider') === 'true') {
|
||||
return;
|
||||
}
|
||||
|
@ -211,14 +206,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;
|
||||
|
||||
|
@ -229,7 +222,6 @@ import 'emby-input';
|
|||
hasHideClass = false;
|
||||
}
|
||||
}
|
||||
|
||||
}, {
|
||||
passive: true
|
||||
});
|
||||
|
@ -408,7 +400,6 @@ import 'emby-input';
|
|||
};
|
||||
|
||||
function setRange(elem, startPercent, endPercent) {
|
||||
|
||||
const style = elem.style;
|
||||
style.left = Math.max(startPercent, 0) + '%';
|
||||
|
||||
|
@ -417,13 +408,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
|
||||
|
@ -432,7 +421,6 @@ import 'emby-input';
|
|||
}
|
||||
|
||||
EmbySliderPrototype.setBufferedRanges = function (ranges, runtime, position) {
|
||||
|
||||
const elem = this.backgroundUpper;
|
||||
if (!elem) {
|
||||
return;
|
||||
|
@ -445,7 +433,6 @@ import 'emby-input';
|
|||
}
|
||||
|
||||
for (const range in ranges) {
|
||||
|
||||
if (position != null) {
|
||||
if (position >= range.end) {
|
||||
continue;
|
||||
|
@ -460,7 +447,6 @@ import 'emby-input';
|
|||
};
|
||||
|
||||
EmbySliderPrototype.setIsClear = function (isClear) {
|
||||
|
||||
const backgroundLower = this.backgroundLower;
|
||||
if (backgroundLower) {
|
||||
if (isClear) {
|
||||
|
@ -480,7 +466,6 @@ import 'emby-input';
|
|||
}
|
||||
|
||||
EmbySliderPrototype.detachedCallback = function () {
|
||||
|
||||
const interval = this.interval;
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -30,7 +28,6 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
function fadeInRight(elem) {
|
||||
|
||||
const pct = browser.mobile ? '4%' : '0.5%';
|
||||
|
||||
const keyframes = [
|
||||
|
@ -45,7 +42,6 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
function triggerBeforeTabChange(tabs, index, previousIndex) {
|
||||
|
||||
tabs.dispatchEvent(new CustomEvent('beforetabchange', {
|
||||
detail: {
|
||||
selectedTabIndex: index,
|
||||
|
@ -69,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);
|
||||
}
|
||||
|
@ -91,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', {
|
||||
|
@ -105,12 +98,10 @@ import 'scrollStyles';
|
|||
if (tabs.scroller) {
|
||||
tabs.scroller.toCenter(tabButton, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function initScroller(tabs) {
|
||||
|
||||
if (tabs.scroller) {
|
||||
return;
|
||||
}
|
||||
|
@ -146,7 +137,6 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
EmbyTabs.createdCallback = function () {
|
||||
|
||||
if (this.classList.contains('emby-tabs')) {
|
||||
return;
|
||||
}
|
||||
|
@ -159,7 +149,6 @@ import 'scrollStyles';
|
|||
};
|
||||
|
||||
EmbyTabs.focus = function () {
|
||||
|
||||
const selected = this.querySelector('.' + activeButtonClass);
|
||||
|
||||
if (selected) {
|
||||
|
@ -170,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);
|
||||
|
@ -203,7 +189,6 @@ import 'scrollStyles';
|
|||
};
|
||||
|
||||
EmbyTabs.detachedCallback = function () {
|
||||
|
||||
if (this.scroller) {
|
||||
this.scroller.destroy();
|
||||
this.scroller = null;
|
||||
|
@ -215,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;
|
||||
}
|
||||
|
||||
|
@ -235,7 +217,6 @@ import 'scrollStyles';
|
|||
const tabButtons = tabs.querySelectorAll('.' + buttonClass);
|
||||
|
||||
if (current === selected || triggerEvent === false) {
|
||||
|
||||
triggerBeforeTabChange(tabs, selected, current);
|
||||
|
||||
tabs.dispatchEvent(new CustomEvent('tabchange', {
|
||||
|
@ -250,9 +231,7 @@ import 'scrollStyles';
|
|||
if (current !== selected && currentTabButton) {
|
||||
currentTabButton.classList.remove(activeButtonClass);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
onClick.call(tabs, {
|
||||
target: tabButtons[selected]
|
||||
});
|
||||
|
@ -260,12 +239,10 @@ import 'scrollStyles';
|
|||
};
|
||||
|
||||
function getSibling(elem, method) {
|
||||
|
||||
let sibling = elem[method];
|
||||
|
||||
while (sibling) {
|
||||
if (sibling.classList.contains(buttonClass)) {
|
||||
|
||||
if (!sibling.classList.contains('hide')) {
|
||||
return sibling;
|
||||
}
|
||||
|
@ -278,7 +255,6 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
EmbyTabs.selectNext = function () {
|
||||
|
||||
const current = getSelectedTabButton(this);
|
||||
|
||||
const sibling = getSibling(current, 'nextSibling');
|
||||
|
@ -291,7 +267,6 @@ import 'scrollStyles';
|
|||
};
|
||||
|
||||
EmbyTabs.selectPrevious = function () {
|
||||
|
||||
const current = getSelectedTabButton(this);
|
||||
|
||||
const sibling = getSibling(current, 'previousSibling');
|
||||
|
@ -304,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', {
|
||||
|
|
|
@ -73,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
|
||||
|
@ -93,7 +92,6 @@ import 'emby-input';
|
|||
}
|
||||
|
||||
EmbyTextAreaPrototype.createdCallback = function () {
|
||||
|
||||
if (!this.id) {
|
||||
this.id = 'embytextarea' + elementId;
|
||||
elementId++;
|
||||
|
@ -101,7 +99,6 @@ import 'emby-input';
|
|||
};
|
||||
|
||||
EmbyTextAreaPrototype.attachedCallback = function () {
|
||||
|
||||
if (this.classList.contains('emby-textarea')) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue