js2ts: history

This commit is contained in:
2021-08-30 02:02:53 +09:00
parent 72e65587df
commit d5f0d60794
4 changed files with 43 additions and 34 deletions
+1 -3
View File
@@ -101,10 +101,8 @@ $nations = Json::decode($history['nations']);
<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("js/map/theme_{$mapTheme}.js")?>
<?=WebUtil::printJS('dist_js/map.js')?>
<?=WebUtil::printJS('js/history.js')?>
<?=WebUtil::printJS('dist_js/history.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
-31
View File
@@ -1,31 +0,0 @@
jQuery(function($){
var currYear = startYear;
var currMonth = startMonth;
var $yearMonth = $('#yearmonth');
var $elements = $();
var endDate = lastYear * 12 + lastMonth - 1;
var currDate = startYear * 12 + startMonth - 1;
while(currDate <= endDate){
var target = currYear*100 + currMonth;
var sel = '';
if(currYear == selectYear && currMonth == selectMonth){
sel = 'selected="selected"';
}
var option = $('<option value="{0}" {1} >{2}년 {3}월</option>'.format(target, sel, currYear, currMonth));
$elements = $elements.add(option);
currMonth += 1;
if(currMonth > 12){
currYear += 1;
currMonth -= 12;
}
currDate += 1;
}
$yearMonth.empty();
$yearMonth.append($elements);
});
+41
View File
@@ -0,0 +1,41 @@
import $ from 'jquery';
import './map';
declare const startYear:number;
declare const startMonth:number;
declare const lastYear: number;
declare const lastMonth: number;
declare const selectYear: number;
declare const selectMonth: number;
$(function ($) {
let currYear = startYear;
let currMonth = startMonth;
const $yearMonth = $('#yearmonth');
let $elements = $();
const endDate = lastYear * 12 + lastMonth - 1;
let currDate = startYear * 12 + startMonth - 1;
while (currDate <= endDate) {
const target = currYear * 100 + currMonth;
let sel = '';
if (currYear == selectYear && currMonth == selectMonth) {
sel = 'selected="selected"';
}
const option = $(`<option value="${target}" ${sel} >${currYear}${currMonth}월</option>`);
$elements = $elements.add(option);
currMonth += 1;
if (currMonth > 12) {
currYear += 1;
currMonth -= 12;
}
currDate += 1;
}
$yearMonth.empty();
$yearMonth.append($elements);
});
+1
View File
@@ -38,6 +38,7 @@ module.exports = (env, argv) => {
diplomacy: '@/diplomacy.ts',
currentCity: '@/currentCity.ts',
hallOfFame: '@/hallOfFame.ts',
history: '@/history.ts',
},
output: {
filename: '[name].js',