Commit df36c80e by Lee Munkyeong

コード整理

parent 4c630ccd
......@@ -39,7 +39,7 @@
<div class="col-4 pl-0">
<div class="nav-item text-right">
<a href="#" class="search_menu"><img src="icon/icon_search.png" alt="検索"></a>
<a href="#" data-toggle="modal" data-target="#menuModalCenter"><img src="icon/icon_room_menu.png" alt="メニュー"></a>
<a href="#" data-toggle="modal" data-target="#menuModalCenter" id="roomMenu" class="none"><img src="icon/icon_room_menu.png" alt="メニュー"></a>
</div>
</div><!-- .col -->
</div><!-- .row -->
......@@ -111,15 +111,16 @@
<div class="footer_content_t">
<div class="d-flex flex-row h-100">
<div class="footer_item attach_file">
<img src="icon/icon_camera.png" alt="写真アイコン" id="fileUploadButton">
<form id="image-form">
<input class="d-none" type="file" name="image" id="imageInputTag" accept="image/x-png,image/jpeg">
</form>
<img src="icon/icon_camera.png" alt="写真アイコン" id="imageInputButton">
<form id="image-form">
<input class="d-none" type="file" name="image" id="imageInputTag" accept="image/x-png,image/jpeg">
</form>
</div>
<div class="footer_item attach_file">
<a href="#">
<img src="icon/icon_videocam.png" alt="動画アイコン">
</a>
<img src="icon/icon_videocam.png" alt="動画アイコン" id="videoUploadButton">
<form id="video-form">
<input class="d-none" type="file" name="image" id="videoInputTag" accept="video/mp4">
</form>
</div>
<input type="text" name="message" class="message_input_form" id="messageInput" placeholder="メッセージを入力してください">
<button type="button" name="button" class="message_input_send none" id="messageSend" onclick="CHAT_UI.sendMessage(this);">送信</button>
......
......@@ -7,20 +7,17 @@ CHAT_DB.getRoomList = function(roomType, keyWord) {
if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getRoomList(roomType, keyWord));
}
};
//ロカールDBからログインしたユーザのデータを取得する。
CHAT_DB.getMyInfo = function(input) {
var result = JSON.parse(android.getMyInfo());
CHAT.globalLoginParameter.shopMemberId = result.shopMemberId;
if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return result;
return JSON.parse(android.getMyInfo());
}
};
......@@ -65,7 +62,6 @@ CHAT_DB.getGroupInfo = function(groupId) {
//TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
console.log(JSON.parse(android.getGroupInfo(groupId)));
return JSON.parse(android.getGroupInfo(groupId));
}
};
......@@ -74,8 +70,6 @@ CHAT_DB.getNameCardData = function(shopMemberId) {
if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
console.log(android.getNameCardData(shopMemberId));
return JSON.parse(android.getNameCardData(shopMemberId));
}
};
......@@ -114,4 +108,4 @@ CHAT_DB.getUsersInRoom = function(roomId) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getUsersInRoom(roomId));
}
}
}
\ No newline at end of file
var lastscrollvalue;
window.onscroll = function() {
console.log('scroll');
var a = $('#messages');
if (lastscrollvalue == undefined) {
console.log('first')
lastscrollvalue = a.scrollTop;
// sets lastscrollvalue
} else if (a.scrollTop > lastscrollvalue) {
console.log('up');
// downscroll rules will be here
lastscrollvalue = a.scrollTop;
} else if (a.scrollTop < lastscrollvalue) {
console.log('down');
// upscroll rules will be here
lastscrollvalue = a.scrollTop;
}
......
......@@ -192,13 +192,11 @@ CHAT_UI.setOrientation = function(isLandscapeMode) {
}
CHAT_UI.sendMessage = function(e) {
console.log('messageSend');
const messageTextBox = $('#messageInput');
const message = messageTextBox.val().length > 0 ? encodeURIComponent(messageTextBox.val() + " ") : "";
messageTextBox.val('');
if (message.length > 0) {
console.log(message);
socket.emit(
//'createMessage', { text: '['+encodedText+'<&split>'+messageType.TEXT+']'; }
'createMessage', { text: message }
......@@ -216,27 +214,24 @@ $('#messageInput').on('keypress', function(event) {
});
// 写真アップロード
$('#fileUploadButton').on('click', function() {
console.log('onclickPhoto');
$('#imageInputButton').on('click', function() {
$('#imageInputTag').click();
});
// 動画アップロード
$('#fileUploadButton2').on('click', function() {
$('#imageInputTag2').click();
$('#videoUploadButton').on('click', function() {
$('#videoInputTag').click();
});
$('#imageInputTag').on('change', function() {
console.log('onchangePhoto');
$('#image-form').submit();
});
$('#imageInputTag2').on('change', function() {
$('#image-form2').submit();
$('#videoInputTag').on('change', function() {
$('#video-form').submit();
});
$('#image-form').on('submit', function(e) {
console.log('onSubmitPhoto');
e.preventDefault();
const imageInputTag = $('#imageInputTag');
const file = imageInputTag.prop('files')[0];
......@@ -260,10 +255,10 @@ $('#image-form').on('submit', function(e) {
}
});
$('#image-form2').on('submit', function(e) {
$('#video-form').on('submit', function(e) {
e.preventDefault();
const imageInputTag2 = $('#imageInputTag2');
const file = imageInputTag2.prop('files')[0];
const videoInputTag = $('#videoInputTag');
const file = videoInputTag.prop('files')[0];
if (file) {
$('.overlay').addClass('active undismissable');
$('.loader').addClass('active');
......@@ -1021,14 +1016,12 @@ CHAT_UI.refreshRoomList = function(roomType) {
var rooms = CHAT_DB.getRoomList(roomType, null);
CHAT.globalIsInvite = false;
activeRoomId = null;
console.log(rooms);
// #36146に対応
$('#groupChatList').empty();
$('#dmChatList').empty();
let roomListTitle = getLocalizedString("roomListTitle");
$('#chatTitle').text(roomListTitle);
if (rooms.length === 0) {
console.log('noRoom')
// 検索結果がない場合のメッセージを追加
let emptyListString = getLocalizedString("roomListEmptyString")
switch(roomType) {
......@@ -1047,7 +1040,6 @@ CHAT_UI.refreshRoomList = function(roomType) {
, function(text) {
template = text;
});
console.log(rooms);
rooms.forEach(function(room) {
room.profileImagePath = ASSET_PATH + 'images/user-profile.png'
if (room.message) {
......@@ -1089,7 +1081,6 @@ CHAT_UI.refreshRoomList = function(roomType) {
// ルームグループごとに追加。
switch(roomType) {
case chatRoomType.GROUP:
console.log(roomType);
$('#groupChatList').append(obj);
break;
case chatRoomType.DM:
......@@ -1111,20 +1102,19 @@ CHAT_UI.joinRoom = function(roomId,roomName) {
};
CHAT_UI.loadMessages = function(roomId, roomName) {
console.log('loadMessages] START--');
console.log(CHAT.globalLoginParameter);
if (IS_ONLINE == 'true') {
CHAT_SOCKET.connectSocket();
console.log('loadMessages] isOnline--');
android.updateMessages(roomId);
socket.emit('exitRoom',roomId);
socket.emit('joinRoom', roomId, roomName, function() {
console.log('loadMessages] Seccess Emit Soket (joinRoom)');
});
}
var roomType = android.getRoomType();
if (roomType == chatRoomType.DM) {
$('#roomMenu').removeClass('none');
}
var messages = CHAT_DB.getMessages(roomId);
var usersInRoom = CHAT_DB.getUsersInRoom(roomId);
console.log(usersInRoom);
$('#roomTitle').text(roomName).data('roomName', roomName);
let jQueryMessages = $('#messages');
......@@ -1392,14 +1382,12 @@ CHAT_UI.startChat = function(userShopMemberId,userName) {
};
CHAT_UI.startVoice = function() {
console.log("VoiceClick");
};
CHAT_UI.makeNameCard = function(shopMemberId) {
var nameCardInfo = CHAT_DB.getNameCardData(shopMemberId);
console.log(nameCardInfo);
var namecardTemplate;
$.get({ url: "./template/template_user_name_card.html", async: false }
, function(text) {
......
......@@ -206,7 +206,6 @@ function setSocketAction () {
});
// イメージの場合、img tagを追加する
html = message.text.includes('attachedImages') || message.text.includes('attachedVideos') ? CHAT_UTIL.htmlDecode(html) : html;
console.log(html);
$('#messages').append(html);
// 画像、動画の描画を待ってからスクロール
......
......@@ -87,10 +87,8 @@ CHAT.createVideoThumbnailAndUpload = function(sourceImage, callback) {
// Ajaxでイメージをアップロードする
CHAT.uploadImage = function(formData) {
console.log('uploadImage');
formData.append('roomId', CHAT.globalLoginParameter.roomId);
formData.append('sid', CHAT.globalLoginParameter.sid);
console.log(formData);
jQuery.ajax({
async: true,
url: CMS_SERVER_URL+"/chatapi/file/upload",
......@@ -99,9 +97,6 @@ CHAT.uploadImage = function(formData) {
contentType: false,
processData: false
}).done(function(res) {
// 8
console.log('DONE');
console.log(res);
var imgPath = CMS_SERVER_URL + '/chatapi/file/getImage?fileName=' + res.fileName + '&roomId=' + CHAT.globalLoginParameter.roomId;
var imageName = res.fileName
......@@ -137,10 +132,10 @@ CHAT.uploadImage = function(formData) {
} else { // 動画の処理
if (res.thumbnailPath && res.thumbnailPath.length > 0) {
imgPath = CMS_SERVER_URL + '/file/getImage?fileName=' + res.thumbImageFileName + '&roomId=' + CHAT.globalLoginParameter.roomId;
imgPath = CMS_SERVER_URL + '/chatapi/file/getImage?fileName=' + res.thumbImageFileName + '&roomId=' + CHAT.globalLoginParameter.roomId;
}
let downloadPath = CMS_SERVER_URL + '/file/download?fileName=' + imageName + '&roomId=' + CHAT.globalLoginParameter.roomId;
let downloadPath = CMS_SERVER_URL + '/chatapi/file/download?fileName=' + imageName + '&roomId=' + CHAT.globalLoginParameter.roomId;
const aTag = $('<a/>', {id:"attachedImages"})
const image = $('<img/>',{src:imgPath, width:'auto',style:'max-width:100%'});
const downloadIcon = $('<a/>',{href:downloadPath, class:'fa fa-download', download:res.fileName});
......@@ -157,7 +152,8 @@ CHAT.uploadImage = function(formData) {
}
socket.emit('createMessage', {
text: '['+encodedText+'<&split>'+messageType.VIDEO+']'
//text: '['+encodedText+'<&split>'+messageType.VIDEO+']'
text: encodedText
}, 1);
}
......@@ -341,10 +337,8 @@ $(function() {
// チャットメンバー検索
$('#chat .search_form input[type="search"]').keyup(function(){
console.log($('#chat .search_form input[type="search"]').val());
var keyword = $('#chat .search_form input[type="search"]').val();
var rooms = CHAT_DB.getRoomList(chatRoomType.ALL, keyword);
console.log(rooms);
let roomListTitle = getLocalizedString("room_search_placeholder");
$('#chatTitle').text(roomListTitle);
var template;
......
......@@ -51,18 +51,14 @@ $(function() {
});
$('.message_input_form').click(function(){
console.log('ONCLICK---');
$('.message_input_send').removeClass('none');
$('.attach_file').addClass('none');
});
$('.message_input_form').on('focusout',function(e){
console.log('OUTFOCUS---');
console.log(e);
if($(e.relatedTarget).hasClass('message_input_send')){
CHAT_UI.sendMessage();
}
console.log(e.relatedTarget)
$('.message_input_send').addClass('none');
$('.attach_file').removeClass('none');
});
......
......@@ -2,7 +2,6 @@ $(function() {
// メンバー検索
$('#contact .search_form input[type="search"]').keyup(function(e){
console.log(e);
var isAllGroup = $('#tabAllGroup').is(':checked');
$('.overlay_src_msg').empty();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment