diff --git a/hwe/b_myBossInfo.php b/hwe/b_myBossInfo.php
index ff270eb2..1b30e8cc 100644
--- a/hwe/b_myBossInfo.php
+++ b/hwe/b_myBossInfo.php
@@ -36,7 +36,6 @@ $nation = $db->queryFirstRow('SELECT nation,name,level,color,chief_set from nati
=WebUtil::printJS('../d_shared/common_path.js')?>
=WebUtil::printJS('dist_js/vendors.js')?>
=WebUtil::printJS('dist_js/common.js')?>
-=WebUtil::printJS('../e_lib/select2/select2.full.min.js')?>
=WebUtil::printJS('dist_js/bossInfo.js')?>
=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
diff --git a/hwe/b_processing.php b/hwe/b_processing.php
index 7c9e79cd..9a405f4d 100644
--- a/hwe/b_processing.php
+++ b/hwe/b_processing.php
@@ -64,7 +64,7 @@ if(!$commandObj->hasPermissionToReserve()){
die_redirect();
}
-$jsList = $commandObj->getJSFiles();
+$jsList = $commandObj->getJSPlugins();
$cssList = $commandObj->getCSSFiles();
?>
@@ -78,7 +78,6 @@ $cssList = $commandObj->getCSSFiles();
=WebUtil::printJS('../d_shared/common_path.js')?>
=WebUtil::printJS('dist_js/vendors.js')?>
=WebUtil::printJS('dist_js/common.js')?>
-=WebUtil::printJS('../e_lib/select2/select2.full.min.js')?>
=WebUtil::printJS('d_shared/base_map.js')?>
=WebUtil::printJS('dist_js/processing.js')?>
-
=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
=WebUtil::printCSS('../e_lib/select2/select2-bootstrap4.css')?>
@@ -101,6 +96,7 @@ foreach($jsList as $js){
=WebUtil::printCSS('css/main.css')?>
=WebUtil::printCSS('css/map.css')?>
=WebUtil::printCSS('css/processing.css')?>
+
env = $env;
$this->arg = $arg;
-
+
$this->init();
if ($this->argTest()) {
$this->isArgValid = true;
@@ -92,7 +92,7 @@ abstract class BaseCommand{
$this->reasonNotMinConditionMet = null;
$this->reasonNoPermissionToReserve = null;
}
-
+
protected function setCity(){
$this->resetTestCache();
$db = DB::db();
@@ -126,7 +126,7 @@ abstract class BaseCommand{
$this->nation = $this->generalObj->getStaticNation();
return;
}
-
+
$defaultValues = [
'nation'=>0,
'name'=>'재야',
@@ -137,7 +137,7 @@ abstract class BaseCommand{
'gold'=>0,
'rice'=>2000,
'tech'=>0,
- 'gennum'=>1
+ 'gennum'=>1
];
if($this->nation && $this->nation['nation'] === $nationID){
@@ -211,7 +211,7 @@ abstract class BaseCommand{
'gold'=>0,
'rice'=>2000,
'tech'=>0,
- 'gennum'=>1
+ 'gennum'=>1
];
$db = DB::db();
@@ -229,7 +229,7 @@ abstract class BaseCommand{
}
}
abstract protected function argTest():bool;
-
+
public function getArg():?array{
return $this->arg;
}
@@ -239,7 +239,7 @@ abstract class BaseCommand{
}
public function getNationID(){
- return $this->generalObj->getNationID();
+ return $this->generalObj->getNationID();
}
public function getOfficerLevel(){
@@ -264,7 +264,7 @@ abstract class BaseCommand{
//null : can't calculate
return 0;
}
-
+
static public function getName():string {
return static::$actionName;
}
@@ -363,7 +363,7 @@ abstract class BaseCommand{
$this->cachedMinConditionMet = true;
return $this->reasonNotMinConditionMet;
-
+
}
public function testFullConditionMet():?string{
@@ -401,7 +401,7 @@ abstract class BaseCommand{
$this->cachedFullConditionMet = true;
return $this->reasonNotFullConditionMet;
-
+
}
public function getTermString():string{
@@ -475,7 +475,7 @@ abstract class BaseCommand{
abstract public function run():bool;
- public function getJSFiles():array {
+ public function getJSPlugins():array {
return [];
}
public function getCSSFiles():array {
diff --git a/hwe/sammo/Command/General/che_강행.php b/hwe/sammo/Command/General/che_강행.php
index 78ae55cd..426b7a75 100644
--- a/hwe/sammo/Command/General/che_강행.php
+++ b/hwe/sammo/Command/General/che_강행.php
@@ -166,10 +166,10 @@ class che_강행 extends Command\GeneralCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectCityByMap.js'
+ 'defaultSelectCityByMap'
];
}
diff --git a/hwe/sammo/Command/General/che_건국.php b/hwe/sammo/Command/General/che_건국.php
index f482b27e..7e1f18bc 100644
--- a/hwe/sammo/Command/General/che_건국.php
+++ b/hwe/sammo/Command/General/che_건국.php
@@ -196,7 +196,7 @@ class che_건국 extends Command\GeneralCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
'dist_js/colorSelect.js'
diff --git a/hwe/sammo/Command/General/che_이동.php b/hwe/sammo/Command/General/che_이동.php
index f8f76c91..34fed929 100644
--- a/hwe/sammo/Command/General/che_이동.php
+++ b/hwe/sammo/Command/General/che_이동.php
@@ -174,10 +174,10 @@ class che_이동 extends Command\GeneralCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectCityByMap.js'
+ 'defaultSelectCityByMap'
];
}
diff --git a/hwe/sammo/Command/General/che_징병.php b/hwe/sammo/Command/General/che_징병.php
index 152dafe1..517d1a38 100644
--- a/hwe/sammo/Command/General/che_징병.php
+++ b/hwe/sammo/Command/General/che_징병.php
@@ -231,7 +231,7 @@ class che_징병 extends Command\GeneralCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
'dist_js/recruitCrewForm.js'
diff --git a/hwe/sammo/Command/General/che_첩보.php b/hwe/sammo/Command/General/che_첩보.php
index 6a78889b..868c322d 100644
--- a/hwe/sammo/Command/General/che_첩보.php
+++ b/hwe/sammo/Command/General/che_첩보.php
@@ -222,10 +222,10 @@ class che_첩보 extends Command\GeneralCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectCityByMap.js'
+ 'defaultSelectCityByMap'
];
}
diff --git a/hwe/sammo/Command/General/che_출병.php b/hwe/sammo/Command/General/che_출병.php
index 5e19b67f..6c41c928 100644
--- a/hwe/sammo/Command/General/che_출병.php
+++ b/hwe/sammo/Command/General/che_출병.php
@@ -236,10 +236,10 @@ class che_출병 extends Command\GeneralCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectCityByMap.js'
+ 'defaultSelectCityByMap'
];
}
diff --git a/hwe/sammo/Command/General/che_화계.php b/hwe/sammo/Command/General/che_화계.php
index de136441..5fd0527b 100644
--- a/hwe/sammo/Command/General/che_화계.php
+++ b/hwe/sammo/Command/General/che_화계.php
@@ -332,10 +332,10 @@ class che_화계 extends Command\GeneralCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectCityByMap.js'
+ 'defaultSelectCityByMap'
];
}
diff --git a/hwe/sammo/Command/Nation/che_국기변경.php b/hwe/sammo/Command/Nation/che_국기변경.php
index f9ae1445..b025e731 100644
--- a/hwe/sammo/Command/Nation/che_국기변경.php
+++ b/hwe/sammo/Command/Nation/che_국기변경.php
@@ -151,7 +151,7 @@ class che_국기변경 extends Command\NationCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
'dist_js/colorSelect.js'
diff --git a/hwe/sammo/Command/Nation/che_국호변경.php b/hwe/sammo/Command/Nation/che_국호변경.php
index 52e8dfd0..2d0d58c8 100644
--- a/hwe/sammo/Command/Nation/che_국호변경.php
+++ b/hwe/sammo/Command/Nation/che_국호변경.php
@@ -157,7 +157,7 @@ class che_국호변경 extends Command\NationCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
'dist_js/colorSelect.js'
diff --git a/hwe/sammo/Command/Nation/che_급습.php b/hwe/sammo/Command/Nation/che_급습.php
index 50eb48e6..25117d85 100644
--- a/hwe/sammo/Command/Nation/che_급습.php
+++ b/hwe/sammo/Command/Nation/che_급습.php
@@ -196,10 +196,10 @@ class che_급습 extends Command\NationCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectNationByMap.js'
+ 'defaultSelectNationByMap'
];
}
diff --git a/hwe/sammo/Command/Nation/che_물자원조.php b/hwe/sammo/Command/Nation/che_물자원조.php
index 6652bcd9..0613d541 100644
--- a/hwe/sammo/Command/Nation/che_물자원조.php
+++ b/hwe/sammo/Command/Nation/che_물자원조.php
@@ -246,10 +246,10 @@ class che_물자원조 extends Command\NationCommand{
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectNationByMap.js'
+ 'defaultSelectNationByMap'
];
}
diff --git a/hwe/sammo/Command/Nation/che_발령.php b/hwe/sammo/Command/Nation/che_발령.php
index 9f6ca61f..ac28bbc5 100644
--- a/hwe/sammo/Command/Nation/che_발령.php
+++ b/hwe/sammo/Command/Nation/che_발령.php
@@ -157,10 +157,10 @@ class che_발령 extends Command\NationCommand{
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectCityByMap.js'
+ 'defaultSelectCityByMap'
];
}
diff --git a/hwe/sammo/Command/Nation/che_백성동원.php b/hwe/sammo/Command/Nation/che_백성동원.php
index 099e02d1..92607988 100644
--- a/hwe/sammo/Command/Nation/che_백성동원.php
+++ b/hwe/sammo/Command/Nation/che_백성동원.php
@@ -159,10 +159,10 @@ class che_백성동원 extends Command\NationCommand{
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectCityByMap.js'
+ 'defaultSelectCityByMap'
];
}
diff --git a/hwe/sammo/Command/Nation/che_불가침제의.php b/hwe/sammo/Command/Nation/che_불가침제의.php
index 57074894..d8e7df44 100644
--- a/hwe/sammo/Command/Nation/che_불가침제의.php
+++ b/hwe/sammo/Command/Nation/che_불가침제의.php
@@ -223,10 +223,10 @@ class che_불가침제의 extends Command\NationCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectNationByMap.js'
+ 'defaultSelectNationByMap'
];
}
diff --git a/hwe/sammo/Command/Nation/che_불가침파기제의.php b/hwe/sammo/Command/Nation/che_불가침파기제의.php
index 8c136a72..ba54b61c 100644
--- a/hwe/sammo/Command/Nation/che_불가침파기제의.php
+++ b/hwe/sammo/Command/Nation/che_불가침파기제의.php
@@ -170,10 +170,10 @@ class che_불가침파기제의 extends Command\NationCommand{
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectNationByMap.js'
+ 'defaultSelectNationByMap'
];
}
diff --git a/hwe/sammo/Command/Nation/che_선전포고.php b/hwe/sammo/Command/Nation/che_선전포고.php
index 4fc16e30..38a55d1f 100644
--- a/hwe/sammo/Command/Nation/che_선전포고.php
+++ b/hwe/sammo/Command/Nation/che_선전포고.php
@@ -192,10 +192,10 @@ class che_선전포고 extends Command\NationCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectNationByMap.js'
+ 'defaultSelectNationByMap'
];
}
diff --git a/hwe/sammo/Command/Nation/che_수몰.php b/hwe/sammo/Command/Nation/che_수몰.php
index e1e26a08..62643b64 100644
--- a/hwe/sammo/Command/Nation/che_수몰.php
+++ b/hwe/sammo/Command/Nation/che_수몰.php
@@ -182,10 +182,10 @@ class che_수몰 extends Command\NationCommand{
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectCityByMap.js'
+ 'defaultSelectCityByMap'
];
}
diff --git a/hwe/sammo/Command/Nation/che_이호경식.php b/hwe/sammo/Command/Nation/che_이호경식.php
index 14e53b4e..563e6fad 100644
--- a/hwe/sammo/Command/Nation/che_이호경식.php
+++ b/hwe/sammo/Command/Nation/che_이호경식.php
@@ -199,10 +199,10 @@ class che_이호경식 extends Command\NationCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectNationByMap.js'
+ 'defaultSelectNationByMap'
];
}
diff --git a/hwe/sammo/Command/Nation/che_종전제의.php b/hwe/sammo/Command/Nation/che_종전제의.php
index 6e05cab4..6e26fc6a 100644
--- a/hwe/sammo/Command/Nation/che_종전제의.php
+++ b/hwe/sammo/Command/Nation/che_종전제의.php
@@ -168,10 +168,10 @@ class che_종전제의 extends Command\NationCommand{
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectNationByMap.js'
+ 'defaultSelectNationByMap'
];
}
diff --git a/hwe/sammo/Command/Nation/che_천도.php b/hwe/sammo/Command/Nation/che_천도.php
index 1112c16b..a2030fb7 100644
--- a/hwe/sammo/Command/Nation/che_천도.php
+++ b/hwe/sammo/Command/Nation/che_천도.php
@@ -229,10 +229,10 @@ class che_천도 extends Command\NationCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectCityByMap.js'
+ 'defaultSelectCityByMap'
];
}
diff --git a/hwe/sammo/Command/Nation/che_초토화.php b/hwe/sammo/Command/Nation/che_초토화.php
index 5060180a..363a8b22 100644
--- a/hwe/sammo/Command/Nation/che_초토화.php
+++ b/hwe/sammo/Command/Nation/che_초토화.php
@@ -195,10 +195,10 @@ class che_초토화 extends Command\NationCommand{
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectCityByMap.js'
+ 'defaultSelectCityByMap'
];
}
diff --git a/hwe/sammo/Command/Nation/che_피장파장.php b/hwe/sammo/Command/Nation/che_피장파장.php
index 9d4b8590..c9737bc7 100644
--- a/hwe/sammo/Command/Nation/che_피장파장.php
+++ b/hwe/sammo/Command/Nation/che_피장파장.php
@@ -218,10 +218,10 @@ class che_피장파장 extends Command\NationCommand{
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectNationByMap.js'
+ 'defaultSelectNationByMap'
];
}
diff --git a/hwe/sammo/Command/Nation/che_허보.php b/hwe/sammo/Command/Nation/che_허보.php
index e2a1f627..a2f32b9f 100644
--- a/hwe/sammo/Command/Nation/che_허보.php
+++ b/hwe/sammo/Command/Nation/che_허보.php
@@ -205,10 +205,10 @@ class che_허보 extends Command\NationCommand
return true;
}
- public function getJSFiles(): array
+ public function getJSPlugins(): array
{
return [
- 'dist_js/defaultSelectCityByMap.js'
+ 'defaultSelectCityByMap'
];
}
diff --git a/hwe/ts/bossInfo.ts b/hwe/ts/bossInfo.ts
index ebb9d0a9..034b25f2 100644
--- a/hwe/ts/bossInfo.ts
+++ b/hwe/ts/bossInfo.ts
@@ -4,6 +4,11 @@ import { convertFormData } from './util/convertFormData';
import { InvalidResponse } from './defs';
import { unwrap_any } from './util/unwrap_any';
import { setAxiosXMLHttpRequest } from './util/setAxiosXMLHttpRequest';
+import { exportWindow } from './util/exportWindow';
+import Popper from 'popper.js';
+exportWindow(Popper, 'Popper');
+import 'bootstrap';
+import 'select2/dist/js/select2.full.js'
type GeneralSelectorItem = {
id: string|number,
@@ -54,7 +59,7 @@ async function changePermission(isAmbassador: boolean, rawGeneralList: GeneralSe
$(function () {
setAxiosXMLHttpRequest();
-
+
$('#selectAmbassador').select2({
theme: 'bootstrap4',
placeholder: "",
diff --git a/hwe/ts/defaultSelectCityByMap.ts b/hwe/ts/defaultSelectCityByMap.ts
index 13782803..2fd463ac 100644
--- a/hwe/ts/defaultSelectCityByMap.ts
+++ b/hwe/ts/defaultSelectCityByMap.ts
@@ -1,12 +1,9 @@
import { reloadWorldMap } from "./map";
import { unwrap_any } from "./util/unwrap_any";
-/*import $ from 'jquery';
-import 'select2';*///TODO: processing
-
-export function loadPlugin(): void {
+export function defaultSelectCityByMap(): void {
const $target = $("#destCityID");
- console.log('target', $target);
+ console.log('city', $target);
void reloadWorldMap({
isDetailMap: false,
clickableAll: true,
@@ -14,15 +11,12 @@ export function loadPlugin(): void {
useCachedMap: true,
selectCallback: function (city) {
const currVal = unwrap_any($target.val());
- $target.val(city.id).trigger("change");
+ $target.val(city.id);
+ $target.trigger("change");
if ($target.val() === null) {
- $target.val(currVal).trigger("change");
+ $target.val(currVal).trigger("change").blur();
}
return false;
}
});
}
-
-$(function () {
- loadPlugin();
-});
\ No newline at end of file
diff --git a/hwe/ts/defaultSelectNationByMap.ts b/hwe/ts/defaultSelectNationByMap.ts
index 3397c01c..28d2b0ee 100644
--- a/hwe/ts/defaultSelectNationByMap.ts
+++ b/hwe/ts/defaultSelectNationByMap.ts
@@ -1,10 +1,9 @@
import { reloadWorldMap } from "./map";
import { unwrap_any } from "./util/unwrap_any";
-/*import $ from 'jquery';
-import 'select2';*///TODO: processing
-export function loadPlugin(): void{
+export function defaultSelectNationByMap(): void{
const $target = $("#destNationID");
+ console.log('nation', $target);
void reloadWorldMap({
isDetailMap: false,
clickableAll: true,
@@ -22,8 +21,4 @@ export function loadPlugin(): void{
return false;
}
});
-}
-
-$(function() {
- loadPlugin();
-});
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/hwe/ts/processing.ts b/hwe/ts/processing.ts
index a0425b69..c096cffd 100644
--- a/hwe/ts/processing.ts
+++ b/hwe/ts/processing.ts
@@ -1,15 +1,23 @@
-//import $ from 'jquery';
-//import 'bootstrap';
+import $ from 'jquery';
+exportWindow($, '$');
+import { exportWindow } from './util/exportWindow';
import axios from 'axios';
-//import 'select2';
+import Popper from 'popper.js';
+exportWindow(Popper, 'Popper');
+import 'bootstrap';
+import 'select2/dist/js/select2.full.js'
import { setAxiosXMLHttpRequest } from './util/setAxiosXMLHttpRequest';
import { convertFormData } from './util/convertFormData';
import { InvalidResponse } from './defs';
import { unwrap_any } from './util/unwrap_any';
import { DataFormat, IdTextPair, OptionData } from 'select2';
import { unwrap } from "./util/unwrap";
+import { defaultSelectCityByMap } from './defaultSelectCityByMap';
+import { defaultSelectNationByMap } from './defaultSelectNationByMap';
declare const isChiefTurn: boolean;
+declare const jsPlugins: string[];
+
declare global {
interface Window {
submitAction: () => Promise;
@@ -275,4 +283,16 @@ $(function ($) {
}
});
+ const pluginMap:Recordvoid> = {
+ 'defaultSelectCityByMap': defaultSelectCityByMap,
+ 'defaultSelectNationByMap': defaultSelectNationByMap,
+ };
+ for (const jsPlugin of jsPlugins) {
+ if (jsPlugin in pluginMap) {
+ pluginMap[jsPlugin]()
+ }
+ else{
+ console.error(`'${jsPlugin}' is not supported`);
+ }
+ }
});
\ No newline at end of file