refactor: goodbye bootstrap4

This commit is contained in:
2021-12-11 02:50:24 +09:00
parent 37212c9392
commit e1897964e8
13 changed files with 328 additions and 494 deletions
+12 -3
View File
@@ -124,6 +124,8 @@ declare global {
}
}
let modalImport: Modal|undefined = undefined;
$(function ($) {
@@ -223,7 +225,10 @@ $(function ($) {
const $modal = $('#importModal');
$modal.data('target', $card);
new Modal($modal[0]).show();
if(!modalImport){
modalImport = new Modal($modal[0]);
}
modalImport.show();
});
$('.btn-general-save').on('click', function () {
@@ -960,7 +965,9 @@ $(function ($) {
const $card = $modal.data('target');
importGeneralInfo($card, data.general);
new Modal($modal[0]).hide();
if(modalImport){
modalImport.hide();
}
}, errUnknown);
@@ -1009,7 +1016,9 @@ $(function ($) {
}).then(function (data: BasicGeneralListResponse | InvalidResponse) {
if (!data.result) {
alert(data.reason);
new Modal(unwrap(document.querySelector('#importModal'))).hide();
if(modalImport){
modalImport.hide();
}
return false;
}
+2 -1
View File
@@ -1,5 +1,6 @@
import $ from "jquery";
import { Tooltip } from "bootstrap";
import { trim } from "lodash";
/**
* object의 array를 id를 key로 삼는 object로 재 변환
@@ -189,7 +190,7 @@ export function initTooltip($obj?: JQuery<HTMLElement>): void {
const oTooltip = new Tooltip(this, {
title: function(){
return $.trim($(this).find('.tooltiptext').html());
return trim(this.querySelector('.tooltiptext')?.innerHTML);
},
template: template,
html: true
+4 -2
View File
@@ -130,13 +130,15 @@ function showAdjustServerModal(serverList: [string, string][]) {
}
const modalEl = unwrap(document.querySelector('#chooseServer'));
new Modal(modalEl, {
const modal = new Modal(modalEl, {
backdrop: 'static'
});
modalEl.addEventListener('hidden.bs.modal', function () {
location.reload();
return;
})
});
modal.show();
$("#modal-apply").off("click").on("click", async function () {
const events: Promise<unknown>[] = [];