js2ts: processing plugin 정리

This commit is contained in:
2021-08-21 00:29:50 +09:00
parent 096b87d4e3
commit 5c56b5aacf
5 changed files with 25 additions and 210 deletions
+6 -2
View File
@@ -1,6 +1,6 @@
import $ from 'jquery';
$(function($){
export function loadPlugin(): void{
function changeNationColorPlate(){
const $this = $('#colorType');
const $option = $this.find('option:selected');
@@ -9,8 +9,12 @@ $(function($){
'color':$option.css('color')
});
}
$('#colorType').change(function(){
$('#colorType').on('change', function(){
changeNationColorPlate();
});
changeNationColorPlate();
}
$(function(){
loadPlugin();
});
+7 -2
View File
@@ -3,7 +3,8 @@ import { unwrap_any } from "./util/unwrap_any";
/*import $ from 'jquery';
import 'select2';*///TODO: processing
$(function() {
export function loadPlugin(): void {
const $target = $("#destCityID");
console.log('target', $target);
void reloadWorldMap({
@@ -11,7 +12,7 @@ $(function() {
clickableAll: true,
neutralView: true,
useCachedMap: true,
selectCallback: function(city) {
selectCallback: function (city) {
const currVal = unwrap_any<string>($target.val());
$target.val(city.id).trigger("change");
if ($target.val() === null) {
@@ -20,4 +21,8 @@ $(function() {
return false;
}
});
}
$(function () {
loadPlugin();
});
+5 -1
View File
@@ -3,7 +3,7 @@ import { unwrap_any } from "./util/unwrap_any";
/*import $ from 'jquery';
import 'select2';*///TODO: processing
$(function() {
export function loadPlugin(): void{
const $target = $("#destNationID");
void reloadWorldMap({
isDetailMap: false,
@@ -22,4 +22,8 @@ $(function() {
return false;
}
});
}
$(function() {
loadPlugin();
});
+7 -11
View File
@@ -3,7 +3,6 @@ import { unwrap_any } from './util/unwrap_any';
declare global {
interface Window {
calc: (id: number) => void;
submitAction: () => void;
}
}
@@ -12,9 +11,9 @@ declare const leadership: number;
declare const fullLeadership: number;
declare const currentCrewType: number;
declare const currentCrew: number;
declare const currentGold: number;
//declare const currentGold: number;
declare const is모병 = false;
window.calc = function (id) {
function calc(id: number) {
const $obj = $('#crewType{0}'.format(id));
const crew = parseInt(unwrap_any<string>($obj.find('.form_double').val()));
const baseCost = $obj.data('cost');
@@ -28,16 +27,13 @@ window.calc = function (id) {
}
$(function () {
const $postForm = $('#post_form');
const $formAmount = $('#amount');
const $formCrewtype = $('#crewType');
$('.form_double').on('keyup change', function (e) {
const $this = $(this);
const $parent = $this.parents('.input_form');
const crewtype = parseInt($parent.data('crewtype'));
window.calc(crewtype);
calc(crewtype);
$formCrewtype.val(crewtype);
$formAmount.val(parseFloat(unwrap_any<string>($this.val())) * 100);
@@ -47,7 +43,7 @@ $(function () {
return false;
});
$('.btn_half').click(function () {
$('.btn_half').on('click', function () {
const $this = $(this);
const $parent = $this.closest('.input_form');
const crewtype = parseInt($parent.data('crewtype'));
@@ -59,7 +55,7 @@ $(function () {
return false;
});
$('.btn_fill').click(function () {
$('.btn_fill').on('click', function () {
const $this = $(this);
const $parent = $this.closest('.input_form');
const crewtype = parseInt($parent.data('crewtype'));
@@ -74,7 +70,7 @@ $(function () {
return false;
});
$('.btn_full').click(function () {
$('.btn_full').on('click', function () {
const $this = $(this);
const $parent = $this.closest('.input_form');
const crewtype = parseInt($parent.data('crewtype'));
@@ -86,7 +82,7 @@ $(function () {
return false;
});
$('.submit_btn').click(function () {
$('.submit_btn').on('click', function () {
const $this = $(this);
const $parent = $this.closest('tr').find('.input_form');
const crewtype = parseInt($parent.data('crewtype'));