mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-11-14 06:10:10 +00:00
Harvey Tindall
301f502052
web UI now uses modules, and relies less on bodge to make things work. Also fixes an issue where invites where "failed to send to xx" appeared in invite form.
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
declare var bootstrap: any;
|
|
|
|
class Modal implements BSModal {
|
|
el: HTMLDivElement;
|
|
modal: any;
|
|
|
|
constructor(id: string, find?: boolean) {
|
|
this.el = document.getElementById(id) as HTMLDivElement;
|
|
if (find) {
|
|
this.modal = bootstrap.Modal.getInstance(this.el);
|
|
} else {
|
|
this.modal = new bootstrap.Modal(this.el);
|
|
}
|
|
this.el.addEventListener('shown.bs.modal', (): void => document.body.classList.add("modal-open"));
|
|
};
|
|
|
|
show(): void { this.modal.show(); };
|
|
hide(): void { this.modal.hide(); };
|
|
}
|
|
|
|
export class BS5 implements Bootstrap {
|
|
triggerTooltips: tooltipTrigger = function (): void {
|
|
const checkboxes = [].slice.call(document.getElementById('settingsContent').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);
|
|
});
|
|
};
|
|
|
|
newModal: ModalConstructor = function (id: string, find?: boolean): BSModal {
|
|
return new Modal(id, find);
|
|
};
|
|
};
|