diff --git a/hwe/a_history.php b/hwe/a_history.php index 8d565eb3..199713d0 100644 --- a/hwe/a_history.php +++ b/hwe/a_history.php @@ -101,10 +101,8 @@ $nations = Json::decode($history['nations']); <?=UniqueConst::$serverName?>: 연감 - - - + diff --git a/hwe/js/history.js b/hwe/js/history.js deleted file mode 100644 index 6f1b6799..00000000 --- a/hwe/js/history.js +++ /dev/null @@ -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 = $(''.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); -}); \ No newline at end of file diff --git a/hwe/ts/history.ts b/hwe/ts/history.ts new file mode 100644 index 00000000..76924377 --- /dev/null +++ b/hwe/ts/history.ts @@ -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 = $(``); + $elements = $elements.add(option); + + currMonth += 1; + if (currMonth > 12) { + currYear += 1; + currMonth -= 12; + } + currDate += 1; + } + $yearMonth.empty(); + $yearMonth.append($elements); +}); \ No newline at end of file diff --git a/webpack.config.cjs b/webpack.config.cjs index 9ef2bc0d..cd99a31d 100644 --- a/webpack.config.cjs +++ b/webpack.config.cjs @@ -38,6 +38,7 @@ module.exports = (env, argv) => { diplomacy: '@/diplomacy.ts', currentCity: '@/currentCity.ts', hallOfFame: '@/hallOfFame.ts', + history: '@/history.ts', }, output: { filename: '[name].js',