Fix indentation issues

This commit is contained in:
Bill Thornton 2023-04-19 01:56:05 -04:00
parent 52c8cffc82
commit f2726653ae
120 changed files with 30271 additions and 30631 deletions

View file

@ -5,73 +5,70 @@ import Events from '../../utils/events.ts';
import 'webcomponents.js/webcomponents-lite';
/* eslint-disable indent */
function addNotificationEvent(instance, name, handler) {
const localHandler = handler.bind(instance);
Events.on(serverNotifications, name, localHandler);
instance[name] = localHandler;
}
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);
instance[name] = null;
}
}
function onRefreshProgress(e, apiClient, info) {
const indicator = this;
if (!indicator.itemId) {
indicator.itemId = dom.parentWithAttribute(indicator, 'data-id').getAttribute('data-id');
}
function removeNotificationEvent(instance, name) {
const handler = instance[name];
if (handler) {
Events.off(serverNotifications, name, handler);
instance[name] = null;
if (info.ItemId === indicator.itemId) {
const progress = parseFloat(info.Progress);
if (progress && progress < 100) {
this.classList.remove('hide');
} else {
this.classList.add('hide');
}
this.setAttribute('data-progress', progress);
}
}
const EmbyItemRefreshIndicatorPrototype = Object.create(EmbyProgressRing);
EmbyItemRefreshIndicatorPrototype.createdCallback = function () {
// base method
if (EmbyProgressRing.createdCallback) {
EmbyProgressRing.createdCallback.call(this);
}
function onRefreshProgress(e, apiClient, info) {
const indicator = this;
addNotificationEvent(this, 'RefreshProgress', onRefreshProgress);
};
if (!indicator.itemId) {
indicator.itemId = dom.parentWithAttribute(indicator, 'data-id').getAttribute('data-id');
}
EmbyItemRefreshIndicatorPrototype.attachedCallback = function () {
// base method
if (EmbyProgressRing.attachedCallback) {
EmbyProgressRing.attachedCallback.call(this);
}
};
if (info.ItemId === indicator.itemId) {
const progress = parseFloat(info.Progress);
if (progress && progress < 100) {
this.classList.remove('hide');
} else {
this.classList.add('hide');
}
this.setAttribute('data-progress', progress);
}
EmbyItemRefreshIndicatorPrototype.detachedCallback = function () {
// base method
if (EmbyProgressRing.detachedCallback) {
EmbyProgressRing.detachedCallback.call(this);
}
const EmbyItemRefreshIndicatorPrototype = Object.create(EmbyProgressRing);
removeNotificationEvent(this, 'RefreshProgress');
this.itemId = null;
};
EmbyItemRefreshIndicatorPrototype.createdCallback = function () {
// base method
if (EmbyProgressRing.createdCallback) {
EmbyProgressRing.createdCallback.call(this);
}
document.registerElement('emby-itemrefreshindicator', {
prototype: EmbyItemRefreshIndicatorPrototype,
extends: 'div'
});
addNotificationEvent(this, 'RefreshProgress', onRefreshProgress);
};
EmbyItemRefreshIndicatorPrototype.attachedCallback = function () {
// base method
if (EmbyProgressRing.attachedCallback) {
EmbyProgressRing.attachedCallback.call(this);
}
};
EmbyItemRefreshIndicatorPrototype.detachedCallback = function () {
// base method
if (EmbyProgressRing.detachedCallback) {
EmbyProgressRing.detachedCallback.call(this);
}
removeNotificationEvent(this, 'RefreshProgress');
this.itemId = null;
};
document.registerElement('emby-itemrefreshindicator', {
prototype: EmbyItemRefreshIndicatorPrototype,
extends: 'div'
});
/* eslint-enable indent */