Fix indentation issues
This commit is contained in:
@@ -1,51 +1,48 @@
|
||||
import './emby-toggle.scss';
|
||||
import 'webcomponents.js/webcomponents-lite';
|
||||
|
||||
/* eslint-disable indent */
|
||||
const EmbyTogglePrototype = Object.create(HTMLInputElement.prototype);
|
||||
|
||||
const EmbyTogglePrototype = Object.create(HTMLInputElement.prototype);
|
||||
function onKeyDown(e) {
|
||||
// Don't submit form on enter
|
||||
if (e.keyCode === 13) {
|
||||
e.preventDefault();
|
||||
|
||||
function onKeyDown(e) {
|
||||
// Don't submit form on enter
|
||||
if (e.keyCode === 13) {
|
||||
e.preventDefault();
|
||||
this.checked = !this.checked;
|
||||
|
||||
this.checked = !this.checked;
|
||||
this.dispatchEvent(new CustomEvent('change', {
|
||||
bubbles: true
|
||||
}));
|
||||
|
||||
this.dispatchEvent(new CustomEvent('change', {
|
||||
bubbles: true
|
||||
}));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
EmbyTogglePrototype.attachedCallback = function () {
|
||||
if (this.getAttribute('data-embytoggle') === 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
EmbyTogglePrototype.attachedCallback = function () {
|
||||
if (this.getAttribute('data-embytoggle') === 'true') {
|
||||
return;
|
||||
}
|
||||
this.setAttribute('data-embytoggle', 'true');
|
||||
|
||||
this.setAttribute('data-embytoggle', 'true');
|
||||
this.classList.add('mdl-switch__input');
|
||||
|
||||
this.classList.add('mdl-switch__input');
|
||||
const labelElement = this.parentNode;
|
||||
labelElement.classList.add('mdl-switch');
|
||||
labelElement.classList.add('mdl-js-switch');
|
||||
|
||||
const labelElement = this.parentNode;
|
||||
labelElement.classList.add('mdl-switch');
|
||||
labelElement.classList.add('mdl-js-switch');
|
||||
const labelTextElement = labelElement.querySelector('span');
|
||||
|
||||
const labelTextElement = labelElement.querySelector('span');
|
||||
labelElement.insertAdjacentHTML('beforeend', '<div class="mdl-switch__trackContainer"><div class="mdl-switch__track"></div><div class="mdl-switch__thumb"><span class="mdl-switch__focus-helper"></span></div></div>');
|
||||
|
||||
labelElement.insertAdjacentHTML('beforeend', '<div class="mdl-switch__trackContainer"><div class="mdl-switch__track"></div><div class="mdl-switch__thumb"><span class="mdl-switch__focus-helper"></span></div></div>');
|
||||
labelTextElement.classList.add('toggleButtonLabel');
|
||||
labelTextElement.classList.add('mdl-switch__label');
|
||||
|
||||
labelTextElement.classList.add('toggleButtonLabel');
|
||||
labelTextElement.classList.add('mdl-switch__label');
|
||||
this.addEventListener('keydown', onKeyDown);
|
||||
};
|
||||
|
||||
this.addEventListener('keydown', onKeyDown);
|
||||
};
|
||||
document.registerElement('emby-toggle', {
|
||||
prototype: EmbyTogglePrototype,
|
||||
extends: 'input'
|
||||
});
|
||||
|
||||
document.registerElement('emby-toggle', {
|
||||
prototype: EmbyTogglePrototype,
|
||||
extends: 'input'
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
||||
Reference in New Issue
Block a user