Explorar el Código

added settings button to templated pages

master
Haku hace 4 años
padre
commit
5bdc0dff29
Se han modificado 1 ficheros con 18 adiciones y 0 borrados
  1. +18
    -0
      src/buttons.ts

+ 18
- 0
src/buttons.ts Ver fichero

@@ -0,0 +1,18 @@
function addButton(label: string, callback: (e: MouseEvent) => void)
{
const button: HTMLInputElement = document.createElement('input');
button.type = 'button';
button.addEventListener('click', callback);
button.id = label.toLowerCase().replace(/ /g, '-');
button.value = label;
const belDiv: HTMLDivElement = document.createElement('div');
button.classList.add('button');
belDiv.classList.add('bel');
belDiv.appendChild(button);
document.querySelector('#loginswitcher').parentNode.insertBefore(belDiv, document.querySelector('#loginswitcher'));
}

addButton('Raspberry Settings', (e: MouseEvent): void =>
{
window.location.href = '/page=blank/raspberry=settings';
});

Cargando…
Cancelar
Guardar