메시지 첫 동작

This commit is contained in:
2018-04-16 01:09:43 +09:00
parent c87cbaa0a6
commit 0c9099c868
6 changed files with 99 additions and 64 deletions
+7 -6
View File
@@ -48,7 +48,7 @@ function refreshMsg(){
function fetchMsg(){
return $.ajax({
url: 'json_result.php',
url: 'j_msg_get_recent.php',
type: 'post',
dataType:'json',
contentType: 'application/json',
@@ -221,7 +221,7 @@ function refreshMailboxList(obj){
$.each(obj.nation, function(){
var nation = this;
//console.log(nation);
var $optgroup = $('<optgroup label="{0}"></optgroup>'.format(nation.nation));
var $optgroup = $('<optgroup label="{0}"></optgroup>'.format(nation.name));
$optgroup.css('background-color', nation.color);
if(myNation.mailbox == nation.mailbox){
@@ -238,7 +238,8 @@ function refreshMailboxList(obj){
$.each(nation.general, function(){
var generalID = this[0];
var generalName = this[1];
var isRuler = this.length>2;
var isNPC = !!(this[2] & 0x2);
var isRuler = !!(this[2] & 0x1);
@@ -358,13 +359,13 @@ function activateMessageForm(){
jQuery(function($){
//tmp_template.html은 추후 msg.js에 통합될 수 있음
var getTemplate = $.get('tmp_template.html',function(obj){
var getTemplate = $.get('js/templates/message.html',function(obj){
messageTemplate = obj;
});
//basic_info.json은 세션값에 따라 동적으로 바뀌는 데이터임.
var basicInfo = $.ajax({
url:'basic_info.json',
url:'j_basic_info.php',
type: 'post',
dataType:'json',
contentType: 'application/json',
@@ -375,7 +376,7 @@ jQuery(function($){
//sender_list.json 은 서버측에선 캐시 가능한 데이터임.
var senderList = $.ajax({
url: 'sender_list.json',
url: 'j_msg_contact_list.php',
type: 'post',
dataType:'json',
contentType: 'application/json',
+38
View File
@@ -0,0 +1,38 @@
<div
class="msg_plate msg_plate_<%msgType%>"
id="msg_<%id%>"
data-id="<%id%>"
>
<div class="msg_icon">
<%if(src.icon) { %>
<img width='64' height='64' src="<%encodeURI(src.icon)%>">
<%} else {%>
<img width='64' height='64' src="<%encodeURI(defaultIcon)%>">
<%}%>
</div>
<div class="msg_body">
<div class="msg_header">
<%if(msgType == 'private') {%>
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span
><span class="msg_from_to"></span
><span class="msg_target msg_<%dest.colorType%>" style="background-color:<%dest.color%>;"><%e(dest.name)%>:<%e(dest.nation)%></span>
<%} else if(msgType == 'national' && src.nation_id == dest.nation_id){%>
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span>
<%} else if(msgType == 'national' || msgType == 'diplomacy'){%>
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span
><span class="msg_from_to"></span
><span class="msg_target msg_<%dest.colorType%>" style="background-color:<%dest.color%>;"><%e(dest.nation)%></span>
<%} else {%>
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span>
<%} %>
<span class="msg_time">&lt;<%e(time)%>&gt;</span>
</div>
<div class="msg_content"><%e(text)%></div>
<%if(this.option && this.option.action) {%>
<div class="msg_prompt">
<button class="prompt_yes btn_prompt">수락</button> <button class="prompt_no btn_prompt">거절</button>
</div>
<%} %>
</div>
</div>