define(['css!./emby-toggle', 'registerElement'], function () { var EmbyTogglePrototype = Object.create(HTMLInputElement.prototype); function onKeyDown(e) { // Don't submit form on enter if (e.keyCode == 13) { e.preventDefault(); this.checked = !this.checked; this.dispatchEvent(new CustomEvent('change', { bubbles: true })); return false; } } EmbyTogglePrototype.attachedCallback = function () { if (this.getAttribute('data-embytoggle') == 'true') { return; } this.setAttribute('data-embytoggle', 'true'); this.classList.add('mdl-switch__input'); var labelElement = this.parentNode; labelElement.classList.add('mdl-switch'); labelElement.classList.add('mdl-js-switch'); var labelTextElement = labelElement.querySelector('span'); labelElement.insertAdjacentHTML('beforeend', '