gateway: 입구의 지도를 iframe으로 변경

This commit is contained in:
2021-08-20 04:58:05 +09:00
parent e2b09caff3
commit 56ca588c1e
6 changed files with 104 additions and 42 deletions
+4 -2
View File
@@ -127,6 +127,8 @@ input::-webkit-input-placeholder {
border-radius: .2rem;
}
#running_map {
margin-top: 20px;
#running_map{
overflow: hidden;
border: none;
width:700px;
}
+57
View File
@@ -0,0 +1,57 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>최근 지도</title>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<script>
var serverNick = '<?= $runningServer['korName'] ?>';
</script>
<?= WebUtil::printJS('js/vendors.js') ?>
<?= WebUtil::printJS('d_shared/base_map.js') ?>
<?= WebUtil::printJS('js/recent_map.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printCSS('../e_lib/bootstrap.min.css') ?>
<?= WebUtil::printCSS('css/common.css') ?>
<?= WebUtil::printCSS('css/map.css') ?>
<style>
html {
width: 700px;
}
body {
margin: 0;
padding: 0;
overflow: hidden;
width: 700px;
}
</style>
</head>
<body>
<div class="card" style="width:700px;">
<h3 class="card-header">
<?= UniqueConst::$serverName ?> 현황
</h3>
<div class='map-container' style='position:relative;'>
<?= getMapHtml($mapTheme) ?>
</div>
<div class="card-body">
</div>
</div>
</body>
</html>
+9 -9
View File
@@ -1,5 +1,5 @@
import axios from 'axios';
import jQuery from 'jquery';
import $ from 'jquery';
import { extend, isNumber } from 'lodash';
import { convColorValue, convertDictById, convertSet } from './common_legacy';
import { InvalidResponse } from './defs';
@@ -110,7 +110,7 @@ function is_touch_device(): boolean {
type loadMapOption = {
isDetailMap?: boolean, //복잡 지도, 단순 지도
clickableAll?: boolean, //어떤 경우든 클릭을 가능하게 함. 해당 동작의 동작 가능성 여부와는 별도.
selectCallback?: (city: MapCityParsed) => void, //callback을 지정시 clickable과 관계 없이 해당 함수를 실행.
selectCallback?: (city: MapCityParsed) => void, //callback을 지정시 clickable과 관계 없이 해당 함수를 실행.
hrefTemplate?: string, //도시가 클릭가능할 경우 지정할 href값. {0}은 도시 id로 변환됨
useCachedMap?: boolean, //맵 캐시를 사용
@@ -124,14 +124,14 @@ type loadMapOption = {
targetJson?: string,
reqType?: 'get' | 'post',
dynamicMapTheme?: boolean,
callback?: (a: unknown, rawObejct: unknown) => void,
callback?: (a: MapCityDrawable, rawObejct: MapRawResult) => void,
//기타 보조 값
startYear?: number,
}
export async function reloadWorldMap(option: loadMapOption, drawTarget = '.world_map'): Promise<void> {
const $world_map = jQuery(drawTarget);
const $world_map = $(drawTarget);
if ($world_map.length == 0) {
return;
@@ -140,7 +140,7 @@ export async function reloadWorldMap(option: loadMapOption, drawTarget = '.world
const defaultOption: loadMapOption = {
isDetailMap: true, //복잡 지도, 단순 지도
clickableAll: false, //어떤 경우든 클릭을 가능하게 함. 해당 동작의 동작 가능성 여부와는 별도.
selectCallback: undefined, //callback을 지정시 clickable과 관계 없이 해당 함수를 실행.
selectCallback: undefined, //callback을 지정시 clickable과 관계 없이 해당 함수를 실행.
hrefTemplate: '#', //도시가 클릭가능할 경우 지정할 href값. {0}은 도시 id로 변환됨
useCachedMap: false, //맵 캐시를 사용
@@ -439,7 +439,7 @@ export async function reloadWorldMap(option: loadMapOption, drawTarget = '.world
if(myCity){
$world_map.find(`.city_base_${myCity} .city_filler`).addClass('my_city');
}
return obj;
}
@@ -499,7 +499,7 @@ export async function reloadWorldMap(option: loadMapOption, drawTarget = '.world
if(myCity){
$world_map.find(`.city_base_${myCity} .city_filler`).addClass('my_city');
}
return obj;
}
@@ -729,7 +729,7 @@ export async function reloadWorldMap(option: loadMapOption, drawTarget = '.world
const response = await responseP;
const rawObject = response.data;
const rawObject: MapRawResult = response.data;
const computedResult = await checkReturnObject(rawObject)
.then(setMapBackground)
@@ -783,7 +783,7 @@ export async function reloadWorldMap(option: loadMapOption, drawTarget = '.world
}
window.reloadWorldMap = reloadWorldMap;
$(function () {
$(function ($) {
if (is_touch_device()) {
$('.map_body .map_toggle_single_tap').show();
}
+30
View File
@@ -0,0 +1,30 @@
import $ from 'jquery';
import 'bootstrap';
import { reloadWorldMap } from './map';
declare global{
interface Window{
fitIframe:()=>void;
}
}
$(function($){
void reloadWorldMap({
targetJson: "j_map_recent.php",
reqType: 'get',
dynamicMapTheme: true,
callback: function(data, rawObject) {
const historyRaw = rawObject as unknown as {
history: string
};
$('.card-body').html(historyRaw.history);
if(window.parent !== window){
setTimeout(()=>{
window.parent.fitIframe();
}, 1);
}
}
});
});
+3 -31
View File
@@ -38,10 +38,6 @@ foreach(ServConfig::getServerList() as $setting){
break;
}
if($runningServer){
$subTemplates = new \League\Plates\Engine(__DIR__.'/'.$runningServer['name'].'/templates');
}
?>
<!DOCTYPE html>
<html lang="ko">
@@ -51,9 +47,6 @@ if($runningServer){
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>삼국지 모의전투 HiDCHe</title>
<script>
var runningServer = <?=Json::encode($runningServer)?>;
</script>
<?= WebUtil::printJS('d_shared/common_path.js') ?>
<?= WebUtil::printJS('js/vendors.js') ?>
<?= WebUtil::printJS('js/common.js') ?>
@@ -61,16 +54,6 @@ if($runningServer){
<?= WebUtil::printCSS('d_shared/common.css') ?>
<?= WebUtil::printCSS('e_lib/bootstrap.min.css') ?>
<?= WebUtil::printCSS('css/login.css') ?>
<?php if($runningServer): ?>
<script>
var serverNick = '<?=$runningServer['korName']?>';
</script>
<?= WebUtil::printJS($runningServer['name'].'/js/vendors.js') /* FIXME: 의존성 문제 해결 필요 */?>
<?= WebUtil::printJS($runningServer['name'].'/js/common.js') ?>
<?= WebUtil::printJS($runningServer['name'].'/d_shared/base_map.js') ?>
<?= WebUtil::printJS($runningServer['name'].'/js/map.js') ?>
<?= WebUtil::printCSS($runningServer['name'].'/css/map.css') ?>
<?php endif; ?>
<?= WebUtil::printJS('e_lib/jquery.validate.min.js') ?>
<?= WebUtil::printJS('e_lib/sha512.min.js') ?>
<?= WebUtil::printJS('js/login.js') ?>
@@ -224,20 +207,9 @@ if($runningServer){
</div>
</div>
<?php if($runningServer): ?>
<div class="row justify-content-md-center" id="running_map">
<div class="col" style="max-width:700px;">
<div class="card" style="width:700px;">
<h3 class="card-header">
<?=$runningServer['korName']?> 현황
</h3>
<div class='map-container' style='position:relative;'>
<?=$subTemplates->render('map', [
'mapTheme' => ''
])?>
</div>
<div class="card-body">
</div>
</div>
<div class="row justify-content-md-center" style='margin-top:20px;'>
<div class="col" style="max-width:750px;">
<iframe id="running_map" src="<?=$runningServer['name']?>/recent_map.php"></iframe>
</div>
</div>
<?php endif; ?>
+1
View File
@@ -17,6 +17,7 @@ module.exports = [
install_db: './hwe/ts/install_db.ts',
install: './hwe/ts/install.ts',
battle_simulator: './hwe/ts/battle_simulator.ts',
recent_map: './hwe/ts/recent_map.ts',
//FORM 입력용, frontend 변경후 제거