Commit e4fe6fb8 by Kang Donghun

#42526 チャット一覧からチャット後のルームを選択すると、最新メッセージが表示されない

parent 057364bb
...@@ -150,6 +150,7 @@ ...@@ -150,6 +150,7 @@
<script src="./js/libs/jquery.mark.min.js"></script> <script src="./js/libs/jquery.mark.min.js"></script>
<script src="./js/common.js"></script> <script src="./js/common.js"></script>
<script src="./js/language.js"></script> <script src="./js/language.js"></script>
<script src="./js/loading.js"></script>
<script src="./js/language_ko.js" charset="UTF-8"></script> <script src="./js/language_ko.js" charset="UTF-8"></script>
<script src="./js/language_ja.js" charset="UTF-8"></script> <script src="./js/language_ja.js" charset="UTF-8"></script>
<script src="./js/language_en.js" charset="UTF-8"></script> <script src="./js/language_en.js" charset="UTF-8"></script>
...@@ -169,6 +170,7 @@ ...@@ -169,6 +170,7 @@
String.prototype.replaceAll = function(org, dest) { String.prototype.replaceAll = function(org, dest) {
return this.split(org).join(dest); return this.split(org).join(dest);
} }
$("#loadingArea").load("./loading.html");
let CHAT_SERVER_URL = ''; let CHAT_SERVER_URL = '';
let CMS_SERVER_URL = ''; let CMS_SERVER_URL = '';
...@@ -196,7 +198,6 @@ ...@@ -196,7 +198,6 @@
IS_MOBILE = isMobile; IS_MOBILE = isMobile;
IS_ONLINE = isOnline; IS_ONLINE = isOnline;
CHAT_UI.loadMessages(CHAT.globalLoginParameter.roomId, CHAT.globalLoginParameter.roomName); CHAT_UI.loadMessages(CHAT.globalLoginParameter.roomId, CHAT.globalLoginParameter.roomName);
}; };
</script> </script>
</body> </body>
......
...@@ -555,7 +555,7 @@ CHAT_UI.scrollToBottom = function() { ...@@ -555,7 +555,7 @@ CHAT_UI.scrollToBottom = function() {
//messages.scrollTop(scrollHeight); //messages.scrollTop(scrollHeight);
$('html, body').animate({ $('html, body').animate({
scrollTop: scrollHeight scrollTop: scrollHeight
}, 500); }, 100);
}; };
CHAT_UI.scrollToLastMarkedUnseen = function(value) { CHAT_UI.scrollToLastMarkedUnseen = function(value) {
...@@ -879,6 +879,24 @@ CHAT_UI.htmlElementTextInitialize = function(languageCode) { ...@@ -879,6 +879,24 @@ CHAT_UI.htmlElementTextInitialize = function(languageCode) {
// 画像の読み込みが全て終わったタイミングでコールバック実行 // 画像の読み込みが全て終わったタイミングでコールバック実行
// FIXME 追加読み込みの場合は差分の画像のみ監視すべきだが、現状新規入室時にしか対応出来ていない。 // FIXME 追加読み込みの場合は差分の画像のみ監視すべきだが、現状新規入室時にしか対応出来ていない。
CHAT_UI.waitForLoadingVideo = function(div, callback) {
CHAT_UI.showLoadingIndicator();
// var imgs = document.getElementsByTagName("video");
var video = div.find("video");
var count = video.length;
if (count==0) callback();
var loaded = 0;
video.each( function() {
this.addEventListener('loadeddata', function(e) {
loaded++;
if ( loaded === count ) {
callback();
CHAT_UI.dismissLoadingIndicator();
}
});
});
}
CHAT_UI.waitForLoadingImage = function(div, callback) { CHAT_UI.waitForLoadingImage = function(div, callback) {
var imgs = div.find("img"); var imgs = div.find("img");
var count = imgs.length; var count = imgs.length;
...@@ -895,10 +913,8 @@ CHAT_UI.waitForLoadingImage = function(div, callback) { ...@@ -895,10 +913,8 @@ CHAT_UI.waitForLoadingImage = function(div, callback) {
if ( this.complete || this.readyState === readyState.COMPLETED ) { if ( this.complete || this.readyState === readyState.COMPLETED ) {
$(this).trigger("load"); $(this).trigger("load");
} }
}); });
} }
$('#contactButton').on('click', function(event) { $('#contactButton').on('click', function(event) {
CHAT_UI.refreshContactScreen(); CHAT_UI.refreshContactScreen();
}); });
...@@ -1286,26 +1302,13 @@ CHAT_UI.loadMessages = function(roomId, roomName) { ...@@ -1286,26 +1302,13 @@ CHAT_UI.loadMessages = function(roomId, roomName) {
html = message.message.includes('attachedImages') || message.message.includes('attachedVideos') ? CHAT_UTIL.htmlDecode(html) : html; html = message.message.includes('attachedImages') || message.message.includes('attachedVideos') ? CHAT_UTIL.htmlDecode(html) : html;
workVal = html + workVal; workVal = html + workVal;
}) })
// メッセージの画面描画 // メッセージの画面描画
jQueryMessages.prepend(workVal); jQueryMessages.prepend(workVal);
if (beforeHeight !== 0) {
// 追加のメッセージ読み込み時は読み込み前のスクロール位置を維持
setTimeout(function() {
jQueryMessages.scrollTop(jQueryMessages.prop('scrollHeight') - beforeHeight);
}, 400);
} else {
// 新規に入室の場合は最下部へスクロール
CHAT_UI.waitForLoadingImage(jQueryMessages, CHAT_UI.scrollToBottom);
// タブレット等、画面サイズが大きい場合、スクロール出来なくならないよう追加で10件メッセージを取得
if ($(window).height() > jQueryMessages.height()) {
$('#messages').scroll();
}
}
CHAT_UI.waitForLoadingImage(jQueryMessages, CHAT_UI.scrollToBottom); CHAT_UI.waitForLoadingImage(jQueryMessages, CHAT_UI.scrollToBottom);
CHAT_UI.waitForLoadingVideo(jQueryMessages, CHAT_UI.scrollToBottom);
// ユーザ削除ボタン表示しない // ユーザ削除ボタン表示しない
$("#userSelectionDeleteBtn").hide(); $("#userSelectionDeleteBtn").hide();
CHAT_UI.scrollToBottom();
}; };
...@@ -2128,7 +2131,6 @@ CHAT_UI.showAddUserConfirmView = function() { ...@@ -2128,7 +2131,6 @@ CHAT_UI.showAddUserConfirmView = function() {
var selectedUserList = CHAT_DB.loadSelectedUsers(); var selectedUserList = CHAT_DB.loadSelectedUsers();
console.log("check = " + selectedUserList);
selectedUserList.forEach(function(user){ selectedUserList.forEach(function(user){
let html = Mustache.render(userTemplate, { let html = Mustache.render(userTemplate, {
id: user.shopMemberId, id: user.shopMemberId,
......
...@@ -84,7 +84,7 @@ CHAT.createVideoThumbnailAndUpload = function(sourceImage, callback) { ...@@ -84,7 +84,7 @@ CHAT.createVideoThumbnailAndUpload = function(sourceImage, callback) {
// Load video in Safari / IE11 // Load video in Safari / IE11
video.muted = true; video.muted = true;
video.playsInline = true; video.playsInline = true;
video.play(); video.pause();
}; };
fileReader.readAsArrayBuffer(sourceImage); fileReader.readAsArrayBuffer(sourceImage);
} }
......
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