func_map.php를 통해 현재 지도 값을 받아오는 코드 추가
j_map.php를 통해 지도를 json 형태로 열람하는 코드 추가 연감의 저장코드를 http를 통해 지도를 받아오는 방식에서 func_map.php를 이용하는 방식으로 변경 map.js에서 반환값이 올바른지 확인하는 코드 추가 b_CurrentCity.php의 도시 정보 값을 get으로도 받을 수 있도록 변경 map.js에서 재야 상태일때 올바르게 처리하도록 변경
This commit is contained in:
+53
-15
@@ -37,6 +37,24 @@ function reloadWorldMap(option){
|
||||
//OBJ : startYear, year, month, cityList, nationList, spyList, shownByGeneralList, myCity
|
||||
var $world_map = $('.world_map');
|
||||
|
||||
var deferred;
|
||||
|
||||
function checkReturnObject(obj){
|
||||
if(!obj.result){
|
||||
deferred.reject();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$.isNumeric(obj.startYear)
|
||||
||!$.isNumeric(obj.year)
|
||||
||!$.isNumeric(obj.month)){
|
||||
deferred.reject();
|
||||
return;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function setMapBackground(obj){
|
||||
var startYear = obj.startYear;
|
||||
var year = obj.year;
|
||||
@@ -197,12 +215,15 @@ function reloadWorldMap(option){
|
||||
if(id in spyList){
|
||||
clickable |= spyList[id] << 3;
|
||||
}
|
||||
if(nationId == myNation){
|
||||
if(myNation !== null && nationId == myNation){
|
||||
clickable |= 4;
|
||||
}
|
||||
if(shownByGeneralList.hasOwnProperty(id)){
|
||||
clickable |= 2;
|
||||
}
|
||||
if(myCity !== null && id == myCity){
|
||||
clickable |= 2;
|
||||
}
|
||||
if(clickableAll){
|
||||
clickable |= 1;
|
||||
}
|
||||
@@ -373,7 +394,15 @@ function reloadWorldMap(option){
|
||||
var $this = $(this);
|
||||
var position = $this.parent().position();
|
||||
$tooltip_city.html($this.data('text'));
|
||||
$tooltip_nation.html($this.data('nation'));
|
||||
|
||||
var nation_text = $this.data('nation');
|
||||
if(nation_text){
|
||||
$tooltip_nation.html(nation_text).show();
|
||||
}
|
||||
else{
|
||||
$tooltip_nation.html('').hide();
|
||||
}
|
||||
|
||||
$tooltip.css({'top': position.top + 25, 'left': position.left + 35}).show();
|
||||
|
||||
var touchMode = $this.data('touchMode');
|
||||
@@ -414,7 +443,13 @@ function reloadWorldMap(option){
|
||||
|
||||
$tooltip_city.data('target', $this.data('id'));
|
||||
$tooltip_city.html($this.data('text'));
|
||||
$tooltip_nation.html($this.data('nation'));
|
||||
var nation_text = $this.data('nation');
|
||||
if(nation_text){
|
||||
$tooltip_nation.html(nation_text).show();
|
||||
}
|
||||
else{
|
||||
$tooltip_nation.html('').hide();
|
||||
}
|
||||
|
||||
$tooltip.show();
|
||||
});
|
||||
@@ -471,24 +506,27 @@ function reloadWorldMap(option){
|
||||
}
|
||||
|
||||
//deferred mode of jQuery. != promise-then.
|
||||
$.ajax({
|
||||
deferred = $.ajax({
|
||||
url: option.targetJson,
|
||||
type: 'POST',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
contentType: 'application/json',
|
||||
data: {
|
||||
data: JSON.stringify({
|
||||
neutralView:option.neutralView,
|
||||
year:option.year,
|
||||
month:option.month,
|
||||
showMe:option.showMe,
|
||||
aux:option.aux
|
||||
},
|
||||
dataType:'json'
|
||||
})
|
||||
.then(setMapBackground)
|
||||
.then(convertCityObjs)
|
||||
.then(isDetailMap?drawDetailWorldMap:drawBasicWorldMap)
|
||||
.then(setMouseWork)
|
||||
.then(setCityClickable)
|
||||
.then(saveCityInfo);
|
||||
})
|
||||
});
|
||||
|
||||
deferred
|
||||
.then(checkReturnObject)
|
||||
.then(setMapBackground)
|
||||
.then(convertCityObjs)
|
||||
.then(isDetailMap?drawDetailWorldMap:drawBasicWorldMap)
|
||||
.then(setMouseWork)
|
||||
.then(setCityClickable)
|
||||
.then(saveCityInfo);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user