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('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')?>
|
||||
|
||||
@@ -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')?>
|
||||
<script>
|
||||
@@ -87,12 +86,8 @@ window.serverID = '<?=UniqueConst::$serverID?>';
|
||||
window.command = '<?=$commandType?>';
|
||||
window.turnList = [<?=join(', ',$turnList)?>];
|
||||
window.isChiefTurn = <?=$isChiefTurn?'true':'false'?>;
|
||||
var jsPlugins = <?=Json::encode($jsList)?>;
|
||||
</script>
|
||||
<?php
|
||||
foreach($jsList as $js){
|
||||
print(WebUtil::printJS($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')?>
|
||||
|
||||
<?php
|
||||
foreach($cssList as $css){
|
||||
print(WebUtil::printCSS($css));
|
||||
|
||||
@@ -32,7 +32,7 @@ abstract class BaseCommand{
|
||||
protected $env = null;
|
||||
|
||||
/** @var \sammo\General */
|
||||
protected $destGeneralObj = null;
|
||||
protected $destGeneralObj = null;
|
||||
protected ?array $destCity = null;
|
||||
protected ?array $destNation = null;
|
||||
|
||||
@@ -70,7 +70,7 @@ abstract class BaseCommand{
|
||||
$this->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 {
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ class che_건국 extends Command\GeneralCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getJSFiles(): array
|
||||
public function getJSPlugins(): array
|
||||
{
|
||||
return [
|
||||
'dist_js/colorSelect.js'
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ class che_징병 extends Command\GeneralCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getJSFiles(): array
|
||||
public function getJSPlugins(): array
|
||||
{
|
||||
return [
|
||||
'dist_js/recruitCrewForm.js'
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ class che_국기변경 extends Command\NationCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getJSFiles(): array
|
||||
public function getJSPlugins(): array
|
||||
{
|
||||
return [
|
||||
'dist_js/colorSelect.js'
|
||||
|
||||
@@ -157,7 +157,7 @@ class che_국호변경 extends Command\NationCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getJSFiles(): array
|
||||
public function getJSPlugins(): array
|
||||
{
|
||||
return [
|
||||
'dist_js/colorSelect.js'
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -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: "",
|
||||
|
||||
@@ -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<string>($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();
|
||||
});
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
+23
-3
@@ -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<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