core: getJSFiles -> getJSPlugins
- 각각 js를 불러오기보다.. 초기화 함수를 직접 호출 - lazy loading은 어차피 나중에 새로 만들거니까 안 함.
This commit is contained in:
@@ -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('../d_shared/common_path.js')?>
|
||||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||||
<?=WebUtil::printJS('../e_lib/select2/select2.full.min.js')?>
|
|
||||||
<?=WebUtil::printJS('dist_js/bossInfo.js')?>
|
<?=WebUtil::printJS('dist_js/bossInfo.js')?>
|
||||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||||
<?=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
|
<?=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ if(!$commandObj->hasPermissionToReserve()){
|
|||||||
die_redirect();
|
die_redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
$jsList = $commandObj->getJSFiles();
|
$jsList = $commandObj->getJSPlugins();
|
||||||
$cssList = $commandObj->getCSSFiles();
|
$cssList = $commandObj->getCSSFiles();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -78,7 +78,6 @@ $cssList = $commandObj->getCSSFiles();
|
|||||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||||
<?=WebUtil::printJS('dist_js/common.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('d_shared/base_map.js')?>
|
||||||
<?=WebUtil::printJS('dist_js/processing.js')?>
|
<?=WebUtil::printJS('dist_js/processing.js')?>
|
||||||
<script>
|
<script>
|
||||||
@@ -87,12 +86,8 @@ window.serverID = '<?=UniqueConst::$serverID?>';
|
|||||||
window.command = '<?=$commandType?>';
|
window.command = '<?=$commandType?>';
|
||||||
window.turnList = [<?=join(', ',$turnList)?>];
|
window.turnList = [<?=join(', ',$turnList)?>];
|
||||||
window.isChiefTurn = <?=$isChiefTurn?'true':'false'?>;
|
window.isChiefTurn = <?=$isChiefTurn?'true':'false'?>;
|
||||||
|
var jsPlugins = <?=Json::encode($jsList)?>;
|
||||||
</script>
|
</script>
|
||||||
<?php
|
|
||||||
foreach($jsList as $js){
|
|
||||||
print(WebUtil::printJS($js));
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||||
<?=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
|
<?=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
|
||||||
<?=WebUtil::printCSS('../e_lib/select2/select2-bootstrap4.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/main.css')?>
|
||||||
<?=WebUtil::printCSS('css/map.css')?>
|
<?=WebUtil::printCSS('css/map.css')?>
|
||||||
<?=WebUtil::printCSS('css/processing.css')?>
|
<?=WebUtil::printCSS('css/processing.css')?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
foreach($cssList as $css){
|
foreach($cssList as $css){
|
||||||
print(WebUtil::printCSS($css));
|
print(WebUtil::printCSS($css));
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ abstract class BaseCommand{
|
|||||||
|
|
||||||
abstract public function run():bool;
|
abstract public function run():bool;
|
||||||
|
|
||||||
public function getJSFiles():array {
|
public function getJSPlugins():array {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
public function getCSSFiles():array {
|
public function getCSSFiles():array {
|
||||||
|
|||||||
@@ -166,10 +166,10 @@ class che_강행 extends Command\GeneralCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectCityByMap.js'
|
'defaultSelectCityByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ class che_건국 extends Command\GeneralCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/colorSelect.js'
|
'dist_js/colorSelect.js'
|
||||||
|
|||||||
@@ -174,10 +174,10 @@ class che_이동 extends Command\GeneralCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectCityByMap.js'
|
'defaultSelectCityByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ class che_징병 extends Command\GeneralCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/recruitCrewForm.js'
|
'dist_js/recruitCrewForm.js'
|
||||||
|
|||||||
@@ -222,10 +222,10 @@ class che_첩보 extends Command\GeneralCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectCityByMap.js'
|
'defaultSelectCityByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -236,10 +236,10 @@ class che_출병 extends Command\GeneralCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectCityByMap.js'
|
'defaultSelectCityByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -332,10 +332,10 @@ class che_화계 extends Command\GeneralCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectCityByMap.js'
|
'defaultSelectCityByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ class che_국기변경 extends Command\NationCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/colorSelect.js'
|
'dist_js/colorSelect.js'
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ class che_국호변경 extends Command\NationCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/colorSelect.js'
|
'dist_js/colorSelect.js'
|
||||||
|
|||||||
@@ -196,10 +196,10 @@ class che_급습 extends Command\NationCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectNationByMap.js'
|
'defaultSelectNationByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -246,10 +246,10 @@ class che_물자원조 extends Command\NationCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectNationByMap.js'
|
'defaultSelectNationByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -157,10 +157,10 @@ class che_발령 extends Command\NationCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectCityByMap.js'
|
'defaultSelectCityByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -159,10 +159,10 @@ class che_백성동원 extends Command\NationCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectCityByMap.js'
|
'defaultSelectCityByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -223,10 +223,10 @@ class che_불가침제의 extends Command\NationCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectNationByMap.js'
|
'defaultSelectNationByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -170,10 +170,10 @@ class che_불가침파기제의 extends Command\NationCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectNationByMap.js'
|
'defaultSelectNationByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -192,10 +192,10 @@ class che_선전포고 extends Command\NationCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectNationByMap.js'
|
'defaultSelectNationByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -182,10 +182,10 @@ class che_수몰 extends Command\NationCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectCityByMap.js'
|
'defaultSelectCityByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -199,10 +199,10 @@ class che_이호경식 extends Command\NationCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectNationByMap.js'
|
'defaultSelectNationByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -168,10 +168,10 @@ class che_종전제의 extends Command\NationCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectNationByMap.js'
|
'defaultSelectNationByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -229,10 +229,10 @@ class che_천도 extends Command\NationCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectCityByMap.js'
|
'defaultSelectCityByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -195,10 +195,10 @@ class che_초토화 extends Command\NationCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectCityByMap.js'
|
'defaultSelectCityByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -218,10 +218,10 @@ class che_피장파장 extends Command\NationCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectNationByMap.js'
|
'defaultSelectNationByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -205,10 +205,10 @@ class che_허보 extends Command\NationCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'dist_js/defaultSelectCityByMap.js'
|
'defaultSelectCityByMap'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ import { convertFormData } from './util/convertFormData';
|
|||||||
import { InvalidResponse } from './defs';
|
import { InvalidResponse } from './defs';
|
||||||
import { unwrap_any } from './util/unwrap_any';
|
import { unwrap_any } from './util/unwrap_any';
|
||||||
import { setAxiosXMLHttpRequest } from './util/setAxiosXMLHttpRequest';
|
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 = {
|
type GeneralSelectorItem = {
|
||||||
id: string|number,
|
id: string|number,
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
import { reloadWorldMap } from "./map";
|
import { reloadWorldMap } from "./map";
|
||||||
import { unwrap_any } from "./util/unwrap_any";
|
import { unwrap_any } from "./util/unwrap_any";
|
||||||
/*import $ from 'jquery';
|
|
||||||
import 'select2';*///TODO: processing
|
|
||||||
|
|
||||||
|
export function defaultSelectCityByMap(): void {
|
||||||
export function loadPlugin(): void {
|
|
||||||
const $target = $("#destCityID");
|
const $target = $("#destCityID");
|
||||||
console.log('target', $target);
|
console.log('city', $target);
|
||||||
void reloadWorldMap({
|
void reloadWorldMap({
|
||||||
isDetailMap: false,
|
isDetailMap: false,
|
||||||
clickableAll: true,
|
clickableAll: true,
|
||||||
@@ -14,15 +11,12 @@ export function loadPlugin(): void {
|
|||||||
useCachedMap: true,
|
useCachedMap: true,
|
||||||
selectCallback: function (city) {
|
selectCallback: function (city) {
|
||||||
const currVal = unwrap_any<string>($target.val());
|
const currVal = unwrap_any<string>($target.val());
|
||||||
$target.val(city.id).trigger("change");
|
$target.val(city.id);
|
||||||
|
$target.trigger("change");
|
||||||
if ($target.val() === null) {
|
if ($target.val() === null) {
|
||||||
$target.val(currVal).trigger("change");
|
$target.val(currVal).trigger("change").blur();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function () {
|
|
||||||
loadPlugin();
|
|
||||||
});
|
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
import { reloadWorldMap } from "./map";
|
import { reloadWorldMap } from "./map";
|
||||||
import { unwrap_any } from "./util/unwrap_any";
|
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");
|
const $target = $("#destNationID");
|
||||||
|
console.log('nation', $target);
|
||||||
void reloadWorldMap({
|
void reloadWorldMap({
|
||||||
isDetailMap: false,
|
isDetailMap: false,
|
||||||
clickableAll: true,
|
clickableAll: true,
|
||||||
@@ -23,7 +22,3 @@ export function loadPlugin(): void{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function() {
|
|
||||||
loadPlugin();
|
|
||||||
});
|
|
||||||
+23
-3
@@ -1,15 +1,23 @@
|
|||||||
//import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
//import 'bootstrap';
|
exportWindow($, '$');
|
||||||
|
import { exportWindow } from './util/exportWindow';
|
||||||
import axios from 'axios';
|
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 { setAxiosXMLHttpRequest } from './util/setAxiosXMLHttpRequest';
|
||||||
import { convertFormData } from './util/convertFormData';
|
import { convertFormData } from './util/convertFormData';
|
||||||
import { InvalidResponse } from './defs';
|
import { InvalidResponse } from './defs';
|
||||||
import { unwrap_any } from './util/unwrap_any';
|
import { unwrap_any } from './util/unwrap_any';
|
||||||
import { DataFormat, IdTextPair, OptionData } from 'select2';
|
import { DataFormat, IdTextPair, OptionData } from 'select2';
|
||||||
import { unwrap } from "./util/unwrap";
|
import { unwrap } from "./util/unwrap";
|
||||||
|
import { defaultSelectCityByMap } from './defaultSelectCityByMap';
|
||||||
|
import { defaultSelectNationByMap } from './defaultSelectNationByMap';
|
||||||
|
|
||||||
declare const isChiefTurn: boolean;
|
declare const isChiefTurn: boolean;
|
||||||
|
declare const jsPlugins: string[];
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
submitAction: () => Promise<void>;
|
submitAction: () => Promise<void>;
|
||||||
@@ -275,4 +283,16 @@ $(function ($) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const pluginMap:Record<string, ()=>void> = {
|
||||||
|
'defaultSelectCityByMap': defaultSelectCityByMap,
|
||||||
|
'defaultSelectNationByMap': defaultSelectNationByMap,
|
||||||
|
};
|
||||||
|
for (const jsPlugin of jsPlugins) {
|
||||||
|
if (jsPlugin in pluginMap) {
|
||||||
|
pluginMap[jsPlugin]()
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
console.error(`'${jsPlugin}' is not supported`);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user