js2ts: common 분리, troop.js
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
-111
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,88 @@
|
||||
import { activeFlip, escapeHtml, isInt, mb_strwidth, mb_strimwidth, convertDictById, convertSet, hexToRgb, isBrightColor, convColorValue, numberWithCommas, linkifyStrWithOpt, TemplateEngine, getIconPath, combineObject, combineArray, activeFlipItem, errUnknown, errUnknownToast, quickReject, nl2br, getNpcColor, initTooltip } from "./common_legacy";
|
||||
|
||||
jQuery(function ($) {
|
||||
initTooltip();
|
||||
activeFlip();
|
||||
|
||||
const customCSS = localStorage.getItem('sam_customCSS');
|
||||
if (customCSS) {
|
||||
const $style = $('<style type="text/css"></style>');
|
||||
$style.text(customCSS);
|
||||
$style.appendTo($('head'));
|
||||
}
|
||||
});
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
/** @deprecated Module 사용할 것 */
|
||||
escapeHtml: typeof escapeHtml;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
isInt: typeof isInt;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
mb_strwidth: typeof mb_strwidth;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
mb_strimwidth: typeof mb_strimwidth;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
convertDictById: typeof convertDictById;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
convertSet: typeof convertSet;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
hexToRgb: typeof hexToRgb;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
isBrightColor: typeof isBrightColor;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
convColorValue: typeof convColorValue;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
numberWithCommas: typeof numberWithCommas;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
linkifyStrWithOpt: typeof linkifyStrWithOpt;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
TemplateEngine: typeof TemplateEngine;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
getIconPath: typeof getIconPath;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
activeFlip: typeof activeFlip;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
combineObject: typeof combineObject;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
combineArray: typeof combineArray;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
activeFlipItem: typeof activeFlipItem;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
errUnknown: typeof errUnknown;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
errUnknownToast: typeof errUnknownToast;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
quickReject: typeof quickReject;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
nl2br: typeof nl2br;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
getNpcColor: typeof getNpcColor;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
initTooltip: typeof initTooltip;
|
||||
}
|
||||
}
|
||||
|
||||
window.escapeHtml = escapeHtml;
|
||||
window.isInt = isInt;
|
||||
window.mb_strwidth = mb_strwidth;
|
||||
window.mb_strimwidth = mb_strimwidth;
|
||||
window.convertDictById = convertDictById;
|
||||
window.convertSet = convertSet;
|
||||
window.hexToRgb = hexToRgb;
|
||||
window.isBrightColor = isBrightColor;
|
||||
window.convColorValue = convColorValue;
|
||||
window.numberWithCommas = numberWithCommas;
|
||||
window.linkifyStrWithOpt = linkifyStrWithOpt;
|
||||
window.TemplateEngine = TemplateEngine;
|
||||
window.getIconPath = getIconPath;
|
||||
window.activeFlip = activeFlip;
|
||||
window.combineObject = combineObject;
|
||||
window.combineArray = combineArray;
|
||||
window.activeFlipItem = activeFlipItem;
|
||||
window.errUnknown = errUnknown;
|
||||
window.errUnknownToast = errUnknownToast;
|
||||
window.quickReject = quickReject;
|
||||
window.nl2br = nl2br;
|
||||
window.getNpcColor = getNpcColor;
|
||||
window.initTooltip = initTooltip;
|
||||
+2
-116
@@ -296,45 +296,6 @@ export function activeFlipItem($img: JQuery<HTMLElement>): void {
|
||||
$img.css('cursor', 'pointer');
|
||||
}
|
||||
|
||||
jQuery(function ($) {
|
||||
$('.obj_tooltip').mouseover(function () {
|
||||
const $objTooltip = $(this);
|
||||
if ($objTooltip.data('setObjTooltip')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let tooltipClassText = $objTooltip.data('tooltip-class');
|
||||
if (!tooltipClassText) {
|
||||
tooltipClassText = '';
|
||||
}
|
||||
const template = '<div class="tooltip {0}" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>'
|
||||
.format(tooltipClassText);
|
||||
|
||||
$objTooltip.tooltip({
|
||||
title: function () {
|
||||
return $.trim($(this).find('.tooltiptext').html());
|
||||
},
|
||||
template: template,
|
||||
html: true
|
||||
}).tooltip('show');
|
||||
|
||||
$objTooltip.data('setObjTooltip', true);
|
||||
});
|
||||
/*each(function(){
|
||||
var $objTooltip = $(this);
|
||||
|
||||
|
||||
});*/
|
||||
|
||||
activeFlip();
|
||||
|
||||
const customCSS = localStorage.getItem('sam_customCSS');
|
||||
if (customCSS) {
|
||||
const $style = $('<style type="text/css"></style>');
|
||||
$style.text(customCSS);
|
||||
$style.appendTo($('head'));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
export function errUnknown(): void {
|
||||
@@ -380,7 +341,7 @@ export function getNpcColor(npcType: number): 'cyan' | 'skyblue' | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
export function initTooltip($obj: JQuery<HTMLElement>): void {
|
||||
export function initTooltip($obj?: JQuery<HTMLElement>): void {
|
||||
if ($obj === undefined) {
|
||||
$obj = $('.obj_tooltip');
|
||||
} else if (!$obj.hasClass('obj_tooltip')) {
|
||||
@@ -420,79 +381,4 @@ export function initTooltip($obj: JQuery<HTMLElement>): void {
|
||||
$objTooltip.data('setObjTooltip', true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
/** @deprecated Module 사용할 것 */
|
||||
escapeHtml: typeof escapeHtml;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
isInt: typeof isInt;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
mb_strwidth: typeof mb_strwidth;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
mb_strimwidth: typeof mb_strimwidth;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
convertDictById: typeof convertDictById;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
convertSet: typeof convertSet;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
hexToRgb: typeof hexToRgb;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
isBrightColor: typeof isBrightColor;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
convColorValue: typeof convColorValue;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
numberWithCommas: typeof numberWithCommas;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
linkifyStrWithOpt: typeof linkifyStrWithOpt;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
TemplateEngine: typeof TemplateEngine;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
getIconPath: typeof getIconPath;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
activeFlip: typeof activeFlip;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
combineObject: typeof combineObject;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
combineArray: typeof combineArray;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
activeFlipItem: typeof activeFlipItem;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
errUnknown: typeof errUnknown;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
errUnknownToast: typeof errUnknownToast;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
quickReject: typeof quickReject;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
nl2br: typeof nl2br;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
getNpcColor: typeof getNpcColor;
|
||||
/** @deprecated Module 사용할 것 */
|
||||
initTooltip: typeof initTooltip;
|
||||
}
|
||||
}
|
||||
|
||||
window.escapeHtml = escapeHtml;
|
||||
window.isInt = isInt;
|
||||
window.mb_strwidth = mb_strwidth;
|
||||
window.mb_strimwidth = mb_strimwidth;
|
||||
window.convertDictById = convertDictById;
|
||||
window.convertSet = convertSet;
|
||||
window.hexToRgb = hexToRgb;
|
||||
window.isBrightColor = isBrightColor;
|
||||
window.convColorValue = convColorValue;
|
||||
window.numberWithCommas = numberWithCommas;
|
||||
window.linkifyStrWithOpt = linkifyStrWithOpt;
|
||||
window.TemplateEngine = TemplateEngine;
|
||||
window.getIconPath = getIconPath;
|
||||
window.activeFlip = activeFlip;
|
||||
window.combineObject = combineObject;
|
||||
window.combineArray = combineArray;
|
||||
window.activeFlipItem = activeFlipItem;
|
||||
window.errUnknown = errUnknown;
|
||||
window.errUnknownToast = errUnknownToast;
|
||||
window.quickReject = quickReject;
|
||||
window.nl2br = nl2br;
|
||||
window.getNpcColor = getNpcColor;
|
||||
window.initTooltip = initTooltip;
|
||||
}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
import { errUnknown } from "./common_legacy";
|
||||
|
||||
jQuery(function($){
|
||||
//btnJoinTroop, btnLeaveTroop, btnKickTroop, btnCreateTroop, btnChangeTroopName
|
||||
$('#btnLeaveTroop').click(function(e){
|
||||
if(!confirm("정말 부대를 탈퇴하시겠습니까?")){
|
||||
return false;
|
||||
}
|
||||
$.post({
|
||||
url:'j_troop.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
action:'부대탈퇴'
|
||||
}
|
||||
}).then(function(data){
|
||||
console.log(data);
|
||||
if(!data.result){
|
||||
alert(data.reason);
|
||||
location.reload();
|
||||
}
|
||||
|
||||
location.reload();
|
||||
|
||||
}, errUnknown);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#btnCreateTroop').click(function(e){
|
||||
$.post({
|
||||
url:'j_troop.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
action:'부대창설',
|
||||
name:$('#nameplate').val()
|
||||
}
|
||||
}).then(function(data){
|
||||
console.log(data);
|
||||
if(!data.result){
|
||||
alert(data.reason);
|
||||
location.reload();
|
||||
}
|
||||
|
||||
location.reload();
|
||||
|
||||
}, errUnknown);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#btnChangeTroopName').click(function(e){
|
||||
$.post({
|
||||
url:'j_troop.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
action:'부대변경',
|
||||
name:$('#nameplate').val()
|
||||
}
|
||||
}).then(function(data){
|
||||
console.log(data);
|
||||
if(!data.result){
|
||||
alert(data.reason);
|
||||
location.reload();
|
||||
}
|
||||
|
||||
location.reload();
|
||||
|
||||
}, errUnknown);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#btnKickTroop').click(function(e){
|
||||
$.post({
|
||||
url:'j_troop.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
action:'부대추방',
|
||||
gen:$('#genNo').val()
|
||||
}
|
||||
}).then(function(data){
|
||||
console.log(data);
|
||||
if(!data.result){
|
||||
alert(data.reason);
|
||||
location.reload();
|
||||
}
|
||||
|
||||
location.reload();
|
||||
|
||||
}, errUnknown);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#btnJoinTroop').click(function(e){
|
||||
$.post({
|
||||
url:'j_troop.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
action:'부대가입',
|
||||
troop:$('.troopId:checked').val()
|
||||
}
|
||||
}).then(function(data){
|
||||
console.log(data);
|
||||
if(!data.result){
|
||||
alert(data.reason);
|
||||
location.reload();
|
||||
}
|
||||
|
||||
location.reload();
|
||||
|
||||
}, errUnknown);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
+2
-1
@@ -10,7 +10,8 @@ module.exports = [
|
||||
},
|
||||
entry: {
|
||||
inheritPoint: './hwe/ts/inheritPoint.ts',
|
||||
common: './hwe/ts/common_legacy.ts',
|
||||
common: './hwe/ts/common_deprecated.ts',
|
||||
troop: './hwe/ts/troop.ts',
|
||||
},
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
|
||||
Reference in New Issue
Block a user