mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-11-14 06:10:10 +00:00
Harvey Tindall
32b8ed4aa2
i wanted to split up the web ui components into multiple files, and figured it'd be a good chance to try out typescript. run make typescript to compile everything in ts/ and put it in data/static/. This is less of a rewrite and more of a refactoring, most of it still works the same but bits have been cleaned up too. Remaining javascript found in setup.js and form.html
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
declare var bootstrap: any;
|
|
|
|
var bsVersion = 5;
|
|
|
|
function createModal(id: string, find?: boolean): any {
|
|
let modal: any;
|
|
if (find) {
|
|
modal = bootstrap.Modal.getInstance(document.getElementById(id));
|
|
} else {
|
|
modal = new bootstrap.Modal(document.getElementById(id));
|
|
}
|
|
document.getElementById(id).addEventListener('shown.bs.modal', (): void => document.body.classList.add("modal-open"));
|
|
return {
|
|
modal: modal,
|
|
show: function (): any {
|
|
const temp = this.modal.show();
|
|
return temp;
|
|
},
|
|
hide: function (): any { return this.modal.hide(); }
|
|
};
|
|
}
|
|
|
|
function triggerTooltips(): void {
|
|
(document.getElementById('settingsMenu') as HTMLButtonElement).addEventListener('shown.bs.modal', (): void => {
|
|
const checkboxes = [].slice.call(document.getElementById('settingsMenu').querySelectorAll('input[type="checkbox"]'));
|
|
for (const i in checkboxes) {
|
|
checkboxes[i].click();
|
|
checkboxes[i].click();
|
|
}
|
|
const tooltips = [].slice.call(document.querySelectorAll('a[data-toggle="tooltip"]'));
|
|
tooltips.map((el: HTMLAnchorElement): any => {
|
|
return new bootstrap.Tooltip(el);
|
|
});
|
|
});
|
|
}
|
|
|