jquery-redirect 제거

This commit is contained in:
2021-08-28 23:34:11 +09:00
parent 7ed9a8075c
commit e135835e61
3 changed files with 20 additions and 58 deletions
-2
View File
@@ -17,8 +17,6 @@ $generalObj = General::createGeneralObjFromDB($session->generalID);
<title><?=UniqueConst::$serverName?>: 사령부</title>
<?=WebUtil::printJS('../d_shared/common_path.js')?>
<?=WebUtil::printJS('dist_js/vendors.js')?>
<?=WebUtil::printJS('dist_js/common.js')?>
<?=WebUtil::printJS('../e_lib/jquery.redirect.js')?>
<?=WebUtil::printJS('dist_js/chiefCenter.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
-39
View File
@@ -1,39 +0,0 @@
type JqueryRedirectOpts = {
url: string,
values?: Record<string, string | number | string[] | boolean>,
method?: 'GET' | 'POST',
target?: string,
traditional?: boolean
redirectTop?: boolean,
}
interface JQueryStatic {
/**
* jQuery Redirect
* @param {string} url - Url of the redirection
* @param {Object} values - (optional) An object with the data to send. If not present will look for values as QueryString in the target url.
* @param {string} method - (optional) The HTTP verb can be GET or POST (defaults to POST)
* @param {string} target - (optional) The target of the form. If you set "_blank" will open the url in a new window.
* @param {boolean} traditional - (optional) This provides the same function as jquery's ajax function. The brackets are omitted on the field name if its an array. This allows arrays to work with MVC.net among others.
* @param {boolean} redirectTop - (optional) If its called from a iframe, force to navigate the top window.
*/
redirect(
url: string,
values?: Record<string, string | number | string[] | boolean>,
method?: 'GET' | 'POST',
target?: string, traditional?:
boolean, redirectTop?: boolean
): void;
/**
* jQuery Redirect
* @param {string} opts - Options object
* @param {string} opts.url - Url of the redirection
* @param {Object} opts.values - (optional) An object with the data to send. If not present will look for values as QueryString in the target url.
* @param {string} opts.method - (optional) The HTTP verb can be GET or POST (defaults to POST)
* @param {string} opts.target - (optional) The target of the form. "_blank" will open the url in a new window.
* @param {boolean} opts.traditional - (optional) This provides the same function as jquery's ajax function. The brackets are omitted on the field name if its an array. This allows arrays to work with MVC.net among others.
* @param {boolean} opts.redirectTop - (optional) If its called from a iframe, force to navigate the top window.
*/
redirect(opt: JqueryRedirectOpts): void;
}
+20 -17
View File
@@ -9,6 +9,7 @@ import { convertFormData } from './util/convertFormData';
import { unwrap_any } from "./util/unwrap_any";
import { parseTime } from './util/parseTime';
import { formatTime } from './util/formatTime';
import { stringifyUrl } from 'query-string';
declare const maxChiefTurn: number;
@@ -31,11 +32,11 @@ type ChiefResponse = InvalidResponse | {
result: true,
date: string,
nationTurnBrief: {
name:string|null,
turnTime:string|null,
officerLevelText:string,
npcType:number,
turn:string
name: string | null,
turnTime: string | null,
officerLevelText: string,
npcType: number,
turn: string
}[],
isChief: boolean,
turnTerm: number
@@ -107,7 +108,7 @@ async function reloadTable() {
return;
}
const turnTerm = data.turnTerm;
const tmpFilledChiefList:Record<number, boolean> = {};
const tmpFilledChiefList: Record<number, boolean> = {};
if (data.isChief) {
chiefTableObj.btns.css('visibility', 'visible');
@@ -134,7 +135,7 @@ async function reloadTable() {
plateObj.officerLevelText.text(chiefInfo.officerLevelText);
let turnTimeObj: Date|undefined;
let turnTimeObj: Date | undefined;
if (chiefInfo.turnTime) {
turnTimeObj = parseTime(chiefInfo.turnTime);
@@ -176,11 +177,11 @@ async function reloadTable() {
async function reserveTurn(turnList: number[], command: string) {
console.log(turnList, command);
try{
try {
const response = await axios({
url: 'j_set_chief_command.php',
responseType:'json',
responseType: 'json',
method: 'post',
data: convertFormData({
turnList,
@@ -195,7 +196,7 @@ async function reserveTurn(turnList: number[], command: string) {
}
await reloadTable();
}
catch(e){
catch (e) {
console.error(e);
errUnknown();
}
@@ -223,7 +224,7 @@ async function pushTurn(turnCnt: number) {
}
}
jQuery(function ($) {
$(function ($) {
chiefTableObj = genChiefTableObj();
void reloadTable();
@@ -232,12 +233,14 @@ jQuery(function ($) {
const turnList = unwrap_any<string[]>($('#chiefTurnSelector').val()).map(function (v) { return parseInt(v); });
const $command = $('#chiefCommandList option:selected');
if ($command.data('reqarg')) {
$.redirect(
"b_processing.php", {
command: unwrap($command.val()),
turnList: turnList.join('_'),
is_chief: true
}, "GET");
document.location.href = stringifyUrl({
url: 'b_processing.php',
query: {
command: unwrap_any<string>($command.val()),
turnList: turnList.join('_'),
is_chief: true
}
});
}
else {
void reserveTurn(turnList, unwrap_any<string>($command.val()));