mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-31 08:02:42 +01:00
ecdeb545e0
Removed uppercasing of labels to make a little friendlier. Extracted out toggleswitch JS into own component. Improved basic code input for html-head-input area.
19 lines
443 B
JavaScript
19 lines
443 B
JavaScript
|
|
class ToggleSwitch {
|
|
|
|
constructor(elem) {
|
|
this.elem = elem;
|
|
this.input = elem.querySelector('input');
|
|
|
|
this.elem.onclick = this.onClick.bind(this);
|
|
}
|
|
|
|
onClick(event) {
|
|
let checked = this.input.value !== 'true';
|
|
this.input.value = checked ? 'true' : 'false';
|
|
checked ? this.elem.classList.add('active') : this.elem.classList.remove('active');
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = ToggleSwitch; |