Commit 954849fb by Kim Peace

tree shaking for js

parent b952b542
......@@ -101,7 +101,6 @@
PLATFORM = platform;
IS_MOBILE = isMobile;
IS_ONLINE = isOnline;
//CHAT_UI.showMakeRoomConfirmView();
CHAT_UI.showAddUserConfirmView();
};
</script>
......
......@@ -168,7 +168,6 @@
<script src="./js/sockets/chat-websocket.js"></script>
<script src="./js/sockets/chat-websocket-message.js"></script>
<script src="./js/sockets/chat-websocket-refresh-group-list.js"></script>
<script src="./js/sockets/chat-websocket-refresh-user-list-in-group.js"></script>
<!-- View -->
<script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script>
......
......@@ -149,7 +149,6 @@
<script src="./js/sockets/chat-websocket.js"></script>
<script src="./js/sockets/chat-websocket-message.js"></script>
<script src="./js/sockets/chat-websocket-refresh-group-list.js"></script>
<script src="./js/sockets/chat-websocket-refresh-user-list-in-group.js"></script>
<!-- View -->
<script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script>
......
......@@ -92,7 +92,6 @@
<script src="./js/sockets/chat-websocket.js"></script>
<script src="./js/sockets/chat-websocket-message.js"></script>
<script src="./js/sockets/chat-websocket-refresh-group-list.js"></script>
<script src="./js/sockets/chat-websocket-refresh-user-list-in-group.js"></script>
<!-- View -->
<script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script>
......
......@@ -153,7 +153,6 @@
<script src="./js/sockets/chat-websocket.js"></script>
<script src="./js/sockets/chat-websocket-message.js"></script>
<script src="./js/sockets/chat-websocket-refresh-group-list.js"></script>
<script src="./js/sockets/chat-websocket-refresh-user-list-in-group.js"></script>
<!-- View -->
<script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script>
......
......@@ -143,7 +143,6 @@
<script src="./js/sockets/chat-websocket.js"></script>
<script src="./js/sockets/chat-websocket-message.js"></script>
<script src="./js/sockets/chat-websocket-refresh-group-list.js"></script>
<script src="./js/sockets/chat-websocket-refresh-user-list-in-group.js"></script>
<!-- View -->
<script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script>
......
......@@ -88,7 +88,6 @@
<script src="./js/sockets/chat-websocket.js"></script>
<script src="./js/sockets/chat-websocket-message.js"></script>
<script src="./js/sockets/chat-websocket-refresh-group-list.js"></script>
<script src="./js/sockets/chat-websocket-refresh-user-list-in-group.js"></script>
<!-- View -->
<script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script>
......
......@@ -145,7 +145,6 @@
<script src="./js/sockets/chat-websocket.js"></script>
<script src="./js/sockets/chat-websocket-message.js"></script>
<script src="./js/sockets/chat-websocket-refresh-group-list.js"></script>
<script src="./js/sockets/chat-websocket-refresh-user-list-in-group.js"></script>
<!-- View -->
<script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script>
......
jQuery("#homeButton").on("click", function () {
NativeBridgeDelegate.goHome();
});
jQuery("#reloadButton").on("click", function () {
if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要。
} else if (CHAT_UTIL.isAndroid()) {
android.reload();
}
});
});
\ No newline at end of file
......@@ -9,99 +9,6 @@ $("#createChatRoom").on("click", function () {
socket.emit("getGroupList", isInvite);
});
// Room Delete
// チャットルーム削除ボタン処理
$("#roomDeleteButton").on("click", function (e) {
if ($(".deleteBox").is(":visible")) {
// チャットルーム削除アイコンが表示されている時、ブラインド処理を行う
$(".deleteBox")
.finish()
.show()
.fadeTo("slow", 0, function () {
$(this).hide();
});
// チャットリストについてクリックイベントを与える
$(".chat_list").off("click");
$(".chat_list:not(.active_chat)").on("click", function (e) {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
let roomId = $(this).data("roomId");
let roomName = $(this).data("roomname");
socket.emit("joinRoom", roomId, roomName, function () {
$("#messages").html("");
$(".titleRoomName").text(roomName).data("roomName", roomName);
$("#pills-chat-tab").tab("show");
$("#message-search").attr(
"placeholder",
getLocalizedString("chat_search_placeholder")
);
});
});
let roomListTitle = getLocalizedString("roomListTitle");
$(".titleRoomName").text(roomListTitle);
$(".chat_list.active_chat").on("click", function (e) {
$("#pills-chat-tab").tab("show");
});
} else {
// チャットルーム削除アイコンが表示されていない場合、表示する
$(".deleteBox").finish().hide().fadeTo("slow", 1).show();
// #36129に対応
let deleteRoomTitle = getLocalizedString("deleteRoomTitle");
$(".titleRoomName").text(deleteRoomTitle);
// 重複処理を防ぐためにチャットリストのクリックイベントを消す
$(".chat_list").off("click");
// チャットルームの削除アイコンにクリックイベントを与える
$(".deleteBox").off("click");
$(".deleteBox").on("click", function (e) {
// #36174
let roomId = $(this).data("roomId");
let activeRoom = $(this).data("activeRoom");
$("#roomDeleteTitle").text(getLocalizedString("roomDeleteTitle"));
$("#roomDelete").text(getLocalizedString("roomDelete"));
$("#cancelTitle").text(getLocalizedString("cancelTitle"));
// #36128
$("#roomDeleteConfirm")
.appendTo("body")
.modal({
backdrop: "static",
keyboard: false,
})
.on("click", "#roomDelete", function (e) {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
// 現在接続されているチャットルームを離れるとメッセージテップを初期化する
if (activeRoom) {
$("#messages").html("");
CHAT.saveRoomInfo("", "");
}
// チャットルームから退場する
socket.emit("exitRoom", roomId);
// #36129に対応
let roomListTitle = getLocalizedString("roomListTitle");
$(".titleRoomName").text(roomListTitle);
});
});
}
});
$("#room-search").on("input", function (event) {
if ($("#room-search").val().length > 0) {
// 検索結果が有る場合、結果を表示する
socket.emit("roomSearch", encodeURIComponent($("#room-search").val()));
} else {
if (IS_ONLINE == "true") {
NativeBridgeDelegate.updateRoomList();
CHAT_UI.refreshRoomList(ChatRoomType.DM);
CHAT_UI.dismissLoadingIndicator();
}
}
});
//メッセージ送信
$("#messageInput").on("keypress", function (event) {
if (event.which == 13) {
......@@ -183,119 +90,6 @@ $("#video-form").on("submit", function (e) {
}
});
$("#message-search").on("input", function (event) {
// チャットキーワードを入力するとページ内にある単語をハイライトする。(mark.js 使用)
if ($(this).val()) {
$(".message_content").unmark();
$(".message_content").mark($(this).val());
if ($("[data-markjs=true]").length > 0) {
// マーキングされている単語があった場合、最後の単語にスクロールを移動する。
CHAT_UI.scrollToLastMarkedUnseen($(this).val());
} else {
// マーキングされている単語がない場合、下段にスクロールする。
CHAT_UI.scrollToBottom();
}
} else {
// チャットキーワードが空欄になるとマーキングを解除し、下段にスクロールする。
$(".message_content").unmark();
CHAT_UI.scrollToBottom();
}
});
//次のマーキングされた単語にスクロールを移動する。
$("#pre-search").on("click", function (event) {
CHAT_UI.scrollToLastMarkedUnseen(jQuery("#message-search").val());
});
// Exit Room
$("#exitRoom").on("click", function (event) {
// 36174
$("#exitRoomTitle").text(getLocalizedString("exitRoomTitle"));
$("#exitRoomOk").text(getLocalizedString("yesTitle"));
$("#noExit").text(getLocalizedString("cancelTitle"));
$("#exitRoomConfirm")
.appendTo("body")
.modal({
backdrop: "static",
keyboard: false,
})
.on("click", "#exitRoomOk", function (e) {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
// チャットルームから退場する
socket.emit("exitRoom");
$("#dismiss").click();
CHAT.saveRoomInfo("", "");
});
});
// Side Bar
$("#sidebarCollapse").on("click", function () {
// open sidebar
$("#sidebar").addClass("active");
// fade in the overlay
$(".overlay").addClass("active");
$(".collapse.in").toggleClass("in");
$("a[aria-expanded=true]").attr("aria-expanded", "false");
});
$("#dismiss, .overlay").on("click", function () {
// hide sidebar
$("#sidebar").removeClass("active");
// hide overlay if dismissable
$(".overlay:not(.undismissable)").removeClass("active");
});
//Invite User
//招待ボタンを押すとグループリストを持ってくる。(ボタンを動的に追加して微動作中)
$("#addUser").on("click", function (event) {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
let isInvite = true;
CHAT.globalIsInvite = isInvite;
socket.emit("getGroupList", isInvite);
});
//グループ画面での検索
$("#groupListKeyword").on("input", function (event) {
// data-name値で当該キーワードが入っているグループのみを表示する。
if ($(this).val()) {
$('.group_list:not([data-name*="' + $(this).val() + '" i])').hide();
$('.group_list[data-name*="' + $(this).val() + '" i]').show();
} else {
$(".group_list").show();
}
});
$("#userListKeyword").on("input", function (event) {
// data-name値で当該キーワードが入っているユーザーのみを表示する。
if ($(this).val()) {
$('.user_list:not([data-name*="' + $(this).val() + '" i])').hide();
$('.user_list[data-name*="' + $(this).val() + '" i]').show();
} else {
$(".user_list").show();
}
});
$("#selectListKeyword").on("input", function (event) {
if ($(this).val()) {
$('.select_user_list:not([data-name*="' + $(this).val() + '" i])').hide();
$('.select_user_list[data-name*="' + $(this).val() + '" i]').show();
} else {
$(".select_user_list").show();
}
});
$("#contactButton").on("click", function (event) {
CHAT_UI.refreshContactScreen();
});
$("#chatButton").on("click", function (event) {
CHAT_UI.refreshRoomList(ChatRoomType.DM);
});
$("#tabDM").on("click", function (e) {
CHAT_UI.refreshRoomList(ChatRoomType.DM);
});
......
......@@ -32,46 +32,10 @@ $("#messages").scroll(function () {
);
$("#messages").prepend(loader);
loader.remove();
// socket.emit('getMessages', $(this).children().length, function() {
// // ローディングアイコンを削除する
// loader.remove();
// });
}
}
});
// UIの位置調整(キーボード出現時)
$("#message-form").on("focus", function () {
if (CHAT_UTIL.isIOS()) {
// メッセージ入力欄の位置指定
document.querySelector(".fixed-bottom").style.bottom = 10000 + "px";
setTimeout(function () {
document.querySelector(".fixed-bottom").style.bottom = 0 + "px";
}, 200);
}
});
CHAT_UI.setNavigationPosition = function (y) {
if (document.activeElement.id == "message-form") {
$(".navbar").css("position", "absolute");
$(".navbar").css("top", y + "px");
$(".tab-pane").css("margin-top", y + "px");
var height = document
.getElementById("messages")
.getBoundingClientRect().height;
$(".msg_history").css("height", height - y + "px");
} else if (document.activeElement.id == "message-search") {
$(".msg_history").css("height", "");
}
};
CHAT_UI.resetNavigationPosition = function () {
$(".navbar").css("position", "");
$(".navbar").css("top", "");
$(".tab-pane").css("margin-top", "");
$(".msg_history").css("height", "");
};
// 端末の向きを記録(キーボード出現時にLandscapeModeと判定する対策)
var isLandscape;
CHAT_UI.setOrientation = function (isLandscapeMode) {
......@@ -102,173 +66,6 @@ CHAT_UI.sendMessage = function (e) {
$(".message_input_form").focus();
};
/* ---------------------------------------------------------------------- */
/* */
/* Etc */
/* */
/* ---------------------------------------------------------------------- */
// Tab Open/Shown Event
$('a[data-toggle="pill"]').on("show.bs.tab", function (e) {
var target = $(e.target).attr("href"); // e.target : activated tab
switch (target) {
case "#pills-chat":
if (CHAT_UI.isLandscapeMode()) {
$(".mesgs").addClass("landscape_mesgs");
} else {
$(".mesgs").removeClass("landscape_mesgs");
}
CHAT.globalIsInvite = true;
$(".chatRoomIcon, .titleRoomName, #backButton").show();
$(
".roomListIcon, #userSelectionConfirmBtn, #newRoomName, #userSelectionDeleteBtn"
).hide();
$("#homeButton").hide();
$(".titleRoomName").text($(".titleRoomName").data("roomName"));
$("#newRoomName").val("");
$("#userSelectionLength").text("");
CHAT.globalSelectedUserList = [];
$("#bottomNav").hide();
$("#backButton")
.off()
.on("click", function () {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
CHAT.saveRoomInfo();
if (IS_ONLINE == "true") {
socket.emit("leaveRoom", function () {
NativeBridgeDelegate.updateRoomList();
});
}
CHAT_UI.refreshRoomList(ChatRoomType.DM);
CHAT_UI.dismissLoadingIndicator();
});
//loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
break;
case "#pills-chatlist":
$(".titleRoomName, #backButton").show();
$(
".chatRoomIcon, #backButton, #userSelectionConfirmBtn, #newRoomName, #userSelectionDeleteBtn"
).hide();
$("#homeButton").show();
$("#room-search").val("");
$("#room-search").show();
$("#room_list").show();
// set Title
let roomListTitle = getLocalizedString("roomListTitle");
$("#bottomNav").show();
$(".titleRoomName").text(roomListTitle);
$("#newRoomName").val("");
$("#userSelectionLength").text("");
CHAT.globalSelectedUserList = [];
break;
case "#pills-contact":
$("#myNamecard").html("");
$("#homeButton").show();
$("#backButton").hide();
$(".titleRoomName").show();
$("#myGroupArea").show();
$("#allGroupArea").hide();
$("#my_info").show();
$("#bottomNav").show();
break;
case "#pills-user":
$("#backButton").show();
$("#userSelectionDeleteBtn").hide();
$("#homeButton").hide();
$("#bottomNav").hide();
//loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
break;
case "#pills-group":
$("#backButton").show();
$("#userSelectionDeleteBtn").hide();
$("#homeButton").hide();
$("#bottomNav").hide();
//loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
break;
case "#pills-confirm":
$("#backButton").show();
//loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
$("#homeButton").hide();
$("#bottomNav").hide();
$(".user_people").css("paddingLeft", "0px");
break;
case "#pills-communication": // コミュニケーションのタブ
case "#pills-setting": // 設定のタブ
case "#pills-profile": // ユーザプロファイルのタブ
$("#bottomNav").hide();
$(".titleRoomName").show();
$(
".roomListIcon, .chatRoomIcon, #userSelectionConfirmBtn, #newRoomName, #userSelectionDeleteBtn"
).hide();
$("#backButton").hide();
break;
default:
$(".titleRoomName").show();
$(
".roomListIcon, .chatRoomIcon, #userSelectionConfirmBtn, #newRoomName, #userSelectionDeleteBtn"
).hide();
$("#backButton").hide();
break;
}
});
// Tab Close/Hidden Event
$('a[data-toggle="pill"]').on("hide.bs.tab", function (e) {
var target = $(e.target).attr("href"); // e.target : activated tab
switch (target) {
case "#pills-chat":
$("#message-search").val("");
break;
case "#pills-chatlist":
$("#room-search").val("");
$("#room-search").show();
break;
case "#pills-group":
$("#groupListKeyword").val("");
break;
case "#pills-contact":
break;
case "#pills-user":
$("#userListKeyword").val("");
break;
case "#pills-confirm":
$("#select_user_list").html("");
$("#selectUserListKeyword").val("");
$(".titleRoomName").show();
$(".user_people").css("paddingLeft", "12%");
break;
case "#pills-communication":
case "#pills-setting":
case "#pills-profile":
break;
default:
break;
}
});
$("#pills-chat-tab").on("shown.bs.tab", function (e) {
CHAT_UI.scrollToBottom();
});
$("#pills-user-tab").on("shown.bs.tab", function (e) {
$("#userSelectionConfirmBtn").show();
});
$("#pills-confirm-tab").on("shown.bs.tab", function (e) {
$("#userSelectionConfirmBtn").show();
$("#userSelectionLength").text("");
$("#userSelectionDeleteBtn").hide();
});
CHAT_UI.scrollToBottom = function () {
const messages = $(".room_contents");
const scrollHeight = messages.prop("scrollHeight");
......@@ -294,8 +91,6 @@ CHAT_UI.scrollToLastMarkedUnseen = function (value) {
target.attr("data-seen", true);
} else {
messages.scrollTop(0);
$(".message_content").unmark();
$(".message_content").mark(value);
}
};
......@@ -320,274 +115,13 @@ CHAT_UI.isLandscapeMode = function () {
return $(window).width() > $(window).height();
};
CHAT_UI.setConfirmButtonEvent = function (isInvite) {
let titleText = isInvite
? getLocalizedString("inviteUsersSubtitle")
: getLocalizedString("createRoomSubtitle");
let invitedUserText = getLocalizedString("invitedUser");
if (!isInvite) {
$("#newRoomName").show();
}
$("#userSelectionConfirmBtn")
.off()
.on("click", function (event) {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
CHAT_UI.showConfirmView(isInvite);
});
CHAT_UI.showConfirmView(isInvite);
$("#inviteStatus").text(titleText);
$("#invitedUsers").text(invitedUserText);
$("#pills-confirm-tab").tab("show");
};
//ConfirmView initialize
CHAT_UI.showConfirmView = function (isInvite) {
const template = $("#user-template").html();
$("#select_user_list").html("");
CHAT.globalSelectedUserList.forEach(function (user) {
let html = Mustache.render(template, {
id: user.shopMemberId,
profileImage: user.profileImagePath,
name: user.loginId,
});
// TODO 次のコミットに参考事項
// チャットルーム開設画面で参加ユーザー削除用チェックロジックが残っているので
// 影響テスト後、削除予定。 kang-dh
let obj = $(jQuery.parseHTML(html)).on("click", function () {
$(this).find(".userCheckBox").toggleClass("active");
});
$("#select_user_list").append(obj);
});
let roomListTitle = getLocalizedString("createRoomTitle");
$(".titleRoomName").text(roomListTitle);
// Rotate
if (CHAT_UI.isLandscapeMode()) {
$(".user_list").addClass("col-6").removeClass("col-12");
$(".squareBoxContent span").addClass("landscape_span");
}
$("#backButton")
.off()
.on("click", function () {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
socket.emit("getGroupList", isInvite);
});
$("#userSelectionConfirmBtn")
.off()
.on("click", function () {
if (isInvite) {
let userIdList = jQuery
.makeArray($("#select_user_list .user_list").find(".userCheckBox"))
.map(function (e) {
return e.dataset.id;
});
// ユーザーの名前(login id)リスト。
let loginIdList = jQuery
.makeArray($("#select_user_list .user_list").find(".userCheckBox"))
.map(function (e) {
return e.dataset.name;
});
if (userIdList.length > 0 && loginIdList.length > 0) {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
socket.emit("inviteUsers", userIdList, loginIdList, function () {
$("#userSelectionDeleteBtn").hide();
$("#pills-chat-tab").tab("show");
});
}
} else {
if (
$("#select_user_list .user_list").find(".userCheckBox").length > 0
) {
// #36130に対応
const trimmedRoomName = $("#newRoomName").val().trim();
if (trimmedRoomName.length == 0) {
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
let userIdList = jQuery
.makeArray(
$("#select_user_list .user_list").find(".userCheckBox")
)
.map(function (e) {
return e.dataset.id;
});
let userNameList = jQuery
.makeArray(
$("#select_user_list .user_list").find(".userCheckBox")
)
.map(function (e) {
return e.dataset.name;
});
//TODO DB作業が終わったら自分のユーザ名を表示するかを判断し、修正予定。
// 参加ユーザ名でルーム名を生成
let newRoomName =
CHAT.globalLoginParameter.loginId + "," + userNameList.join(",");
// ルーム名のURIencodingを行う
//const encodedRoomName = encodeURIComponent(newRoomName);
NativeBridgeDelegate.createChatRoom(
ChatRoomType.DM,
userIdList.join(","),
newRoomName,
MakeRoomFlag.MAKE_ROOM,
false
);
} else if (
trimmedRoomName.includes(";") ||
trimmedRoomName.includes("/") ||
trimmedRoomName.includes("?") ||
trimmedRoomName.includes(":") ||
trimmedRoomName.includes("@") ||
trimmedRoomName.includes("&") ||
trimmedRoomName.includes("=") ||
trimmedRoomName.includes("+") ||
trimmedRoomName.includes("$") ||
trimmedRoomName.includes(",") ||
trimmedRoomName.includes("-") ||
trimmedRoomName.includes("_") ||
trimmedRoomName.includes(".") ||
trimmedRoomName.includes("!") ||
trimmedRoomName.includes("~") ||
trimmedRoomName.includes("*") ||
trimmedRoomName.includes("'") ||
trimmedRoomName.includes("(") ||
trimmedRoomName.includes(")") ||
trimmedRoomName.includes("#") ||
trimmedRoomName.includes("\\") ||
trimmedRoomName.includes('"') ||
trimmedRoomName.includes("`")
) {
// #36147
// #36174
$("#customAlertTitle").text(getLocalizedString("invalidCharacter"));
$("#customAlertOk").text(getLocalizedString("yesTitle"));
$("#customAlert")
.appendTo("body")
.modal({
backdrop: "static",
keyboard: false,
})
.on("click", "#customAlertOk", function (e) {});
} else if (trimmedRoomName.length > 20) {
// #36142
var inputText = $("#newRoomName").val().trim(); // #36142 文字列の前又は後の空白文字列を削除
// #36174
$("#customAlertTitle").text(getLocalizedString("nameTooLong"));
$("#customAlertOk").text(getLocalizedString("yesTitle"));
$("#customAlert")
.appendTo("body")
.modal({
backdrop: "static",
keyboard: false,
})
.on("click", "#customAlertOk", function (e) {
$("#newRoomName").val(
inputText.substr(0, $("#newRoomName").prop("maxlength"))
);
});
} else {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
let userIdList = jQuery
.makeArray(
$("#select_user_list .user_list").find(".userCheckBox")
)
.map(function (e) {
return e.dataset.id;
});
// ルーム名のtrimmingした後、URIencodingを行う
const encodedRoomName = encodeURIComponent(trimmedRoomName);
NativeBridgeDelegate.createChatRoom(
ChatRoomType.DM,
userIdList.join(","),
encodedRoomName,
MakeRoomFlag.MAKE_ROOM,
false
);
}
}
}
});
$("#userSelectionDeleteBtn").hide();
$("#userSelectionDeleteBtn")
.off()
.on("click", function () {
// #36174
$("#customConfirmTitle").text(getLocalizedString("memberDeleteTitle"));
$("#customConfirmOk").text(getLocalizedString("roomDelete"));
$("#customAlertCancel").text(getLocalizedString("cancelTitle"));
$("#customConfirm")
.appendTo("body")
.modal({
backdrop: "static",
keyboard: false,
})
.on("click", "#customConfirmOk", function (e) {
CHAT_UI.deleteButtonAction(isInvite);
});
});
};
CHAT_UI.deleteButtonAction = function (isInvite) {
//配列の整理
jQuery
.makeArray($("#select_user_list .user_list").find(".userCheckBox.active"))
.map(function (e) {
CHAT.globalSelectedUserList = CHAT.globalSelectedUserList.filter(
function (element) {
return e.dataset.name != element.loginId;
}
);
});
CHAT_UI.showConfirmView(isInvite);
$("#select_user_list .user_list").find(".userCheckBox").show();
};
var GetFileBlobUsingURL = function (url, convertBlob) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.responseType = "blob";
xhr.addEventListener("load", function () {
console.log(xhr.response);
convertBlob(xhr.response);
});
xhr.send();
};
var blobToFile = function (blob, name) {
blob.lastModifiedDate = new Date();
blob.name = name;
return blob;
};
var GetFileObjectFromURL = function (filePathOrUrl, convertBlob) {
GetFileBlobUsingURL(filePathOrUrl, function (blob) {
convertBlob(blobToFile(blob, "testFile.mp4"));
});
};
// this method call from android only for now
CHAT_UI.videoEncodeFail = function () {
alert(getLocalizedString("error_send_video"));
CHAT_UI.dismissLoadingIndicator();
};
// this method call from android only for now
CHAT_UI.videoEncodeEnd = function (encodedUri) {
var fileName = encodedUri.split("/")[encodedUri.split("/").length - 1];
var fileURL = "file:" + encodedUri;
......@@ -690,58 +224,9 @@ CHAT_UI.videoEncodeEnd = function (encodedUri) {
CHAT_UI.htmlElementTextInitialize = function (languageCode) {
moment.locale(languageCode);
setLanguage(languageCode);
$(".titleRoomName").text(getLocalizedString("roomListTitle"));
$("#message-form").attr(
"placeholder",
getLocalizedString("chat_placeholder")
);
$("#message-search").attr(
"placeholder",
getLocalizedString("chat_search_placeholder")
);
$("#exitRoom")
.text(getLocalizedString("exitRoom"))
.append("<i class='fas fa-door-open'></i>");
$("#participants").text(getLocalizedString("participants"));
//$("#fileUploadButton").text(getLocalizedString("photo"))
//$("#fileUploadButton2").text(getLocalizedString("video"))
$("#okayLabel").text(getLocalizedString("okayLabel"));
$("#completeLabel").text(getLocalizedString("completeLabel"));
$("#thankLabel").text(getLocalizedString("thankLabel"));
$("#startToWorkLabel").text(getLocalizedString("startToWorkLabel"));
$("#groupListKeyword").attr("placeholder", getLocalizedString("groupSearch"));
$("#contactListKeyword").attr(
"placeholder",
getLocalizedString("contactSearch")
);
$("#room-search").attr(
"placeholder",
$("#room-search").attr("placeholder") +
getLocalizedString("room_search_placeholder")
);
$("#userListKeyword").attr("placeholder", getLocalizedString("userSearch"));
$("#newRoomName").attr("placeholder", getLocalizedString("newRoomName"));
$("#dmBtn").text(getLocalizedString("directMessageChatRoom"));
$("#groupBtn").text(getLocalizedString("groupChatRoom"));
$("#myGroupBtn").text(getLocalizedString("myGroup"));
$("#allGroupBtn").text(getLocalizedString("allGroup"));
//$("#groupPathSeperator").text(getLocalizedString("groupPath"))
//$("#moveBtnSeperator").text(getLocalizedString("quickBtn"))
//$("#rootGroupBtn").text(getLocalizedString("returnToRootGroup"))
//$("#parentGroupBtn").text(getLocalizedString("returnToParentGroup"))
//$("#childGroupSeperator").text(getLocalizedString("childGroup"))
//$("#groupUserSeperator").text(getLocalizedString("groupUser"))
$("#favorite-seperator").text(getLocalizedString("favorite"));
$("#mygroup-seperator").text(getLocalizedString("mygroup"));
$(".ttl_archive").text(getLocalizedString("archive"));
$(".ttl_detail").text(getLocalizedString("detail"));
$("#archiveFileName").text(getLocalizedString("archiveFileName"));
$("#archiveInsertDate").text(getLocalizedString("archiveInsertDate"));
......@@ -1039,8 +524,6 @@ CHAT_UI.loadMessages = function (roomId, joinRoomName) {
CHAT_UI.waitForLoadingImage(jQueryMessages, CHAT_UI.scrollToBottom);
CHAT_UI.waitForLoadingVideo(jQueryMessages, CHAT_UI.scrollToBottom);
// ユーザ削除ボタン表示しない
$("#userSelectionDeleteBtn").hide();
if (CHAT_UTIL.isIOS()) {
$(window).on("load", function () {
......@@ -2172,6 +1655,7 @@ CHAT_UI.offlineHandler = function (e) {
e.preventDefault();
};
// for android call
CHAT_UI.displayExistRoom = function (roomId) {
if (confirm("error_already_exist_same_user")) {
NativeBridgeDelegate.joinRoom(roomId);
......
......@@ -18,7 +18,7 @@ var beforeScroll;
CHAT.saveRoomInfo = function (roomID, roomName) {
CHAT.globalLoginParameter.roomId = roomID;
CHAT.globalLoginParameter.roomName = roomName;
NativeBridgeDelegate.saveVisitRoomInfo(roomID, roomName)
NativeBridgeDelegate.saveVisitRoomInfo(roomID, roomName);
};
// #36170 画像パスが存在しない場合はデフォルトの画像を返す
......@@ -570,7 +570,10 @@ document.addEventListener("DOMContentLoaded", function () {
if (keyword.length == 1) {
return;
}
const messages = NativeBridgeDataSource.searchMessages(keyword, checkedUserList.join(","));
const messages = NativeBridgeDataSource.searchMessages(
keyword,
checkedUserList.join(",")
);
var userMessageTemplate = getTemplate(TemplateURL.USER_MESSAGE);
var myMessageTemplate = getTemplate(TemplateURL.MY_MESSAGE);
......@@ -716,7 +719,10 @@ CHAT.searchMessage = function (keyword, workVal) {
const selectedUser = $(".img_wrap.filter")[user];
checkedUserList.push($(selectedUser).data("user-id"));
});
var messages = NativeBridgeDataSource.searchMessages(keyword, checkedUserList.join(","));
var messages = NativeBridgeDataSource.searchMessages(
keyword,
checkedUserList.join(",")
);
var userMessageTemplate = getTemplate(TemplateURL.USER_MESSAGE);
var myMessageTemplate = getTemplate(TemplateURL.MY_MESSAGE);
......@@ -765,15 +771,16 @@ CHAT.searchMessage = function (keyword, workVal) {
};
// 下スクロールでユーザーリストを非表示
var startPos = 0,winScrollTop = 0;
$(window).on('scroll',function(){
winScrollTop = $(this).scrollTop();
if (winScrollTop >= startPos) {
if(winScrollTop >= 200){
$('#chat_room .user_list').addClass('hide');
}
} else {
$('#chat_room .user_list').removeClass('hide');
var startPos = 0;
var winScrollTop = 0;
$(window).on("scroll", function () {
winScrollTop = $(this).scrollTop();
if (winScrollTop >= startPos) {
if (winScrollTop >= 200) {
$("#chat_room .user_list").addClass("hide");
}
startPos = winScrollTop;
} else {
$("#chat_room .user_list").removeClass("hide");
}
startPos = winScrollTop;
});
......@@ -43,7 +43,7 @@ CHAT_MAKE_ROOM.searchUser = function (keyword) {
var userTemplate = getTemplate(TemplateURL.MAKE_ROOM_USER_LIST);
let html = renderUser(userTemplate, userList);
let obj = jQuery.parseHTML(html);
$(".overlay_src_msg").html(obj);
overlayMessage.html(obj);
hasNoData = userList.length == 0;
}
......
// ios用
function callNativeApp(iosKey, jsonData) {
console.log("callNativeApp called: "+iosKey);
console.log("callNativeApp called: " + iosKey);
var result;
try {
var key = iosKey;
......@@ -446,4 +446,4 @@ NativeBridgeDataSource.getHostRequestFlg = function () {
} else {
return android.getHostRequestFlg();
}
};
\ No newline at end of file
};
......@@ -2,8 +2,6 @@ $.lang.en = {
"chat_placeholder":"Type message",
"chat_search_placeholder":" Search Message",
"room_search_placeholder":" Search Room",
"participants":"Member List",
"exitRoom":"Exit ",
"roomListTitle":"Room List",
"deleteRoomTitle":"Delete Room",
"inviteUsersButton":"invite",
......@@ -21,18 +19,12 @@ $.lang.en = {
"orderByTime":"OrderByTime",
"orderByUnread":"OrderByUnread",
"roomKeywordPlaceHolder":"Search",
"okayLabel":"Okay!",
"completeLabel":"Complete.",
"thankLabel":"Thank you",
"startToWorkLabel":"Start to work",
"groupListKeyword":"Search",
"userSearch":"User Search",
"groupSearch":"Group Search",
"groupPageSubtitle":"Groups",
"noMessages":"No Messages",
"image":"Image",
"chatKeyword":"Search",
"userListKeyword":"Search",
"newRoomName":"Please input Room Name",
"everyoneIsHere":"Everyone is in the chat.",
"people":"people",
......
......@@ -2,8 +2,6 @@ $.lang.ja = {
"chat_placeholder":"メッセージを入力",
"chat_search_placeholder":" メッセージ検索",
"room_search_placeholder":" ルーム検索",
"participants":"メンバーリスト",
"exitRoom":"退出 ",
"roomListTitle":"チャット",
"deleteRoomTitle":"ルーム削除",
"inviteUsersButton":"招待",
......@@ -20,18 +18,12 @@ $.lang.ja = {
"orderByTime":"新着順",
"orderByUnread":"未読優先",
"roomKeywordPlaceHolder":"検索",
"okayLabel":"了解しました。",
"completeLabel":"完了しました。",
"thankLabel":"ありがとうございます。",
"startToWorkLabel":"作業開始します。",
"userSearch":"ユーザー検索",
"groupSearch":"グループ検索",
"groupListKeyword":"検索",
"groupPageSubtitle":"グループ",
"noMessages":"メッセージがありません。",
"image":"画像",
"chatKeyword":"検索",
"userListKeyword":"検索",
"invitedUser":"参加者",
"newRoomName":"ルーム名を入力してください",
"everyoneIsHere":"招待可能なメンバーがいません。",
......
......@@ -2,8 +2,6 @@ $.lang.ko = {
"chat_placeholder":"메시지를 입력하세요.",
"chat_search_placeholder":" 메세지검색",
"room_search_placeholder":" 채팅방 검색",
"participants":"멤버 리스트",
"exitRoom":"나가기 ",
"roomListTitle":"채팅 리스트",
"deleteRoomTitle":"채팅방 삭제",
"inviteUsersButton":"유저 초대",
......@@ -21,18 +19,12 @@ $.lang.ko = {
"orderByTime":"최신순",
"orderByUnread":"안 읽은 순",
"roomKeywordPlaceHolder":"검색",
"okayLabel":"알겠습니다.",
"completeLabel":"작업이 끝났습니다.",
"thankLabel":"감사합니다.",
"startToWorkLabel":"작업을 시작합니다.",
"groupListKeyword":"검색",
"userSearch":"유저 검색",
"groupSearch":"그룹 검색",
"groupPageSubtitle":"그룹",
"noMessages":"메시지가 없습니다.",
"image":"이미지",
"chatKeyword":"검색",
"userListKeyword":"검색",
"newRoomName":"방 이름을 입력해주세요.",
"everyoneIsHere":"초대가능한 유저가 없습니다.",
"people":"명",
......
......@@ -3,7 +3,7 @@ var bindOnRefreshGroupList = function () {
socket.on(SOCKET_KEY.REFRESH_GROUPLIST, function (groups, isInvite) {
const groupListElement = $("#group_list");
groupListElement.html("");
const template = $("#group-template").html();
if (groups.length === 0) {
groupListElement.append(
'<center class="text-secondary">' +
......@@ -12,92 +12,10 @@ var bindOnRefreshGroupList = function () {
);
}
addGroupNameAndNumberOfUsers(groups);
// Rotate
handleRotate();
updateTopBar();
// Set Title
updateTopBar(isInvite);
updateUserSelectionLength();
setupBackButton();
});
};
var addGroupNameAndNumberOfUsers = function (groups) {
// グループ名と人数を表記する。
groups.forEach(function (group) {
let html = Mustache.render(template, {
name: group.groupName,
info: group.memberCnt + getLocalizedString("people"),
});
// グループをクリックすると、該当グループのユーザーリストを読み込むようにイベントを与える
let obj = $(jQuery.parseHTML(html)).on("click", function () {
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
socket.emit("getUserListInGroup", group.groupId, isInvite);
$("#groupName").text(group.groupName);
});
groupListElement.append(obj);
});
};
var handleRotate = function () {
if (CHAT_UI.isLandscapeMode()) {
$(".group_list").addClass("col-6").removeClass("col-12");
}
};
var setupBackButton = function () {
const backButton = $("#backButton");
backButton.show();
backButton.off().on("click", function () {
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
if (isInvite) {
$("#pills-chat-tab").tab("show");
} else {
if (IS_ONLINE == "true") {
// todo: peacekim:: needs to check it only needs for android or not.
NativeBridgeDelegate.updateRoomList();
CHAT_UI.refreshRoomList(ChatRoomType.DM);
CHAT_UI.dismissLoadingIndicator();
}
}
});
};
var updateUserSelectionLength = function () {
const userSelectionLength = $("#userSelectionLength");
if (CHAT.globalSelectedUserList.length > 0) {
userSelectionLength.text(CHAT.globalSelectedUserList.length);
} else {
userSelectionLength.text("");
}
};
var updateTopBar = function (isInvite) {
// Set Title
let memberSelectTitle = getLocalizedString("groupSearch");
$("#pills-group-tab").tab("show");
const titleRoomName = $(".titleRoomName");
const userSelectionConfirmButton = $("#userSelectionConfirmBtn");
titleRoomName.text(memberSelectTitle);
if (isInvite) {
$("#newRoomName, .roomListIcon, .chatRoomIcon").hide();
} else {
$(".roomListIcon, .chatRoomIcon, #newRoomName").hide();
}
userSelectionConfirmButton.show();
userSelectionConfirmButton.off().on("click", function () {
CHAT_UI.setConfirmButtonEvent(isInvite);
});
var updateTopBar = function () {
$("#newRoomName").hide();
};
var bindOnRefreshUserListInGroup = function () {
// Update User List(Invite)
// #36170
socket.on(
SOCKET_KEY.REFRESH_USERLIST_INGROUP,
function (users, groupId, isInvite) {
$("#user_list").html("");
// Set Title
updateTitle();
addUserList(users);
// Rotate
handleRotateOnUserListInGroup();
setupBackButtonOnUserListInGroup(isInvite);
setupUserSelectionConfirmButton(isInvite);
updateUIOnUserListInGroup();
}
);
};
var updateTitle = function () {
let memberSelectTitle = getLocalizedString("userSearch");
$(".titleRoomName").text(memberSelectTitle);
};
var addUserList = function (users) {
users.forEach(function (user) {
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
user.profileImagePath = CHAT.getProfileImgUrl(user.profileImagePath);
// クリックするとactive クラスを与え、チェック表示を出させる。
let obj = activateCheckUser(
user.loginId,
user.shopMemberId,
user.profileImagePath
);
let findObj = CHAT.globalSelectedUserList.find(function (selectedUser) {
return selectedUser.loginId == user.loginId;
});
if (findObj) {
$(obj).find(".userCheckBox").toggleClass("active");
}
$("#user_list").append(obj);
});
};
var renderUser = function (template, userID, profileImagePath, userName) {
return Mustache.render(template, {
id: userID,
profileImage: profileImagePath,
name: userName,
});
};
var activateCheckUser = function (loginID, shopMemberID, profileImagePath) {
const template = $("#user-template").html();
let html = renderUser(template, shopMemberID, profileImagePath, loginID);
return $(jQuery.parseHTML(html)).on("click", function () {
if ($(this).find(".userCheckBox.active").length > 0) {
// remove
CHAT.globalSelectedUserList = filterRemovedUser(loginID);
} else {
// add
addSelectedUser(loginID, shopMemberID, profileImagePath);
}
$(this).find(".userCheckBox").toggleClass("active");
updateUserSelectionLength();
});
};
var filterRemovedUser = function (userID) {
return CHAT.globalSelectedUserList.filter(function (element) {
return userID != element.loginId;
});
};
var addSelectedUser = function (loginID, shopMemberID, profileImagePath) {
CHAT.globalSelectedUserList.push({
loginId: loginID,
shopMemberId: shopMemberID,
profileImagePath: profileImagePath,
});
};
var handleRotateOnUserListInGroup = function () {
if (CHAT_UI.isLandscapeMode()) {
$(".user_list").addClass("col-6").removeClass("col-12");
$(".squareBoxContent span").addClass("landscape_span");
}
};
var setupBackButtonOnUserListInGroup = function (isInvite) {
const backButton = $("#backButton");
backButton.off().on("click", function () {
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
socket.emit("getGroupList", isInvite);
});
backButton.show();
};
var setupUserSelectionConfirmButton = function (isInvite) {
const userSelectionConfirmButton = $("#userSelectionConfirmBtn");
userSelectionConfirmButton.off().on("click", function () {
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
CHAT_UI.setConfirmButtonEvent(isInvite);
});
userSelectionConfirmButton.show();
};
var updateUIOnUserListInGroup = function () {
$(".roomListIcon, .chatRoomIcon").hide();
$(".userCheckBox").show();
$("#pills-user-tab").tab("show");
};
......@@ -135,8 +135,6 @@ var emitJoin = function () {
return;
}
updateRoomName(params.roomName);
// loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
});
......@@ -157,12 +155,13 @@ var errorHandlingForEmitJoin = function () {
.on("click", "#customAlertOk", function (e) {});
};
var updateRoomName = function (roomName) {
const titleRoomName = $(".titleRoomName");
if (roomName != undefined) {
titleRoomName.text(roomName).data("roomName", roomName);
} else {
let roomListTitle = getLocalizedString("roomListTitle");
titleRoomName.text(roomListTitle);
}
var bindOnRefreshUserListInGroup = function () {
// Update User List(Invite)
// #36170
socket.on(
SOCKET_KEY.REFRESH_USERLIST_INGROUP,
function (users, groupId, isInvite) {
console.log(SOCKET_KEY.REFRESH_USERLIST_INGROUP + "message received but it does nothing.");
}
);
};
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