fix: bootstrap5 modal
This commit is contained in:
@@ -9,6 +9,7 @@ import { numberWithCommas } from "@util/numberWithCommas";
|
|||||||
import { unwrap_any } from '@util/unwrap_any';
|
import { unwrap_any } from '@util/unwrap_any';
|
||||||
import { BasicGeneralListResponse, InvalidResponse } from '@/defs';
|
import { BasicGeneralListResponse, InvalidResponse } from '@/defs';
|
||||||
import { formatTime } from '@util/formatTime';
|
import { formatTime } from '@util/formatTime';
|
||||||
|
import { Modal } from 'bootstrap';
|
||||||
|
|
||||||
type CityAttackerInfo = {
|
type CityAttackerInfo = {
|
||||||
level: number,
|
level: number,
|
||||||
@@ -222,7 +223,7 @@ $(function ($) {
|
|||||||
|
|
||||||
const $modal = $('#importModal');
|
const $modal = $('#importModal');
|
||||||
$modal.data('target', $card);
|
$modal.data('target', $card);
|
||||||
$modal.modal('show');
|
new Modal($modal[0]).show();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.btn-general-save').on('click', function () {
|
$('.btn-general-save').on('click', function () {
|
||||||
@@ -959,7 +960,7 @@ $(function ($) {
|
|||||||
const $card = $modal.data('target');
|
const $card = $modal.data('target');
|
||||||
importGeneralInfo($card, data.general);
|
importGeneralInfo($card, data.general);
|
||||||
|
|
||||||
$modal.modal('hide');
|
new Modal($modal[0]).hide();
|
||||||
}, errUnknown);
|
}, errUnknown);
|
||||||
|
|
||||||
|
|
||||||
@@ -1008,7 +1009,7 @@ $(function ($) {
|
|||||||
}).then(function (data: BasicGeneralListResponse | InvalidResponse) {
|
}).then(function (data: BasicGeneralListResponse | InvalidResponse) {
|
||||||
if (!data.result) {
|
if (!data.result) {
|
||||||
alert(data.reason);
|
alert(data.reason);
|
||||||
$('#importModal').modal('hide');
|
new Modal(unwrap(document.querySelector('#importModal'))).hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-4
@@ -231,10 +231,12 @@ async function doLoginUsingOAuth() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const modalEl = unwrap(document.querySelector('#modalOTP'))
|
const modalEl = unwrap(document.querySelector('#modalOTP'))
|
||||||
|
if (!modalOTP) {
|
||||||
modalOTP = new Modal(modalEl);
|
modalOTP = new Modal(modalEl);
|
||||||
modalEl.addEventListener('shown.bs.modal', function () {
|
modalEl.addEventListener('shown.bs.modal', function () {
|
||||||
$('#otp_code').trigger('focus');
|
unwrap(document.querySelector<HTMLElement>('#otp_code')).focus();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
modalOTP.show();
|
modalOTP.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,10 +344,14 @@ $(async function ($) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const $modal = $('#modalOTP').modal() as unknown as JQuery;
|
const modalEl = unwrap(document.querySelector('#modalOTP'))
|
||||||
$modal.on('shown.bs.modal', function () {
|
if (!modalOTP) {
|
||||||
$('#otp_code').trigger('focus');
|
modalOTP = new Modal(modalEl);
|
||||||
|
modalEl.addEventListener('shown.bs.modal', function () {
|
||||||
|
unwrap(document.querySelector<HTMLElement>('#otp_code')).focus();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
modalOTP.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#otp_form').on('submit', async function (e) {
|
$('#otp_form').on('submit', async function (e) {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { unwrap } from '@util/unwrap';
|
|||||||
import { parseTime } from '@util/parseTime';
|
import { parseTime } from '@util/parseTime';
|
||||||
import { formatTime } from '@util/formatTime';
|
import { formatTime } from '@util/formatTime';
|
||||||
import '@/gateway/common';
|
import '@/gateway/common';
|
||||||
|
import { Modal } from 'bootstrap';
|
||||||
|
|
||||||
type ResultUserInfo = {
|
type ResultUserInfo = {
|
||||||
result: true,
|
result: true,
|
||||||
@@ -128,14 +129,14 @@ function showAdjustServerModal(serverList: [string, string][]) {
|
|||||||
$form.append($item);
|
$form.append($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
const $modal = $('#chooseServer');
|
const modalEl = unwrap(document.querySelector('#chooseServer'));
|
||||||
$modal.modal({
|
new Modal(modalEl, {
|
||||||
backdrop: 'static'
|
backdrop: 'static'
|
||||||
});
|
});
|
||||||
$modal.on('hidden.bs.modal', function () {
|
modalEl.addEventListener('hidden.bs.modal', function () {
|
||||||
location.reload();
|
location.reload();
|
||||||
return;
|
return;
|
||||||
});
|
})
|
||||||
|
|
||||||
$("#modal-apply").off("click").on("click", async function () {
|
$("#modal-apply").off("click").on("click", async function () {
|
||||||
const events: Promise<unknown>[] = [];
|
const events: Promise<unknown>[] = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user