Commit 2c37e8b7 by Lee Munkyeong

Merge branch 'develop' of gitlab.agentec.jp:abookCommunication/chat_webview into…

Merge branch 'develop' of gitlab.agentec.jp:abookCommunication/chat_webview into feature/performance_improvement

# Conflicts:
#	public_new/js/chat-ui.js
parents a81b63fd 32e4f774
......@@ -108,6 +108,7 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script id="archive-template" type="text/template">
<li class="d-flex align-items-center">
......
......@@ -82,6 +82,7 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script id="archive-detail-template" type="text/template">
<div id="archive_player" class="player">
......
......@@ -115,6 +115,7 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script>
String.prototype.replaceAll = function(org, dest) {
return this.split(org).join(dest);
......@@ -142,7 +143,7 @@
IS_MOBILE = isMobile;
IS_ONLINE = isOnline;
console.log("onChat");
CHAT_UI.refreshRoomList(chatRoomType.GROUP);
CHAT_UI.refreshRoomList(ChatRoomType.GROUP);
CHAT_UI.dismissLoadingIndicator();
};
</script>
......
......@@ -142,6 +142,7 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script src="./js/chat-add-user.js"></script>
<script>
String.prototype.replaceAll = function(org, dest) {
......
......@@ -75,6 +75,7 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script>
String.prototype.replaceAll = function(org, dest) {
return this.split(org).join(dest);
......
......@@ -41,16 +41,19 @@
<!-- コンテンツ -->
<main id="chat_change_room_name">
<!-- ルーム名入力 -->
<div class="room_name">
<label for="room_name"><h2>ルーム名</h2></label>
<input type="text" class="input_name_room" name="room_name" placeholder="ルーム名を入力してください" id="roomNameInput" maxlength="20">
</div>
<!-- ルーム名入力 -->
<div class="room_name">
<label for="room_name">
<h2>ルーム名</h2>
</label>
<input type="text" class="input_name_room" name="room_name" placeholder="ルーム名を入力してください" id="roomNameInput"
maxlength="20">
</div>
<!-- ルーム名変更ボタン -->
<div class="change_room_name_btn">
<button type="button" name="button" id="roomNameChangeBtn">保存</button>
</div>
<!-- ルーム名変更ボタン -->
<div class="change_room_name_btn">
<button type="button" name="button" id="roomNameChangeBtn">保存</button>
</div>
</main>
<div id="loadingArea"></div>
......@@ -72,10 +75,14 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script src="./js/chat-websocket.js"></script>
<script src="./js/chat-websocket-message.js"></script>
<script src="./js/chat-websocket-refresh-group-list.js"></script>
<script src="./js/chat-websocket-refresh-user-list-in-group.js"></script>
<script src="./js/chat-room.js"></script>
<script>
String.prototype.replaceAll = function(org, dest) {
String.prototype.replaceAll = function (org, dest) {
return this.split(org).join(dest);
}
let CHAT_SERVER_URL = '';
......@@ -86,7 +93,7 @@
let IS_ONLINE = false;
let roomId = 0;
$("#loadingArea").load("./loading.html");
if (typeof(android) != "undefined") {
if (typeof (android) != "undefined") {
android.getLoginParameter();
android.getGlobalParameter();
} else {
......
......@@ -144,6 +144,7 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script>
String.prototype.replaceAll = function(org, dest) {
return this.split(org).join(dest);
......
......@@ -80,6 +80,7 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script>
String.prototype.replaceAll = function(org, dest) {
return this.split(org).join(dest);
......
......@@ -44,7 +44,8 @@
<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" id="roomMenu" class="none"><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 -->
......@@ -94,8 +95,10 @@
<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="メッセージを入力してください" maxlength="600">
<button type="button" name="button" class="message_input_send none" id="messageSend" onclick="CHAT_UI.sendMessage(this);">送信</button>
<input type="text" name="message" class="message_input_form" id="messageInput" placeholder="メッセージを入力してください"
maxlength="600">
<button type="button" name="button" class="message_input_send none" id="messageSend"
onclick="CHAT_UI.sendMessage(this);">送信</button>
</div>
</div>
<!-- フッター下 -->
......@@ -160,7 +163,11 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script src="./js/chat-websocket.js"></script>
<script src="./js/chat-websocket-message.js"></script>
<script src="./js/chat-websocket-refresh-group-list.js"></script>
<script src="./js/chat-websocket-refresh-user-list-in-group.js"></script>
<script src="./js/chat-room.js"></script>
<script>
function imageModal(image) {
......@@ -168,7 +175,7 @@
$('#pictureModalCenter').modal('show');
}
String.prototype.replaceAll = function(org, dest) {
String.prototype.replaceAll = function (org, dest) {
return this.split(org).join(dest);
}
......@@ -183,7 +190,7 @@
$("#chatMenuModal").load("./modal_chat_menu.html");
$("#loadingArea").load("./loading.html");
if (typeof(android) != "undefined") {
if (typeof (android) != "undefined") {
android.getLoginParameter();
android.getGlobalParameter();
android.saveSelectedUserList("");
......@@ -205,4 +212,4 @@
</script>
</body>
</html>
</html>
\ No newline at end of file
......@@ -27,10 +27,12 @@
</div>
<div class="collabo_nav_r">
<div class="text-right d-flex align-items-center">
<button type="button" name="button" class="btn user_btn collaboration_contents picture_contents video_contents board_contents"></button>
<button type="button" name="button"
class="btn user_btn collaboration_contents picture_contents video_contents board_contents"></button>
<button type="button" name="button" class="btn add_user_btn none"></button>
<button type="button" name="button" class="btn menu_btn host_contents"></button>
<button type="button" name="button" class="btn start_pip_btn collaboration_contents document_contents" onclick="startPipMode();"></button>
<button type="button" name="button" class="btn start_pip_btn collaboration_contents document_contents"
onclick="startPipMode();"></button>
<!-- <button type="button" name="button" class="btn exit_btn" onclick="Coview_exitCollaboration();"></button> -->
</div>
</div>
......@@ -57,7 +59,7 @@
<!-- ユーザー追加オーバーレイ -->
<div id="add_user_list"></div>
<div id="modal_add_user_confirm" ></div>
<div id="modal_add_user_confirm"></div>
<!-- オーバーレイ メニュー -->
<div id="collaboration_picture_overlay_menu"></div>
......@@ -169,11 +171,15 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script src="./js/language.js"></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_en.js" charset="UTF-8"></script>
<script src="./js/chat-websocket.js"></script>
<script src="./js/chat-websocket-message.js"></script>
<script src="./js/chat-websocket-refresh-group-list.js"></script>
<script src="./js/chat-websocket-refresh-user-list-in-group.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/share.js"></script>
<script>
......@@ -198,7 +204,7 @@
let joinMeetingId = 0;
let androidVersion = 0;
if (typeof(android) != "undefined") {
if (typeof (android) != "undefined") {
android.getLoginParameter();
android.getGlobalParameter();
roomType = android.getRoomType();
......@@ -208,12 +214,12 @@
roomType = CHAT_DB.getRoomType();
}
if (roomType == chatRoomType.DM) {
$('.add_user_btn').removeClass('none');
if (roomType == ChatRoomType.DM) {
$('.add_user_btn').removeClass('none');
}
function startPipMode() {
if (typeof(android) != "undefined") {
if (typeof (android) != "undefined") {
android.startPipMode();
} else {
webkit.messageHandlers.startPipMode.postMessage({});
......@@ -226,7 +232,7 @@
}
}
String.prototype.replaceAll = function(org, dest) {
String.prototype.replaceAll = function (org, dest) {
return this.split(org).join(dest);
}
......@@ -253,10 +259,11 @@
globalUserInfo.coWorkType = CHAT_UTIL.getCoviewTypeFromCollaborationType(joinCollaborationType);
if (collaborationJoinFlg != '2') {
CHAT_SOCKET.connectSocket();
socket.emit('join', CHAT.globalLoginParameter, function() {
socket.emit('join', CHAT.globalLoginParameter, function () {
});
}
};
</script>
</body>
</html>
\ No newline at end of file
......@@ -5,7 +5,7 @@
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1, user-scalable=0">
content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1, user-scalable=0">
<title>LiveTaskyell</title>
<link rel="stylesheet" href="./css/notosansjp.css">
<link href="./fontawesome/css/all.css" rel="stylesheet">
......@@ -20,78 +20,82 @@
</head>
<body>
<!-- ナビメニュー -->
<header id="collabo_header">
<div class="d-flex align-items-center h-100">
<div class="collabo_nav_l text-left w-100">
</div>
<div class="collabo_nav_r">
<div class="text-right d-flex align-items-center">
<button type="button" name="button" class="btn add_user_btn"></button>
<button type="button" name="button" class="btn menu_btn"></button>
<button type="button" name="button" class="btn start_pip_btn" onclick="startPipMode();"></button>
<!-- ナビメニュー -->
<header id="collabo_header">
<div class="d-flex align-items-center h-100">
<div class="collabo_nav_l text-left w-100">
</div>
<div class="collabo_nav_r">
<div class="text-right d-flex align-items-center">
<button type="button" name="button" class="btn add_user_btn"></button>
<button type="button" name="button" class="btn menu_btn"></button>
<button type="button" name="button" class="btn start_pip_btn" onclick="startPipMode();"></button>
</div>
</div>
</div>
</div>
</header><!-- header -->
</header><!-- header -->
<!-- コンテンツ -->
<main id="collabo_main" class="none">
<div class="document_wrap">
<div class="coview_share_body coview_share_area" id="coviewShare" style="z-index: 1;">
<!-- コンテンツ -->
<main id="collabo_main" class="none">
<div class="document_wrap">
<div class="coview_share_body coview_share_area" id="coviewShare" style="z-index: 1;">
</div>
</div>
</div>
</main>
</main>
<!-- オーバーレイ メニュー -->
<div id="collaboration_voice_overlay_menu"></div>
<!-- オーバーレイ ユーザーリスト -->
<div id="overlay_user_list" class="overlay slidein" style="z-index: 3;">
<div id="collaboration_overlay_user_list"></div>
</div>
<!-- オーバーレイ メニュー -->
<div id="collaboration_voice_overlay_menu"></div>
<!-- オーバーレイ ユーザーリスト -->
<div id="overlay_user_list" class="overlay slidein" style="z-index: 3;">
<div id="collaboration_overlay_user_list"></div>
</div>
<!-- プロフィールモーダル -->
<div id="userProfileModalInCollaboration"></div>
<div id="modal_collabo_profile2"></div>
<div id="add_user_list" ></div>
<div id="modal_add_user_confirm" ></div>
<!-- ホスト変更モーダル -->
<div id="modal_collabo_change_host"></div>
<!-- プロフィールモーダル -->
<div id="userProfileModalInCollaboration"></div>
<div id="modal_collabo_profile2"></div>
<div id="add_user_list"></div>
<div id="modal_add_user_confirm"></div>
<!-- ホスト変更モーダル -->
<div id="modal_collabo_change_host"></div>
<!-- ホストリクエストモーダル -->
<div id="modal_collabo_host_request"></div>
<!-- ホストリクエストモーダル -->
<div id="modal_collabo_host_request"></div>
<!-- フッター -->
<div id="footer_collabo"></div>
<div id="loadingArea"></div>
<div class="pip_indicator none" onclick="finishPipMode();">
<div style="vertical-align: middle;display: table-cell;">協業中
<!-- フッター -->
<div id="footer_collabo"></div>
<div id="loadingArea"></div>
<div class="pip_indicator none" onclick="finishPipMode();">
<div style="vertical-align: middle;display: table-cell;">協業中
</div>
</div>
</div>
<script src="./js/libs/jquery-3.3.1.min.js"></script>
<script src="./js/libs/socket.io.js"></script>
<script src="./js/libs/moment.js"></script>
<script src="./js/libs/locale/ko.js" charset="UTF-8"></script>
<script src="./js/libs/locale/ja.js" charset="UTF-8"></script>
<script src="./js/libs/mustache.min.js"></script>
<script src="./js/libs/bootstrap.min.js"></script>
<script src="./js/libs/jquery.mark.min.js"></script>
<script src="./js/constant.js"></script>
<script src="./js/collaboration.js"></script>
<script src="./js/common.js"></script>
<script src="./js/loading.js"></script>
<script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/language.js"></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_en.js" charset="UTF-8"></script>
<script src="./js/chat-websocket.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/share.js"></script>
<script>
<script src="./js/libs/jquery-3.3.1.min.js"></script>
<script src="./js/libs/socket.io.js"></script>
<script src="./js/libs/moment.js"></script>
<script src="./js/libs/locale/ko.js" charset="UTF-8"></script>
<script src="./js/libs/locale/ja.js" charset="UTF-8"></script>
<script src="./js/libs/mustache.min.js"></script>
<script src="./js/libs/bootstrap.min.js"></script>
<script src="./js/libs/jquery.mark.min.js"></script>
<script src="./js/constant.js"></script>
<script src="./js/collaboration.js"></script>
<script src="./js/common.js"></script>
<script src="./js/loading.js"></script>
<script src="./js/chat.js"></script>
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script src="./js/language.js"></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_en.js" charset="UTF-8"></script>
<script src="./js/chat-websocket.js"></script>
<script src="./js/chat-websocket-message.js"></script>
<script src="./js/chat-websocket-refresh-group-list.js"></script>
<script src="./js/chat-websocket-refresh-user-list-in-group.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/share.js"></script>
<script>
$("#footer_collabo").load("./footer_collabo.html");
$("#modal_collabo_host_request").load("./modal_collabo_host_request.html");
$("#modal_collabo_change_host").load("./modal_collabo_change_host.html");
......@@ -109,7 +113,7 @@
let IS_ONLINE = false;
let collaborationJoinFlg = 0;
if (typeof(android) != "undefined") {
if (typeof (android) != "undefined") {
android.getLoginParameter();
android.getGlobalParameter();
} else {
......@@ -118,7 +122,7 @@
}
function startPipMode() {
if (typeof(android) != "undefined") {
if (typeof (android) != "undefined") {
android.startPipMode();
} else if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.startPipMode.postMessage({});
......@@ -142,9 +146,9 @@
} else if (CHAT_UTIL.isAndroid()) {
collaborationJoinFlg = android.getCollaborationJoinFlg();
}
globalUserInfo.coWorkType = collaborationTypeKey.DOCUMENT;
globalUserInfo.coWorkType = CollaborationTypeKey.DOCUMENT;
CHAT_SOCKET.connectSocket();
socket.emit('join', CHAT.globalLoginParameter, function() {
socket.emit('join', CHAT.globalLoginParameter, function () {
});
};
......
......@@ -55,7 +55,7 @@
<!-- ユーザー追加オーバーレイ -->
<div id="add_user_list"></div>
<div id="modal_add_user_confirm" ></div>
<div id="modal_add_user_confirm"></div>
<!-- オーバーレイ メニュー -->
<div id="collaboration_picture_overlay_menu"></div>
......@@ -144,11 +144,15 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script src="./js/language.js"></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_en.js" charset="UTF-8"></script>
<script src="./js/chat-websocket.js"></script>
<script src="./js/chat-websocket-message.js"></script>
<script src="./js/chat-websocket-refresh-group-list.js"></script>
<script src="./js/chat-websocket-refresh-user-list-in-group.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/share.js"></script>
<script>
......@@ -170,7 +174,7 @@
let collaborationJoinFlg = 0;
let roomType;
if (typeof(android) != "undefined") {
if (typeof (android) != "undefined") {
android.getLoginParameter();
android.getGlobalParameter();
roomType = android.getRoomType();
......@@ -180,8 +184,8 @@
roomType = CHAT_DB.getRoomType();
}
if (roomType == chatRoomType.DM) {
$('.add_user_btn').removeClass('none');
if (roomType == ChatRoomType.DM) {
$('.add_user_btn').removeClass('none');
}
async function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
......@@ -196,13 +200,14 @@
collaborationJoinFlg = android.getCollaborationJoinFlg();
console.log(collaborationJoinFlg);
}
globalUserInfo.coWorkType = collaborationTypeKey.CAMERA;
globalUserInfo.coWorkType = CollaborationTypeKey.CAMERA;
if (collaborationJoinFlg != '2') {
CHAT_SOCKET.connectSocket();
socket.emit('join', CHAT.globalLoginParameter, function() {
socket.emit('join', CHAT.globalLoginParameter, function () {
});
}
};
</script>
</body>
</html>
</html>
\ No newline at end of file
......@@ -54,7 +54,7 @@
<!-- ユーザー追加オーバーレイ -->
<div id="add_user_list"></div>
<div id="modal_add_user_confirm" ></div>
<div id="modal_add_user_confirm"></div>
<!-- オーバーレイ メニュー -->
<div id="collaboration_video_overlay_menu"></div>
......@@ -102,7 +102,7 @@
</div>
<div class="d-flex align-items-center h-100">
<div class="footer_menu_item">
<!-- <a href="#" data-toggle="modal" data-target="#captyaModal">-->
<!-- <a href="#" data-toggle="modal" data-target="#captyaModal">-->
<a href="#">
<div class="img_wrap wide bg_blue" id="captureBtn">
<img src="icon/icon_collabo_capture.png" alt="キャプチャ">
......@@ -131,65 +131,70 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script src="./js/language.js"></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_en.js" charset="UTF-8"></script>
<script src="./js/chat-websocket.js"></script>
<script src="./js/chat-websocket-message.js"></script>
<script src="./js/chat-websocket-refresh-group-list.js"></script>
<script src="./js/chat-websocket-refresh-user-list-in-group.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/share.js"></script>
</body>
<script>
$("#footer_collabo").load("./footer_collabo.html");
$("#modal_collabo_host_request").load("./modal_collabo_host_request.html");
$("#modal_collabo_change_host").load("./modal_collabo_change_host.html");
$("#modal_collabo_capture").load("./modal_collabo_capture.html");
$("#modal_collabo_profile2").load("./modal_collabo_profile2.html");
$("#collaboration_video_overlay_menu").load("./collaboration_video_overlay_menu.html");
$("#add_user_list").load("./modal_add_user_list.html");
$("#zoom").load("./zoom.html");
$("#footer_collabo").load("./footer_collabo.html");
$("#modal_collabo_host_request").load("./modal_collabo_host_request.html");
$("#modal_collabo_change_host").load("./modal_collabo_change_host.html");
$("#modal_collabo_capture").load("./modal_collabo_capture.html");
$("#modal_collabo_profile2").load("./modal_collabo_profile2.html");
$("#collaboration_video_overlay_menu").load("./collaboration_video_overlay_menu.html");
$("#add_user_list").load("./modal_add_user_list.html");
$("#zoom").load("./zoom.html");
let CHAT_SERVER_URL = '';
let CMS_SERVER_URL = '';
let ASSET_PATH = './';
let PLATFORM = '';
let IS_MOBILE = true;
let IS_ONLINE = false;
let collaborationJoinFlg = 0;
let roomType;
let CHAT_SERVER_URL = '';
let CMS_SERVER_URL = '';
let ASSET_PATH = './';
let PLATFORM = '';
let IS_MOBILE = true;
let IS_ONLINE = false;
let collaborationJoinFlg = 0;
let roomType;
if (typeof(android) != "undefined") {
android.getLoginParameter();
android.getGlobalParameter();
roomType = android.getRoomType();
} else {
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({});
webkit.messageHandlers.getGlobalParameter.postMessage({});
roomType = CHAT_DB.getRoomType();
}
if (typeof (android) != "undefined") {
android.getLoginParameter();
android.getGlobalParameter();
roomType = android.getRoomType();
} else {
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({});
webkit.messageHandlers.getGlobalParameter.postMessage({});
roomType = CHAT_DB.getRoomType();
}
if (roomType == ChatRoomType.DM) {
$('.add_user_btn').removeClass('none');
}
if (roomType == chatRoomType.DM) {
$('.add_user_btn').removeClass('none');
async function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl;
CMS_SERVER_URL = cmsServerUrl;
PLATFORM = platform;
IS_MOBILE = isMobile;
IS_ONLINE = isOnline;
if (CHAT_UTIL.isIOS()) {
collaborationJoinFlg = CHAT_DB.getCollaborationJoinFlg();
} else if (CHAT_UTIL.isAndroid()) {
collaborationJoinFlg = android.getCollaborationJoinFlg();
console.log(collaborationJoinFlg);
}
globalUserInfo.coWorkType = CollaborationTypeKey.VIDEO;
if (collaborationJoinFlg != '2') {
CHAT_SOCKET.connectSocket();
socket.emit('join', CHAT.globalLoginParameter, function () {
});
}
};
</script>
async function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
CHAT_SERVER_URL = chatServerUrl;
CMS_SERVER_URL = cmsServerUrl;
PLATFORM = platform;
IS_MOBILE = isMobile;
IS_ONLINE = isOnline;
if (CHAT_UTIL.isIOS()) {
collaborationJoinFlg = CHAT_DB.getCollaborationJoinFlg();
} else if (CHAT_UTIL.isAndroid()) {
collaborationJoinFlg = android.getCollaborationJoinFlg();
console.log(collaborationJoinFlg);
}
globalUserInfo.coWorkType = collaborationTypeKey.VIDEO;
if (collaborationJoinFlg != '2') {
CHAT_SOCKET.connectSocket();
socket.emit('join', CHAT.globalLoginParameter, function() {
});
}
};
</script>
</html>
\ No newline at end of file
......@@ -54,7 +54,7 @@
<div id="userProfileModalInCollaboration"></div>
<div id="modal_collabo_profile2"></div>
<!-- ユーザー追加オーバーレイ -->
<div id="add_user_list" ></div>
<div id="add_user_list"></div>
<div id="modal_add_user_confirm"></div>
<!-- ホスト変更モーダル -->
<div id="modal_collabo_change_host"></div>
......@@ -78,11 +78,15 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script src="./js/language.js"></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_en.js" charset="UTF-8"></script>
<script src="./js/chat-websocket.js"></script>
<script src="./js/chat-websocket-message.js"></script>
<script src="./js/chat-websocket-refresh-group-list.js"></script>
<script src="./js/chat-websocket-refresh-user-list-in-group.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/share.js"></script>
<script>
......@@ -103,7 +107,7 @@
let collaborationJoinFlg = 0;
let roomType;
if (typeof(android) != "undefined") {
if (typeof (android) != "undefined") {
android.getLoginParameter();
android.getGlobalParameter();
roomType = android.getRoomType();
......@@ -113,8 +117,8 @@
roomType = CHAT_DB.getRoomType();
}
if (roomType == chatRoomType.DM) {
$('.add_user_btn').removeClass('none');
if (roomType == ChatRoomType.DM) {
$('.add_user_btn').removeClass('none');
}
async function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
......@@ -129,10 +133,10 @@
collaborationJoinFlg = android.getCollaborationJoinFlg();
console.log(collaborationJoinFlg);
}
globalUserInfo.coWorkType = collaborationTypeKey.AUDIO;
globalUserInfo.coWorkType = CollaborationTypeKey.AUDIO;
if (collaborationJoinFlg != '2') {
CHAT_SOCKET.connectSocket();
socket.emit('join', CHAT.globalLoginParameter, function() {
socket.emit('join', CHAT.globalLoginParameter, function () {
});
}
};
......
......@@ -54,7 +54,7 @@
<!-- ユーザー追加オーバーレイ -->
<div id="add_user_list"></div>
<div id="modal_add_user_confirm" ></div>
<div id="modal_add_user_confirm"></div>
<!-- オーバーレイ メニュー -->
<div id="collaboration_picture_overlay_menu"></div>
......@@ -136,11 +136,15 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script src="./js/language.js"></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_en.js" charset="UTF-8"></script>
<script src="./js/chat-websocket.js"></script>
<script src="./js/chat-websocket-message.js"></script>
<script src="./js/chat-websocket-refresh-group-list.js"></script>
<script src="./js/chat-websocket-refresh-user-list-in-group.js"></script>
<script src="https://biztaskyell.abookcloud.com/coview_api.js"></script>
<script src="./js/share.js"></script>
<script>
......@@ -162,7 +166,7 @@
let collaborationJoinFlg = 0;
let roomType;
if (typeof(android) != "undefined") {
if (typeof (android) != "undefined") {
android.getLoginParameter();
android.getGlobalParameter();
roomType = android.getRoomType();
......@@ -172,8 +176,8 @@
roomType = CHAT_DB.getRoomType();
}
if (roomType == chatRoomType.DM) {
$('.add_user_btn').removeClass('none');
if (roomType == ChatRoomType.DM) {
$('.add_user_btn').removeClass('none');
}
async function getGlobalParam(chatServerUrl, cmsServerUrl, platform, isMobile, isOnline) {
......@@ -187,10 +191,10 @@
} else if (CHAT_UTIL.isAndroid()) {
collaborationJoinFlg = android.getCollaborationJoinFlg();
}
globalUserInfo.coWorkType = collaborationTypeKey.BOARD;
globalUserInfo.coWorkType = CollaborationTypeKey.BOARD;
if (collaborationJoinFlg != '2') {
CHAT_SOCKET.connectSocket();
socket.emit('join', CHAT.globalLoginParameter, function() {
socket.emit('join', CHAT.globalLoginParameter, function () {
});
}
};
......
......@@ -191,6 +191,7 @@
<script src="./js/chat-ui.js"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-db-foriOS.js"></script>
<script>
String.prototype.replaceAll = function(org, dest) {
return this.split(org).join(dest);
......
// 名前空間
var ARCHIVE_UI = {};
$(function() {
document.addEventListener("DOMContentLoaded", function () {
// アーカイブ検索
$('#archive .search_form input[type="search"]').keyup(function(e) {
var keyword = $('#archive .search_form input[type="search"]').val();
if (e.KeyCode == 13 || e.key == "Enter") {
if (keyword.length != 0 && keyword != '') {
$('#archive .search_form input[type="search"]').blur();
return;
}
} else if (keyword == '' || keyword.length < 2) {
$('.overlay_src_msg').empty();
bindArchiveSearch();
// iOSキーボード変換検知用
bindiOSKeyBoardEvent();
});
ARCHIVE_UI.refreshSearchScreen = function (keyword) {
const archiveList = CHAT_DB.getArchiveByName(keyword);
const typeImage = getArchiveTypeIconURL(archive.archiveType);
getArchiveTemplate().then(function (archiveTemplate) {
archiveList.forEach(function (archive) {
let html = renderArchiveTemplate(
archiveTemplate,
archive.archiveId,
archive.archiveName,
archive.archiveDate,
typeImage
);
let obj = jQuery.parseHTML(html);
$(".overlay_src_msg").append(obj);
});
});
};
//* UTILS *//
const ARCHIVE_TYPE = {
PICTURE: 0,
VIDEO: 1,
VOICE: 2,
DOCUMENT: 3,
};
var getArchiveTypeIconURL = function (type) {
switch (type) {
case ARCHIVE_TYPE.PICTURE:
return "icon/icon_collabo_picture.png";
case ARCHIVE_TYPE.VIDEO:
return "icon/icon_collabo_videocam.png";
case ARCHIVE_TYPE.VOICE:
return "icon/icon_collabo_headset.png";
case ARCHIVE_TYPE.DOCUMENT:
return "icon/icon_collabo_document.png";
default:
return "";
}
};
var getArchiveTemplate = function () {
return new Promise(function (resolve, reject) {
$.get({ url: TemplateURL.ARCHIVE_LIST, async: false }, function (text) {
resolve(text);
});
});
};
var bindArchiveSearch = function () {
const searchInput = $('#archive .search_form input[type="search"]');
searchInput.keyup(function (e) {
var keyword = searchInput.val();
const enterKeyPressed = e.KeyCode == 13 || e.key == "Enter";
const keywordEmpty = keyword == "" || keyword.length < 2;
const keywordNotEmpty = keyword.length != 0 && keyword != "";
if (enterKeyPressed) {
if (keywordNotEmpty) {
searchInput.blur();
return;
}
} else if (keywordEmpty) {
$(".overlay_src_msg").empty();
return;
}
$('.overlay_src_msg').empty();
$(".overlay_src_msg").empty();
ARCHIVE_UI.refreshSearchScreen(keyword);
if (e.KeyCode == 13 || e.key == "Enter") {
$('#archive .search_form input[type="search"]').blur();
return;
if (enterKeyPressed) {
searchInput.blur();
return;
}
// 検索結果を表示
});
// iOSキーボード変換検知用
$('#archive .search_form input[type="search"]').on('compositionend', function() {
};
var bindiOSKeyBoardEvent = function () {
const searchInput = $('#archive .search_form input[type="search"]');
searchInput.on("compositionend", function () {
if (CHAT_UTIL.isIOS()) {
var keyword = $('#archive .search_form input[type="search"]').val();
$('.overlay_src_msg').empty();
var keyword = searchInput.val();
$(".overlay_src_msg").empty();
ARCHIVE_UI.refreshSearchScreen(keyword);
}
});
});
ARCHIVE_UI.refreshSearchScreen = function(keyword) {
var archiveList = CHAT_DB.getArchiveByName(keyword);
var archiveTemplate;
$.get({ url: "./template/template_archive_list.html", async: false }
, function(text) {
archiveTemplate = text;
});
archiveList.forEach(function(archive) {
var typeImage = "";
switch(archive.archiveType) {
case 0: // 画像
typeImage = "icon/icon_collabo_picture.png";
break;
case 1: // 動画
typeImage = "icon/icon_collabo_videocam.png";
break;
case 2: // 音声
typeImage = "icon/icon_collabo_headset.png";
break;
case 3: // 文書
typeImage = "icon/icon_collabo_document.png";
break;
default: // その他
typeImage = "";
}
};
let html = Mustache.render(archiveTemplate, {
archiveId: archive.archiveId,
fileName: archive.archiveName,
insertDate: archive.archiveDate,
typeImage: typeImage
});
let obj = jQuery.parseHTML(html);
$('.overlay_src_msg').append(obj);
var renderArchiveTemplate = function (
html,
archiveId,
archiveName,
archiveDate,
typeImageURL
) {
return Mustache.render(html, {
archiveId: archiveId,
fileName: archiveName,
insertDate: archiveDate,
typeImage: typeImageURL,
});
};
// 名前空間
var CHAT_ADD_USER = {};
$(function() {
document.addEventListener("DOMContentLoaded", function () {
// メンバー検索
$('#chat_add_user .search_form input[type="search"]').click(function(e){
//画面タイトル設定
let contactListTitle = getLocalizedString("userSearch");
$('#addUserTitle').text(contactListTitle);
})
$('#chat_add_user .search_form input[type="search"]').keyup(function(e){
var keyword = $('#chat_add_user .search_form input[type="search"]').val();
if (e.key == "Enter" || e.KeyCode == 13) {
if (keyword != '' && keyword.length != 0) {
$('#chat_add_user .search_form input[type="search"]').blur();
return false;
}
} else if (keyword == '' || keyword.length < 2) {
$('.overlay_src_msg').empty();
bindMemberSearch();
// iOSキーボード変換検知用
bindiOSKeyBoardEvent();
});
// ユーザー検索
CHAT_ADD_USER.searchUser = function (keyword) {
const isAllGroup = $("#tabAllGroupOnAddUser").is(":checked");
const overlayMessage = $(".overlay_src_msg");
let hasNoData = false;
overlayMessage.empty();
//全グループ検索画面
if (isAllGroup) {
//グループデータ検索
const groupList = CHAT_DB.getGroupByName(keyword);
searchGroupData(groupList);
//ユーザデータ検索
var userList = CHAT_DB.getAllGroupShopMemberNotInRoomByName(keyword);
searchUserData(userList);
hasNoData = userList.length == 0 && groupList.length == 0;
//連絡先画面
} else {
var userList = CHAT_DB.getMyGroupShopMemberNotInRoomByName(keyword);
searchUserData(userList);
hasNoData = userList.length == 0;
}
// Set NoResult
if (hasNoData) {
const noResultMessage = getNoResultMessage();
overlayMessage.append(noResultMessage);
}
};
/** UTILS */
var bindMemberSearch = function () {
const searchInput = $('#chat_add_user .search_form input[type="search"]');
searchInput.click(function (e) {
//画面タイトル設定
let contactListTitle = getLocalizedString("userSearch");
$("#addUserTitle").text(contactListTitle);
});
searchInput.keyup(function (e) {
const keyword = searchInput.val();
const enterKeyPressed = e.key == "Enter" || e.KeyCode == 13;
const keywordNotEmpty = keyword != "" && keyword.length != 0;
const keywordEmpty = keyword == "" || keyword.length < 2;
if (enterKeyPressed) {
if (keywordNotEmpty) {
searchInput.blur();
return false;
}
} else if (keywordEmpty) {
$(".overlay_src_msg").empty();
return false;
}
CHAT_ADD_USER.searchUser(keyword);
if (e.key == "Enter" || e.KeyCode == 13) {
$('#chat_add_user .search_form input[type="search"]').blur();
return;
if (enterKeyPressed) {
searchInput.blur();
return;
}
});
// iOSキーボード変換検知用
$('#chat_add_user .search_form input[type="search"]').on('compositionend', function() {
};
var bindiOSKeyBoardEvent = function () {
const searchInput = $('#chat_add_user .search_form input[type="search"]');
searchInput.on("compositionend", function () {
if (CHAT_UTIL.isIOS()) {
var keyword = $('#chat_add_user .search_form input[type="search"]').val();
CHAT_ADD_USER.searchUser(keyword);
var keyword = searchInput.val();
CHAT_ADD_USER.searchUser(keyword);
}
});
});
});
};
// ユーザー検索
CHAT_ADD_USER.searchUser = function(keyword) {
var isAllGroup = $('#tabAllGroupOnAddUser').is(':checked');
$('.overlay_src_msg').empty();
//全グループ検索画面
if (isAllGroup) {
//グループデータ検索
var groupList = CHAT_DB.getGroupByName(keyword);
var groupTemplate;
$.get({ url: "./template/template_make_room_group_list.html", async: false }
, function(text) {
groupTemplate = text;
});
groupList.forEach(function(group) {
let html = Mustache.render(groupTemplate, {
name: group.groupName,
id: group.groupId,
});
let obj = jQuery.parseHTML(html);
$('.overlay_src_msg').append(obj);
})
//ユーザデータ検索
var userList = CHAT_DB.getAllGroupShopMemberNotInRoomByName(keyword);
var userTemplate;
$.get({ url: "./template/template_make_room_user_list.html", async: false }
, function(text) {
userTemplate = text;
});
userList.forEach(function(user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
let findObj = CHAT.globalSelectedUserList.find(function(shopMemberId) {
return shopMemberId == user.shopMemberId;
})
if (findObj) {
user.checked = 'checked';
}
});
let html = Mustache.render(userTemplate, {
userList: userList
});
let obj = jQuery.parseHTML(html);
$('.overlay_src_msg').append(obj);
if (userList.length == 0 && groupList.length == 0) {
const noResultMsg = $('<div/>',{width:'auto', style:'text-align: center'});
noResultMsg.append(getLocalizedString("noResult"))
$('.overlay_src_msg').append(noResultMsg);
}
  //連絡先画面
} else {
var userList = CHAT_DB.getMyGroupShopMemberNotInRoomByName(keyword);
var userTemplate;
$.get({ url: "./template/template_make_room_user_list.html", async: false }
, function(text) {
userTemplate = text;
});
userList.forEach(function(user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
let findObj = CHAT.globalSelectedUserList.find(function(shopMemberId) {
return shopMemberId == user.shopMemberId;
})
if (findObj) {
user.checked = 'checked';
}
});
let html = Mustache.render(userTemplate, {
userList: userList
});
let obj = jQuery.parseHTML(html);
$('.overlay_src_msg').html(obj);
if (userList.length == 0) {
const noResultMsg = $('<div/>',{width:'auto', style:'text-align: center'});
noResultMsg.append(getLocalizedString("noResult"))
$('.overlay_src_msg').append(noResultMsg);
}
}
var searchGroupData = function (groupList) {
const groupTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_LIST);
groupList.forEach(function (group) {
let html = renderGroupTemplate(
groupTemplate,
group.groupName,
group.groupId
);
let obj = jQuery.parseHTML(html);
overlayMessage.append(obj);
});
};
var renderGroupTemplate = function (groupTemplate, groupName, groupID) {
return Mustache.render(groupTemplate, {
name: groupName,
id: groupID,
});
};
var searchUserData = function (userList) {
const userTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_LIST);
userList.forEach(function (user) {
setUserProfile(user);
checkUser(user);
});
let html = renderUserTemplate(userTemplate, userList);
let obj = jQuery.parseHTML(html);
overlayMessage.append(obj);
};
var setUserProfile = function (user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
};
var checkUser = function (user) {
let findObj = CHAT.globalSelectedUserList.find(function (shopMemberId) {
return shopMemberId == user.shopMemberId;
});
if (findObj) {
user.checked = "checked";
}
};
var renderUserTemplate = function (userTemplate, userList) {
return Mustache.render(userTemplate, {
userList: userList,
});
};
// ios用
function callNativeApp(iosKey, jsonData) {
console.log("callNativeApp called");
var result;
try {
var key = iosKey;
var data = jsonData;
var payload = { key: key, data: data };
// payloadの形 {"type":"SJbridge","data":{"name":"abc","role":"dev"}}
// resにObjective-cからのレスポンスが返る
result = prompt(JSON.stringify(payload));
console.log(result);
} catch (err) {
console.log("The native context does not exist yet");
}
return result;
}
CHAT_DB.getBeforeRoomType = function () {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return callNativeApp(NATIVE_KEY_IOS.getBeforeRoomType, {});
}
};
CHAT_DB.getRoomType = function () {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return parseInt(callNativeApp(NATIVE_KEY_IOS.getRoomType, {}), 10);
}
};
CHAT_DB.removeFavoriteUser = function (shopMemberId) {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
var result = callNativeApp(NATIVE_KEY_IOS.removeFavoriteUser, {
shopMemberId: shopMemberId,
});
if (result == "true") {
return true;
} else {
return false;
}
}
};
CHAT_DB.addFavoriteUser = function (shopMemberId) {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
var result = callNativeApp(NATIVE_KEY_IOS.addFavoriteUser, {
shopMemberId: shopMemberId,
});
if (result == "true") {
return true;
} else {
return false;
}
}
};
CHAT_DB.removeFavoriteGroup = function (groupId) {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
var result = callNativeApp(NATIVE_KEY_IOS.removeFavoriteGroup, {
groupId: groupId,
});
if (result == "true") {
return true;
} else {
return false;
}
}
};
CHAT_DB.addFavoriteGroup = function (groupId) {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
var result = callNativeApp(NATIVE_KEY_IOS.addFavoriteGroup, {
groupId: groupId,
});
if (result == "true") {
return true;
} else {
return false;
}
}
};
CHAT_DB.getCollaborationJoinFlg = function () {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return callNativeApp(NATIVE_KEY_IOS.getCollaborationJoinFlg, {});
}
};
CHAT_DB.getUserInfoList = function (shopMemberId) {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return callNativeApp(NATIVE_KEY_IOS.getUserInfoList, {
shopMemberId: shopMemberId,
});
}
};
CHAT_DB.createContentView = function () {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return parseInt(callNativeApp(NATIVE_KEY_IOS.createContentView, {}));
}
};
CHAT_DB.getToMoveGroupId = function () {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return callNativeApp(NATIVE_KEY_IOS.getToMoveGroupId, {});
}
};
CHAT_DB.getJoinCollaborationType = function () {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return parseInt(
callNativeApp(NATIVE_KEY_IOS.getJoinCollaborationType, {}),
10
);
}
};
CHAT_DB.getHostRequestFlg = function () {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return parseInt(callNativeApp(NATIVE_KEY_IOS.getHostRequestFlg, {}), 10);
}
};
// 名前空間
var CHAT_DB = {};
// ios用
function callNativeApp(iosKey, jsonData) {
console.log("callNativeApp called");
var result;
try {
var key = iosKey;
var data = jsonData;
var payload = {key: key, data: data};
// payloadの形 {"type":"SJbridge","data":{"name":"abc","role":"dev"}}
// resにObjective-cからのレスポンスが返る
result = prompt(JSON.stringify (payload));
console.log(result);
} catch(err) {
console.log('The native context does not exist yet');
}
return result;
}
includeJs("./js/chat-db-foriOS.js");
//ロカールDBからルーム一覧情報を取得
CHAT_DB.getRoomList = function(roomType, keyWord) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getRoomList", {"roomType": roomType, "keyWord": keyWord}));
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getRoomList(roomType, keyWord));
}
CHAT_DB.getRoomList = function (roomType, keyWord) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getRoomList, {
roomType: roomType,
keyWord: keyWord,
})
);
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getRoomList(roomType, keyWord));
}
};
CHAT_DB.callGetRoomList = function(roomType) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getRoomList", {"roomType": roomType}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getRoomList(roomType));
}
}
CHAT_DB.callGetRoomList = function (roomType) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getRoomList, { roomType: roomType })
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getRoomList(roomType));
}
};
//ロカールDBからログインしたユーザのデータを取得する。
CHAT_DB.getMyInfo = function() {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getMyInfo", {}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMyInfo());
}
CHAT_DB.getMyInfo = function () {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getMyInfo, {}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMyInfo());
}
};
CHAT_DB.getMessages = function(roomId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getMessages", {"roomId": roomId}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMessageList(roomId));
}
CHAT_DB.getMessages = function (roomId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getMessages, { roomId: roomId })
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMessageList(roomId));
}
};
CHAT_DB.getFavoriteUsersNotInRoom = function() {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getFavoriteUsersNotInRoom", {}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getFavoriteUsersNotInRoom());
}
CHAT_DB.getFavoriteUsersNotInRoom = function () {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getFavoriteUsersNotInRoom, {})
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getFavoriteUsersNotInRoom());
}
};
CHAT_DB.getFavoriteUsers = function() {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getFavoriteUsers", {}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getFavoriteUsers());
}
CHAT_DB.getFavoriteUsers = function () {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getFavoriteUsers, {}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getFavoriteUsers());
}
};
CHAT_DB.getFavoriteGroups = function() {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getFavoriteGroups", {}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getFavoriteGroups());
}
CHAT_DB.getFavoriteGroups = function () {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getFavoriteGroups, {}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getFavoriteGroups());
}
};
CHAT_DB.getMyGroupUsers = function() {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getMyGroupUsers", {}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMyGroupUsers());
}
CHAT_DB.getMyGroupUsers = function () {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getMyGroupUsers, {}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMyGroupUsers());
}
};
CHAT_DB.getGroupInfo = function(groupId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getGroupInfo", {"groupId": groupId}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getGroupInfo(groupId));
}
CHAT_DB.getGroupInfo = function (groupId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getGroupInfo, { groupId: groupId })
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getGroupInfo(groupId));
}
};
CHAT_DB.getGroupInfoForAddUser = function(groupId) {
CHAT_DB.getGroupInfoForAddUser = function (groupId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getGroupInfoForAddUser", {"groupId": groupId}));
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getGroupInfoForAddUser, { groupId: groupId })
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
//String形式をJsonに変更してReturn
return JSON.parse(android.getGroupInfoForAddUser(groupId));
}
};
CHAT_DB.loadSelectedUsers = function() {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getSelectedUserList", {}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
console.log(JSON.parse(android.getSelectedUserList()));
return JSON.parse(android.getSelectedUserList());
}
}
CHAT_DB.loadSelectedUsers = function () {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getSelectedUserList, {}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
console.log(JSON.parse(android.getSelectedUserList()));
return JSON.parse(android.getSelectedUserList());
}
};
CHAT_DB.getNameCardData = function(shopMemberId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getNameCardData", {"shopMemberId": shopMemberId}));
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getNameCardData(shopMemberId));
}
CHAT_DB.getNameCardData = function (shopMemberId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getNameCardData, {
shopMemberId: shopMemberId,
})
);
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getNameCardData(shopMemberId));
}
};
CHAT_DB.getMyGroupShopMemberByName = function(shopMemberName) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getMyGroupShopMemberByName", {"shopMemberName": shopMemberName}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMyGroupShopMemberByName(shopMemberName));
}
CHAT_DB.getMyGroupShopMemberByName = function (shopMemberName) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getMyGroupShopMemberByName, {
shopMemberName: shopMemberName,
})
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMyGroupShopMemberByName(shopMemberName));
}
};
CHAT_DB.getMyGroupShopMemberNotInRoomByName = function(shopMemberName) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getMyGroupShopMemberNotInRoomByName", {"shopMemberName": shopMemberName}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMyGroupShopMemberNotInRoomByName(shopMemberName));
}
CHAT_DB.getMyGroupShopMemberNotInRoomByName = function (shopMemberName) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getMyGroupShopMemberNotInRoomByName, {
shopMemberName: shopMemberName,
})
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(
android.getMyGroupShopMemberNotInRoomByName(shopMemberName)
);
}
};
CHAT_DB.getAllGroupShopMemberByName = function(shopMemberName) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getAllGroupShopMemberByName", {"shopMemberName": shopMemberName}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getAllGroupShopMemberByName(shopMemberName));
}
CHAT_DB.getAllGroupShopMemberByName = function (shopMemberName) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getAllGroupShopMemberByName, {
shopMemberName: shopMemberName,
})
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getAllGroupShopMemberByName(shopMemberName));
}
};
CHAT_DB.getAllGroupShopMemberNotInRoomByName = function(shopMemberName) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getAllGroupShopMemberNotInRoomByName", {"shopMemberName": shopMemberName}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getAllGroupShopMemberNotInRoomByName(shopMemberName));
}
CHAT_DB.getAllGroupShopMemberNotInRoomByName = function (shopMemberName) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getAllGroupShopMemberNotInRoomByName, {
shopMemberName: shopMemberName,
})
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(
android.getAllGroupShopMemberNotInRoomByName(shopMemberName)
);
}
};
CHAT_DB.getGroupByName = function(groupName) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getGroupByName", {"groupName": groupName}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getGroupByName(groupName));
}
CHAT_DB.getGroupByName = function (groupName) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getGroupByName, { groupName: groupName })
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getGroupByName(groupName));
}
};
CHAT_DB.getUsersInRoom = function(roomId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getUsersInRoom", {"roomId": roomId}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getUsersInRoom(roomId));
}
}
CHAT_DB.getUsersInRoom = function (roomId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getUsersInRoom, { roomId: roomId })
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getUsersInRoom(roomId));
}
};
// アーカイブ一覧
CHAT_DB.getArchiveList = function() {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getArchiveList", {}));
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getArchiveList());
}
CHAT_DB.getArchiveList = function () {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getArchiveList, {}));
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getArchiveList());
}
};
CHAT_DB.updateArchiveList = function() {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.updateArchiveList.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.updateArchiveList();
}
CHAT_DB.updateArchiveList = function () {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.updateArchiveList.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.updateArchiveList();
}
};
// アーカイブ一覧検索
CHAT_DB.getArchiveByName = function(archiveName) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getArchiveByName", {"archiveName": archiveName}));
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getArchiveListByName(archiveName));
}
CHAT_DB.getArchiveByName = function (archiveName) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getArchiveByName, {
archiveName: archiveName,
})
);
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getArchiveListByName(archiveName));
}
};
// アーカイブ詳細
CHAT_DB.getArchiveDetail = function(archiveId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getArchiveDetail", {"archiveId": archiveId}));
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getArchiveDetail(archiveId));
}
};
CHAT_DB.updateArchiveDetail = function(archiveId) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.updateArchiveDetail.postMessage(archiveId);
} else if (CHAT_UTIL.isAndroid()) {
android.updateArchiveDetail(archiveId);
}
};
CHAT_DB.searchMessages = function(keyword, userList) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("searchMessages", {"keyWord": keyword, "userList": userList}));
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.searchMessages(keyword, userList));
}
};
CHAT_DB.getMyGroupUsersNotInRoom = function() {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getMyGroupUsersNotInRoom", {}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMyGroupUsersNotInRoom());
}
};
CHAT_DB.getUserInfo = function(shopMemberId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getUserInfo", {"shopMemberId": shopMemberId}));
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getUserInfo(shopMemberId));
}
};
CHAT_DB.getBeforeRoomType = function() {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return callNativeApp("getBeforeRoomType", {});
}
};
CHAT_DB.getRoomType = function() {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return parseInt(callNativeApp("getRoomType", {}), 10);
}
};
CHAT_DB.removeFavoriteUser = function(shopMemberId) {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
var result = callNativeApp("removeFavoriteUser", {"shopMemberId": shopMemberId});
if (result == "true") {
return true;
} else {
return false;
}
}
};
CHAT_DB.addFavoriteUser = function(shopMemberId) {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
var result = callNativeApp("addFavoriteUser", {"shopMemberId": shopMemberId});
if (result == "true") {
return true;
} else {
return false;
}
}
};
CHAT_DB.removeFavoriteGroup = function(groupId) {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
var result = callNativeApp("removeFavoriteGroup", {"groupId": groupId});
if (result == "true") {
return true;
} else {
return false;
}
}
};
CHAT_DB.addFavoriteGroup = function(groupId) {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
var result = callNativeApp("addFavoriteGroup", {"groupId": groupId});
if (result == "true") {
return true;
} else {
return false;
}
}
};
CHAT_DB.getUserListByLoginId = function(loginIdList) {
console.log(loginIdList);
if (CHAT_UTIL.isIOS()) {
return JSON.parse(callNativeApp("getUserListByLoginId", {"loginIdList": loginIdList.join(",")}));
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getUserListByLoginId(loginIdList.join(",")));
}
}
CHAT_DB.getCollaborationJoinFlg = function() {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return callNativeApp("getCollaborationJoinFlg", {});
}
CHAT_DB.getArchiveDetail = function (archiveId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getArchiveDetail, { archiveId: archiveId })
);
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getArchiveDetail(archiveId));
}
};
CHAT_DB.getUserInfoList = function(shopMemberId) {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return callNativeApp("getUserInfoList", {"shopMemberId": shopMemberId});
}
CHAT_DB.updateArchiveDetail = function (archiveId) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.updateArchiveDetail.postMessage(archiveId);
} else if (CHAT_UTIL.isAndroid()) {
android.updateArchiveDetail(archiveId);
}
};
CHAT_DB.createContentView = function() {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return parseInt(callNativeApp("createContentView", {}));
}
CHAT_DB.searchMessages = function (keyword, userList) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.searchMessages, {
"keyWord": keyword,
"userList": userList,
})
);
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.searchMessages(keyword, userList));
}
};
CHAT_DB.getToMoveGroupId = function() {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return callNativeApp("getToMoveGroupId", {});
}
CHAT_DB.getMyGroupUsersNotInRoom = function () {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getMyGroupUsersNotInRoom, {})
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMyGroupUsersNotInRoom());
}
};
CHAT_DB.getJoinCollaborationType = function() {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return parseInt(callNativeApp("getJoinCollaborationType", {}), 10);
}
CHAT_DB.getUserInfo = function (shopMemberId) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getUserInfo, { shopMemberId: shopMemberId })
);
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getUserInfo(shopMemberId));
}
};
CHAT_DB.getHostRequestFlg = function() {
// Androidは実装不要
if (CHAT_UTIL.isIOS()) {
return parseInt(callNativeApp("getHostRequestFlg", {}), 10);
}
CHAT_DB.getUserListByLoginId = function (loginIdList) {
console.log(loginIdList);
if (CHAT_UTIL.isIOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getUserListByLoginId, {
loginIdList: loginIdList.join(","),
})
);
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getUserListByLoginId(loginIdList.join(",")));
}
};
jQuery('#homeButton').on('click', function() {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.goHome.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.goHome();
}
jQuery("#homeButton").on("click", function () {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.goHome.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.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
jQuery("#reloadButton").on("click", function () {
if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要。
} else if (CHAT_UTIL.isAndroid()) {
android.reload();
}
});
var lastscrollvalue;
window.onscroll = function() {
beforeScroll = window.scrollY;
}
window.onscroll = function () {
beforeScroll = window.scrollY;
};
$('#roomNameChangeBtn').click(function() {
var changeRoomName = $('#roomNameInput').val();
var trimmedRoomName = $('#roomNameInput').val().trim();
if (trimmedRoomName.length == 0) {
alert(getLocalizedString("error_empty_room_name"));
return;
}
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.changeRoomName.postMessage(changeRoomName);
} else if (CHAT_UTIL.isAndroid()) {
android.changeRoomName(changeRoomName);
}
})
$("#roomNameChangeBtn").click(function () {
var changeRoomName = $("#roomNameInput").val();
var trimmedRoomName = $("#roomNameInput").val().trim();
if (trimmedRoomName.length == 0) {
alert(getLocalizedString("error_empty_room_name"));
return;
}
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.changeRoomName.postMessage(changeRoomName);
} else if (CHAT_UTIL.isAndroid()) {
android.changeRoomName(changeRoomName);
}
});
/*
$('#messages').scroll(function() {
......
// New Room
// チャットルーム生成ボタン処理
$("#createChatRoom").on("click", function () {
//loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
let isInvite = false;
CHAT.globalIsInvite = isInvite;
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") {
if (typeof android != "undefined") {
android.updateRoomList();
} else {
webkit.messageHandlers.updateRoomList.postMessage({});
}
CHAT_UI.refreshRoomList(ChatRoomType.DM);
CHAT_UI.dismissLoadingIndicator();
}
}
});
//メッセージ送信
$("#messageInput").on("keypress", function (event) {
if (event.which == 13) {
// Enterキーの処理
$("#messageSend").click();
}
});
// 写真アップロード
$("#imageInputButton").on("click", function () {
$("#imageInputTag").click();
});
// 動画アップロード
$("#videoUploadButton").on("click", function () {
$("#videoInputTag").click();
});
$("#imageInputTag").on("change", function () {
$("#image-form").submit();
// reset the value of form
$("#imageInputTag").val("");
});
$("#videoInputTag").on("change", function () {
$("#video-form").submit();
// reset the value of form
$("#videoInputTag").val("");
});
$("#image-form").on("submit", function (e) {
e.preventDefault();
const imageInputTag = $("#imageInputTag");
const file = imageInputTag.prop("files")[0];
if (file) {
$(".overlay").addClass("active undismissable");
$(".loader").addClass("active");
CHAT_UI.showLoadingIndicator();
var fd = new FormData($(this)[0]);
console.log($(this)[0]);
//画像の大きさが500pixelより大きかったら、thumbnailを生成
CHAT.createThumbnailAndUpload(
file,
function (resizeFile, thumbnailCreated) {
if (resizeFile && thumbnailCreated) {
//ただ、画像の大きさが500pixel以下の場合はthumbnailは生成されない
fd.append("thumb", resizeFile);
}
// イメージをアップロード
CHAT.uploadImage(fd);
}
);
}
});
$("#video-form").on("submit", function (e) {
e.preventDefault();
const videoInputTag = $("#videoInputTag");
const file = videoInputTag.prop("files")[0];
if (file) {
$(".overlay").addClass("active undismissable");
$(".loader").addClass("active");
CHAT_UI.showLoadingIndicator();
var fd = new FormData($(this)[0]);
if (!file.type.includes("image")) {
// video 保存
// CHAT.createVideoThumbnailAndUpload(file, function(resizeFile, thumbnailCreated) {
// if(resizeFile && thumbnailCreated) {
// //ただ、画像の大きさが500pixel以下の場合はthumbnailは生成されない
// fd.append('thumb', resizeFile)
// }
// CHAT.uploadImage(fd);
// })
CHAT.uploadImage(fd);
return;
}
}
});
$("#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);
});
$("#tabGroup").on("click", function (e) {
CHAT_UI.refreshRoomList(ChatRoomType.GROUP);
});
$("#tabAllGroup").on("click", function (e) {
CHAT_UI.refreshAllGroupSearch("0");
});
$("#tabMyGroup").on("click", function (e) {
$("#contactSearch").attr("placeholder", getLocalizedString("userSearch"));
CHAT_UI.refreshContactScreen();
});
$("#tabMyGroupOnMakeRoom").on("click", function (e) {
CHAT_UI.refreshMyGroupForMakeRoom();
});
$("#tabAllGroupOnMakeRoom").on("click", function (e) {
CHAT_UI.refreshAllGroupForMakeRoom("0");
});
$("#tabMyGroupOnAddUser").on("click", function (e) {
CHAT_UI.refreshMyGroupForAddUser();
});
$("#tabAllGroupOnAddUser").on("click", function (e) {
CHAT_UI.refreshAllGroupForAddUser("0");
});
$("#tabMyGroupOnAddUserInCollaboration").on("click", function (e) {
CHAT_UI.refreshMyGroupForAddUserInCollaboration();
});
$("#tabAllGroupOnAddUserInCollaboration").on("click", function (e) {
CHAT_UI.refreshAllGroupForAddUserInCollaboration("0");
});
$("#makeRoomConfirmBtn").on("click", function (e) {
if (typeof android != "undefined") {
android.saveSelectedUserList(CHAT.globalSelectedUserList.join(","));
} else {
webkit.messageHandlers.saveSelectedUserList.postMessage(
CHAT.globalSelectedUserList.join(",")
);
}
$("#makeRoomForm").submit();
});
$("#addUserConfirmBtn").on("click", function (e) {
if (typeof android != "undefined") {
android.saveSelectedUserList(CHAT.globalSelectedUserList.join(","));
} else {
webkit.messageHandlers.saveSelectedUserList.postMessage(
CHAT.globalSelectedUserList.join(",")
);
}
$("#addUserForm").submit();
});
CHAT_UI.joinCollaboration = function (collaborationType, meetingId = 0) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.joinCollaboration.postMessage({
collaborationType: collaborationType,
meetingId: meetingId,
});
} else if (CHAT_UTIL.isAndroid()) {
if (
collaborationType == COLLABORATION_TYPE.DOCUMENT &&
androidVersion < ANDROID_SDK_VERSION.O
) {
alert(getLocalizedString("not_support_version"));
return;
}
android.joinCollaboration(collaborationType, meetingId);
}
};
CHAT_UI.startCollaboration = function (collaborationType) {
if (CHAT_UTIL.isAndroid()) {
if (
collaborationType == COLLABORATION_TYPE.DOCUMENT &&
androidVersion < ANDROID_SDK_VERSION.O
) {
alert(getLocalizedString("not_support_version"));
return;
}
}
if ($(".collabo_area.start").length != 0) {
if (!confirm(getLocalizedString("already_exist_collaboration"))) {
CHAT_UI.dismissLoadingIndicator();
return;
}
socket.emit(
"createMessage",
{
text: DATA_MESSAGE_SCHEME + FINISH_ALL_COLLABORATION_SIGNAL,
},
0
);
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.finishAllCollaboration.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.finishAllCollaboration();
}
}
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.startCollaboration.postMessage(collaborationType);
} else if (CHAT_UTIL.isAndroid()) {
android.startCollaboration(collaborationType);
}
};
CHAT_UI.refreshJoinedCollaboration = function (loginIdList) {
for (var count = 0; count < loginIdList.length; count++) {
loginIdList[count] = loginIdList[count].replaceAll(
globalUserInfo.shopName + "_",
""
);
}
CHAT_UI.showLoadingIndicator();
$("#collaboration_overlay_user_list").html("");
var joinedUserListTemplate;
$.get(
{ url: "./collaboration_overlay_user_list.html", async: false },
function (text) {
joinedUserListTemplate = text;
}
);
var joinedUserList = CHAT_DB.getUserListByLoginId(loginIdList);
var sortedUserList = new Array();
loginIdList.forEach(function (userId) {
joinedUserList.forEach(function (user) {
if (userId == user.loginId) {
sortedUserList.push(user);
}
});
});
sortedUserList.forEach(function (user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
});
let html = Mustache.render(joinedUserListTemplate, {
joinedUserList: sortedUserList,
});
let obj = jQuery.parseHTML(html);
$("#collaboration_overlay_user_list").append(obj);
CHAT_UI.dismissLoadingIndicator();
};
CHAT_UI.refreshMyGroupForAddUserInCollaboration = function () {
if (CHAT.globalSelectedUserList.length > 0) {
$(".select_member_num").text(CHAT.globalSelectedUserList.length);
} else {
$(".select_member_num").text("0");
}
$("#favoriteListForAddUserInCollaboration").html("");
$("#myGroupListForAddUserInCollaboration").html("");
$("#tabMyGroupOnAddUserInCollaboration").prop("checked", true);
// グループの様式を読み込む
var groupTemplate = getTemplate(
TemplateURL.ADD_USER_GROUP_LIST_IN_COLLABORATION
);
// ユーザの様式を読み込む
var userTemplate = getTemplate(
TemplateURL.ADD_USER_USER_LIST_IN_COLLABORATION
);
var groupUserTemplate = getTemplate(
TemplateURL.ADD_USER_GROUP_USER_LIST_IN_COLLABORATION
);
if (IS_ONLINE == "true") {
if (typeof android != "undefined") {
android.updateGroupInfo("0");
android.updateMyInfo();
android.updateGroupUser();
android.updateFavorite();
} else {
webkit.messageHandlers.updateGroupInfo.postMessage("0");
webkit.messageHandlers.updateMyInfo.postMessage({});
webkit.messageHandlers.updateGroupUser.postMessage({});
webkit.messageHandlers.updateFavorite.postMessage({});
}
}
//お気に入りグループ取得。
var favoriteGroupList = CHAT_DB.getFavoriteGroups();
favoriteGroupList.forEach(function (favoriteGroup) {
let html = Mustache.render(groupTemplate, {
name: favoriteGroup.groupName,
id: favoriteGroup.groupId,
});
let obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#favoriteListForAddUserInCollaboration").append(obj);
});
//お気に入りユーザ取得。
var favoriteUserList = CHAT_DB.getFavoriteUsersNotInRoom();
favoriteUserList.forEach(function (favoriteUser) {
favoriteUser.profileUrl = CHAT.getProfileImgUrl(favoriteUser.profileUrl);
let findObj = CHAT.globalSelectedUserList.find(function (shopMemberId) {
return shopMemberId == favoriteUser.shopMemberId;
});
if (findObj) {
favoriteUser.checked = "checked";
}
});
let html = Mustache.render(userTemplate, {
userList: favoriteUserList,
});
let obj = jQuery.parseHTML(html);
$("#favoriteListForAddUserInCollaboration").append(obj);
var myGroupList = CHAT_DB.getMyGroupUsersNotInRoom();
myGroupList.forEach(function (myGroup) {
myGroup.groupUserList.forEach(function (groupUser) {
groupUser.profileUrl = CHAT.getProfileImgUrl(groupUser.profileUrl);
let findObj = CHAT.globalSelectedUserList.find(function (shopMemberId) {
return shopMemberId == groupUser.shopMemberId;
});
if (findObj) {
groupUser.checked = "checked";
}
});
let html = Mustache.render(groupUserTemplate, {
groupName: myGroup.groupName,
groupUserList: myGroup.groupUserList,
});
let obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#myGroupListForAddUserInCollaboration").append(obj);
});
$("#addUserInCollaboration").modal("show");
CHAT_UI.dismissLoadingIndicator();
};
CHAT_UI.refreshAllGroupForAddUserInCollaboration = function (paramGroupId) {
var groupId = paramGroupId;
$(".content").removeClass("none");
$("#tabAllGroupOnAddUserInCollaboration").prop("checked", true);
//オンライン状態であればサーバから情報更新。
if (IS_ONLINE == "true") {
if (typeof android != "undefined") {
android.updateGroupInfo(groupId);
} else {
webkit.messageHandlers.updateGroupInfo.postMessage(groupId);
}
}
//画面エリアを初期化。
$("#parentGroupBtnForAddUserInCollaboration").off();
$("#rootGroupBtnForAddUserInCollaboration").off();
$("#childGroupListAreaForAddUserInCollaboration").html("");
$("#userInGroupListForAddUserInCollaboration").html("");
$("#groupPathAreaForAddUserInCollaboration").html("");
//DBからグループ情報を取得。
var result = CHAT_DB.getGroupInfoForAddUser(groupId);
//上位グループ、トップグループ遷移ボタンのイベント追加。
if (typeof result.parentGroupId !== "undefined") {
$("#parentGroupBtnForAddUserInCollaboration").on("click", function () {
CHAT_UI.refreshAllGroupForAddUserInCollaboration(result.parentGroupId);
});
}
if (typeof result.rootGroupId !== "undefined") {
if (paramGroupId == 0) {
groupId = result.rootGroupId;
}
$("#rootGroupBtnForAddUserInCollaboration").on("click", function () {
CHAT_UI.refreshAllGroupForAddUserInCollaboration(result.rootGroupId);
});
}
if (groupId == result.rootGroupId || paramGroupId == "0") {
$("#rootGroupAreaInCollaboration").addClass("none");
$("#parentGroupAreaInCollaboration").addClass("none");
} else {
$("#rootGroupAreaInCollaboration").removeClass("none");
$("#parentGroupAreaInCollaboration").removeClass("none");
}
//該当グループのパースを表示。
var groupPathTemplate = getTemplate(
TemplateURL.ADD_USER_GROUP_PATH_IN_COLLABORATION
);
var groupPathCount = 0;
result.groupPathList.forEach(function (groupPath) {
if (!(groupPathCount < result.groupPathList.length - 3)) {
let html = Mustache.render(groupPathTemplate, {
name: groupPath.groupName,
id: groupPath.groupId,
});
let obj = jQuery.parseHTML(html);
$("#groupPathAreaForAddUserInCollaboration").append(obj);
}
groupPathCount++;
});
//該当グループの下位グループ表示。
var groupTemplate = getTemplate(
TemplateURL.ADD_USER_GROUP_LIST_IN_COLLABORATION
);
result.childGroupList.forEach(function (childGroup) {
let html = Mustache.render(groupTemplate, {
name: childGroup.groupName,
id: childGroup.groupId,
});
let obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#childGroupListAreaForAddUserInCollaboration").append(obj);
});
//該当グループの所属ユーザを表示。
var userTemplate = getTemplate(
TemplateURL.ADD_USER_USER_LIST_IN_COLLABORATION
);
result.groupUserList.forEach(function (groupUser) {
groupUser.profileUrl = CHAT.getProfileImgUrl(groupUser.profileUrl);
let findObj = CHAT.globalSelectedUserList.find(function (shopMemberId) {
return shopMemberId == groupUser.shopMemberId;
});
if (findObj) {
groupUser.checked = "checked";
}
});
let html = Mustache.render(userTemplate, {
userList: result.groupUserList,
});
let obj = jQuery.parseHTML(html);
$("#userInGroupListForAddUserInCollaboration").append(obj);
};
CHAT_UI.makeNameCardInCollaboration = function (shopMemberId) {
if (CHAT.globalLoginParameter.shopMemberId == shopMemberId) {
return;
}
var nameCardInfo = CHAT_DB.getNameCardData(shopMemberId);
var namecardTemplate;
var changeHostTemplate;
$.get({ url: "./modal_collabo_profile.html", async: false }, function (text) {
namecardTemplate = text;
});
let isCollaborationHost = coview_api.getRoomUsers();
nameCardInfo.profileUrl = CHAT.getProfileImgUrl(nameCardInfo.profileUrl);
let whosHost = $("#collaboration_user_" + nameCardInfo.loginId).hasClass(
"host"
);
let namecardHtml = Mustache.render(namecardTemplate, {
shopMemberId: nameCardInfo.shopMemberId,
profileUrl: nameCardInfo.profileUrl,
loginId: nameCardInfo.loginId,
name: nameCardInfo.shopMemberName,
groupPathList: nameCardInfo.groupPathList,
isFavorite: nameCardInfo.isFavorite,
isHost: isCollaborationHost,
whosHost: whosHost,
});
let namecardObj = $(jQuery.parseHTML(namecardHtml)).on(
"click",
function () {}
);
$("#userProfileModalInCollaboration").html(namecardObj);
$("#userNameCardInCollaboration").modal("show");
};
CHAT_UI.removeFavoriteUserInCollaboration = function (shopMemberId) {
CHAT_UI.showLoadingIndicator();
$("#userNameCardInCollaboration").modal("hide");
var result;
if (typeof android != "undefined") {
result = android.removeFavoriteUser(shopMemberId);
} else {
result = CHAT_DB.removeFavoriteUser(shopMemberId);
}
CHAT_UI.dismissLoadingIndicator();
};
CHAT_UI.insertFavoriteUserInCollaboration = function (shopMemberId) {
$("#userNameCardInCollaboration").modal("hide");
var result;
if (typeof android != "undefined") {
result = android.addFavoriteUser(shopMemberId);
} else {
result = CHAT_DB.addFavoriteUser(shopMemberId);
}
CHAT_UI.dismissLoadingIndicator();
};
CHAT_UI.confirmInviteUserListInCollaboration = function () {
var selectedUsers = CHAT_DB.loadSelectedUsers();
if (selectedUsers != "") {
$("#selectedUserListinCollaboration").html("");
var selectedUserList = CHAT_DB.loadSelectedUsers();
selectedUserList.forEach(function (user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
});
var modalTemplate;
$.get(
{ url: "./modal_add_user_confirm.html", async: false },
function (text) {
modalTemplate = text;
}
);
let html = Mustache.render(modalTemplate, {
userList: selectedUserList,
});
let obj = jQuery.parseHTML(html);
$("#modal_add_user_confirm").html(obj);
$("#modalAddUserConfirm").modal("show");
} else {
}
$("#cancelAddUserBtn")
.off()
.on("click", function () {
console.log("cancelClick");
$("#modalAddUserConfirm").modal("hide");
$("#addUserInCollaboration").modal("show");
});
$("#addUserBtn")
.off()
.on("click", function () {
CHAT_UI.showLoadingIndicator();
let userIdList = new Array();
selectedUserList.forEach(function (user) {
userIdList.push(user.shopMemberId);
});
if (typeof android != "undefined") {
android.inviteCollaboration(
userIdList.join(","),
CHAT_UTIL.getCollaborationType(globalUserInfo.coWorkType)
);
} else {
webkit.messageHandlers.inviteCollaboration.postMessage({
userIdList: userIdList.join(","),
collaborationType: CHAT_UTIL.getCollaborationType(
globalUserInfo.coWorkType
),
});
}
$("#modalAddUserConfirm").modal("hide");
});
};
// 名前空間
var CHAT_UTIL = {};
CHAT_UTIL.isAndroid = function() {
return PLATFORM == 'android';
CHAT_UTIL.isAndroid = function () {
return PLATFORM == "android";
};
CHAT_UTIL.isIOS = function() {
return PLATFORM == 'ios';
CHAT_UTIL.isIOS = function () {
return PLATFORM == "ios";
};
CHAT_UTIL.isMobile = function() {
return IS_MOBILE == 'true';
CHAT_UTIL.isMobile = function () {
return IS_MOBILE == "true";
};
CHAT_UTIL.formatDate = function(date) {
const REFERENCE = moment();
const TODAY = REFERENCE.clone().startOf('day');
let createdAt = moment(date);
if (date.length == 14) {
createdAt = moment(date,'YYYYMMDDhhmmss');
} else {
createdAt = moment(date);
}
// #36171
const createdAtDay = createdAt.format('MMM Do');
const createdAtTime = createdAt.format('HH:mm');
if (createdAt.isSame(TODAY, 'd')) {
createdAt = createdAtTime;
} else {
createdAt = createdAtDay;
}
let rntDate = new Object();
rntDate.createdAtDay = createdAtDay;
rntDate.createdAtTime = createdAtTime;
rntDate.createdAt = createdAt;
return rntDate;
}
CHAT_UTIL.formatDate = function (date) {
const REFERENCE = moment();
const TODAY = REFERENCE.clone().startOf("day");
let createdAt = moment(date);
if (date.length == 14) {
createdAt = moment(date, "YYYYMMDDhhmmss");
} else {
createdAt = moment(date);
}
// #36171
const createdAtDay = createdAt.format("MMM Do");
const createdAtTime = createdAt.format("HH:mm");
if (createdAt.isSame(TODAY, "d")) {
createdAt = createdAtTime;
} else {
createdAt = createdAtDay;
}
let rntDate = new Object();
rntDate.createdAtDay = createdAtDay;
rntDate.createdAtTime = createdAtTime;
rntDate.createdAt = createdAt;
return rntDate;
};
CHAT_UTIL.htmlDecode = function(input) {
var e = document.createElement('textarea');
e.innerHTML = input;
// handle case of empty input
return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
}
CHAT_UTIL.htmlDecode = function (input) {
var e = document.createElement("textarea");
e.innerHTML = input;
// handle case of empty input
return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
};
//generates a unique id, not obligator a UUID
CHAT_UTIL.generateUUID = function() {
var d = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = (d + Math.random()*16)%16 | 0;
d = Math.floor(d/16);
return (c=='x' ? r : (r&0x3|0x8)).toString(16);
});
return uuid;
CHAT_UTIL.generateUUID = function () {
var d = new Date().getTime();
var uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
/[xy]/g,
function (c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c == "x" ? r : (r & 0x3) | 0x8).toString(16);
}
);
return uuid;
};
CHAT_UTIL.systemDay = function(date) {
let createdAt = moment(date);
createdAt = moment(date,'YYYYMMDDhhmmss');
const createdAtDow = createdAt.format('YYYY-MM-DD');
CHAT_UTIL.systemDay = function (date) {
let createdAt = moment(date);
createdAt = moment(date, "YYYYMMDDhhmmss");
const createdAtDow = createdAt.format("YYYY-MM-DD");
let systemDay = new Object();
systemDay.year = createdAt.format('YYYY');
systemDay.month = createdAt.format('MM');
systemDay.day = createdAt.format('DD');
systemDay.dow = moment(createdAtDow).day();
let systemDay = new Object();
systemDay.year = createdAt.format("YYYY");
systemDay.month = createdAt.format("MM");
systemDay.day = createdAt.format("DD");
systemDay.dow = moment(createdAtDow).day();
return systemDay;
}
return systemDay;
};
CHAT_UTIL.findDow = function(data) {
let dow = "";
if (data == 0) {
dow = getLocalizedString('sunday');
} else if (data == 1) {
dow = getLocalizedString('monday');
} else if (data == 2) {
dow = getLocalizedString('thusday');
} else if (data == 3) {
dow = getLocalizedString('wednesday');
} else if (data == 4) {
dow = getLocalizedString('thursday');
} else if (data == 5) {
dow = getLocalizedString('friday');
} else if (data == 6) {
dow = getLocalizedString('sunday');
}
return dow;
}
CHAT_UTIL.findDow = function (data) {
let dow = "";
if (data == 0) {
dow = getLocalizedString("sunday");
} else if (data == 1) {
dow = getLocalizedString("monday");
} else if (data == 2) {
dow = getLocalizedString("thusday");
} else if (data == 3) {
dow = getLocalizedString("wednesday");
} else if (data == 4) {
dow = getLocalizedString("thursday");
} else if (data == 5) {
dow = getLocalizedString("friday");
} else if (data == 6) {
dow = getLocalizedString("sunday");
}
return dow;
};
function msToTime(s) {
var ms = s % 1000;
......@@ -98,55 +101,57 @@ function msToTime(s) {
var mins = s % 60;
var hrs = (s - mins) / 60;
return hrs + ':' + mins + ':' + secs;
return hrs + ":" + mins + ":" + secs;
}
function updateDuration() {
var now = new Date();
$('.collaboration_duration').each(function(index, item) {
var insertDateString = $(item).data('insertdate');
insertDateString = insertDateString.toString();
var year = insertDateString.substring(0,4);
var month = insertDateString.substring(4,6);
var day = insertDateString.substring(6,8);
var hour = insertDateString.substring(8,10);
var min = insertDateString.substring(10,12);
var sec = insertDateString.substring(12,14);
var insertDate = new Date(year, month-1 , day, hour, min, sec);
$(item).html(msToTime(now - insertDate));
});
var now = new Date();
$(".collaboration_duration").each(function (index, item) {
var insertDateString = $(item).data("insertdate");
insertDateString = insertDateString.toString();
var year = insertDateString.substring(0, 4);
var month = insertDateString.substring(4, 6);
var day = insertDateString.substring(6, 8);
var hour = insertDateString.substring(8, 10);
var min = insertDateString.substring(10, 12);
var sec = insertDateString.substring(12, 14);
var insertDate = new Date(year, month - 1, day, hour, min, sec);
$(item).html(msToTime(now - insertDate));
});
}
CHAT_UTIL.getCollaborationType = function(key) {
switch(key) {
case collaborationTypeKey.AUDIO:
return COLLABORATION_TYPE.AUDIO;
case collaborationTypeKey.CAMERA:
return COLLABORATION_TYPE.CAMERA;
case collaborationTypeKey.VIDEO:
return COLLABORATION_TYPE.VIDEO;
case collaborationTypeKey.DOCUMENT:
return COLLABORATION_TYPE.DOCUMENT;
default:
return 0;
}
}
CHAT_UTIL.getCollaborationType = function (key) {
switch (key) {
case CollaborationTypeKey.AUDIO:
return COLLABORATION_TYPE.AUDIO;
case CollaborationTypeKey.CAMERA:
return COLLABORATION_TYPE.CAMERA;
case CollaborationTypeKey.VIDEO:
return COLLABORATION_TYPE.VIDEO;
case CollaborationTypeKey.DOCUMENT:
return COLLABORATION_TYPE.DOCUMENT;
default:
return 0;
}
};
CHAT_UTIL.getCoviewTypeFromCollaborationType = function(joinCollaborationType) {
switch(joinCollaborationType) {
case COLLABORATION_TYPE.AUDIO:
console.log(collaborationTypeKey.AUDIO);
return collaborationTypeKey.AUDIO;
case COLLABORATION_TYPE.CAMERA:
console.log(collaborationTypeKey.CAMERA);
return collaborationTypeKey.CAMERA;
case COLLABORATION_TYPE.VIDEO:
return collaborationTypeKey.VIDEO;
case COLLABORATION_TYPE.DOCUMENT:
return collaborationTypeKey.DOCUMENT;
case COLLABORATION_TYPE.BOARD:
return collaborationTypeKey.BOARD;
default:
return 0;
}
}
\ No newline at end of file
CHAT_UTIL.getCoviewTypeFromCollaborationType = function (
joinCollaborationType
) {
switch (joinCollaborationType) {
case COLLABORATION_TYPE.AUDIO:
console.log(CollaborationTypeKey.AUDIO);
return CollaborationTypeKey.AUDIO;
case COLLABORATION_TYPE.CAMERA:
console.log(CollaborationTypeKey.CAMERA);
return CollaborationTypeKey.CAMERA;
case COLLABORATION_TYPE.VIDEO:
return CollaborationTypeKey.VIDEO;
case COLLABORATION_TYPE.DOCUMENT:
return CollaborationTypeKey.DOCUMENT;
case COLLABORATION_TYPE.BOARD:
return CollaborationTypeKey.BOARD;
default:
return 0;
}
};
var bindOnNewMessage = function () {
// New Message
// #36170
socket.on(SOCKET_KEY.NEW_MESSAGE, function (message, roomId, roomName) {
console.log(message);
const systemMessageTemplate = getTemplate(TemplateURL.SYSTEM_MESSAGE);
const unwrappedMessageInfo = decodeMessage(message.text);
if (
unwrappedMessageInfo ==
DATA_MESSAGE_SCHEME + FINISH_ALL_COLLABORATION_SIGNAL
) {
cleanUpCollaborationMessage();
return;
}
if (unwrappedMessageInfo.includes(messageSeperator)) {
const messageInfo = unwrappedMessageInfo.split(messageSeperator);
const messageText = messageInfo[0];
const messageType = messageInfo[1];
if (
messageType == MessageType.COMMUNICATIONSTART ||
messageType == MessageType.COMMUNICATIONEND
) {
addCollaborationMessage(
messageInfo,
message.userId,
roomName,
message.insertDate,
message.createdAt
);
} else {
addTextMessage(messageText, message, socket.id);
}
}
// 画像、動画の描画を待ってからスクロール
setTimeout(function () {
CHAT_UI.scrollToBottom();
}, 300);
});
};
var decodeMessage = function (text) {
try {
return decodeURIComponent(text);
} catch (e) {
return text;
}
};
var addCollaborationMessage = function (
messageInfo,
userID,
roomName,
insertDate,
createdAt
) {
const collaborationType = messageInfo[2];
const meetingID = getMeetingID(collaborationType, messageInfo);
const userInCollaboration = getUserInfoList(userID);
userInCollaboration.forEach(function (user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
});
const openCollaborationMessageTemplate = getTemplate(
TemplateURL.OPEN_COLLABORATION_MESSAGE
);
const html = renderCollaborationMessage(
openCollaborationMessageTemplate,
roomName,
userInCollaboration,
insertDate,
collaborationType,
meetingID,
createdAt
);
$("#messages").append(html);
};
var getMeetingID = function (collaborationType, messageInfo) {
if (
collaborationType ==
CHAT_UTIL.getCollaborationType(CollaborationTypeKey.DOCUMENT)
) {
return messageInfo[3];
} else {
return 0;
}
};
var renderCollaborationMessage = function (
template,
roomName,
userList,
insertDate,
collaborationType,
meetingID,
createdAt
) {
let messageTime = CHAT_UTIL.formatDate(createdAt);
return Mustache.render(template, {
roomName: roomName,
userCount: 1,
userList: userList,
insertDate: insertDate,
collaborationType: collaborationType,
isToday: true,
meetingId: meetingID,
createdAtDay: messageTime.createdAtDay,
createdAtTime: messageTime.createdAtTime,
isOtherYear: false,
});
};
var addTextMessage = function (messageText, message, socketID) {
const messageTextWithSID = insertSID(messageText);
const messageSender = getUserInfoList(message.userId);
const shopMemberName = messageSender[0].shopMemberName;
const textMessageTemplate = getTextMessageTemplate(message.id === socketID);
const profileImagePath = CHAT.getProfileImgUrl(message.profileImagePath);
const html = renderTextMessage(
textMessageTemplate,
messageTextWithSID,
shopMemberName,
profileImagePath,
message.userId,
message.createdAt
);
$("#messages").append(html);
};
var renderTextMessage = function (
template,
text,
from,
profileImagePath,
userID,
createdAt
) {
let messageTime = CHAT_UTIL.formatDate(createdAt);
let dataInsertedTemplate = Mustache.render(template, {
text: text,
from: from,
profileImage: profileImagePath,
shopMemberId: userID,
createdAtDay: messageTime.createdAtDay,
createdAtTime: messageTime.createdAtTime,
isToday: true,
});
// イメージの場合、img tagを追加する
if (text.includes("attachedImages") || text.includes("attachedVideos")) {
return CHAT_UTIL.htmlDecode(dataInsertedTemplate);
} else {
return dataInsertedTemplate;
}
};
var getUserInfoList = function (userID) {
if (CHAT_UTIL.isIOS()) {
return JSON.parse(CHAT_DB.getUserInfoList(userID));
} else if (CHAT_UTIL.isAndroid()) {
return JSON.parse(android.getUserInfoList(userID));
}
};
var cleanUpCollaborationMessage = function () {
$(".collabo_area.start").each(function (index, collaborationMessage) {
$(collaborationMessage).removeClass("start");
$(collaborationMessage).addClass("end");
$(collaborationMessage).addClass("disable");
$(collaborationMessage)
.find(".collaboation_join_button")
.attr("disabled", "disabled");
$(collaborationMessage)
.find(".collaboration_join_message")
.text(getLocalizedString("message_ended"));
});
};
var insertSID = function (text) {
let replacePath = text;
replacePath = replacePath.replaceAll(
"?fileName=",
"?sid=" + CHAT.globalLoginParameter.sid + "&fileName="
);
return replacePath;
};
var getTextMessageTemplate = function (isSenderMySelf) {
return getTemplate(
isSenderMySelf
? TemplateURL.MY_MESSAGE // ユーザーが送信したメッセージの場合、自分のメッセージ様式を適用して表示する
: TemplateURL.USER_MESSAGE
);
};
var bindOnRefreshGroupList = function () {
// Update Group List(Invite)
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">' +
getLocalizedString(everyoneIsHere) +
"</center>"
);
}
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") {
android.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 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");
};
......@@ -3,624 +3,182 @@ var socket;
// 名前空間
var CHAT_SOCKET = {};
includeJs("./js/chat-websocket-message.js");
includeJs("./js/chat-websocket-refresh-group-list.js");
includeJs("./js/chat-websocket-refresh-user-list-in-group.js");
CHAT_SOCKET.socketCheck = function () {
if(socket == null || socket.disconnected) {
window.location.reload();
}
}
if (socket == null || socket.disconnected) {
window.location.reload();
}
};
CHAT_SOCKET.connectSocket = function () {
if (IS_ONLINE == 'true') {
socket = io(CHAT_SERVER_URL);
setSocketAction();
} else {
//オフラインの場合、DBからルーム一覧を表示。
if (CHAT_UTIL.isIOS()) {
//TODO IOSの場合
} else if (CHAT_UTIL.isAndroid()) {
}
if (IS_ONLINE == "true") {
socket = io(CHAT_SERVER_URL);
setSocketAction();
} else {
//オフラインの場合、DBからルーム一覧を表示。
if (CHAT_UTIL.isIOS()) {
//TODO IOSの場合
} else if (CHAT_UTIL.isAndroid()) {
}
}
};
/* ---------------------------------------------------
* Socket Connect/Disconnectc
* --------------------------------------------------- */
function setSocketAction () {
socket.on('connect', function() {
// socketが接続されたらチャット画面で画面を更新する
$('.overlay').removeClass('active undismissable');
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
// チャットルームに入場する際、sid, loginId, shopName, roomId, roomNameの情報を取得しNodeJsに渡す
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.getLoginParameter();
}
CHAT_UI.dismissLoadingIndicator();
});
socket.on('disconnect', function() {
//socketが切断されたら黒画面で画面を更新する
$('.overlay').addClass('active undismissable');
//alert('Disconnected from the server');
CHAT_UI.dismissLoadingIndicator();
});
socket.on('connect_error', function() {
CHAT_UI.dismissLoadingIndicator();
});
/* ----------------------------------------------------------------------
*
* Chat Room List Tab
*
* ---------------------------------------------------------------------- */
// Update Room List
//TODO APIの連動が終わったら削除予定
/*socket.on('refreshRoomList', function(rooms, activeRoomId = null){
CHAT.globalIsInvite = false;
// #36146に対応
let keywordSearchMode = false;
if ($('#room-search').val().length > 0) {
keywordSearchMode = true;
}
$('#room_list').html('');
let roomListTitle = getLocalizedString("roomListTitle");
$('.titleRoomName').text(roomListTitle);
if (rooms.length === 0) {
// #36146に対応
// 検索結果がない場合のメッセージを追加
if (!keywordSearchMode) {
let emptyListString = getLocalizedString("roomListEmptyString")
$('#room_list').append(`<center class="text-secondary">${emptyListString}</center>`);
} else {
let emptyListString = getLocalizedString("searchRoomListEmptyString")
$('#room_list').append(`<center class="text-secondary">${emptyListString}</center>`);
}
}
// チャットルームの様式を読み込む
const template = $('#room-template').html();
rooms.forEach( function(room) {
room.profileImagePath = ASSET_PATH + 'images/user-profile.png'
if (room.message) {
room.message = room.message.toString()
} else {
room.message = getLocalizedString("noMessages")
}
let html = Mustache.render(template, {
roomName: room.roomName,
roomId: room.roomId,
profileImage: room.profileImagePath,
active: activeRoomId === room.roomId ? 'active_chat' : null, // 現在、入っているルームだとhilight表示
lastMessage: room.message.includes('<img') ? getLocalizedString("image") : (keywordSearchMode ? `${room.message}${getLocalizedString("searchResult")}` : room.message) ,
time: room.time ? CHAT_UTIL.formatDate(room.time.time).createdAt : '',
unreadMsgCnt: room.unreadCnt,
userCnt: room.userCnt
});
// Click event
let obj = $(jQuery.parseHTML(html)).on('click',function(){
if (activeRoomId === room.roomId) {
// 既存チャットルームをタッチする場合、チャット画面に遷移
$('#pills-chat-tab').tab('show');
} else {
// loadingIndicatorを表示しない
CHAT_UI.showLoadingIndicator();
// 新しいチャットルームをタッチする場合、チャットルームの接続処理を実行
socket.emit('joinRoom', room.roomId, room.roomName, function (){
CHAT.saveRoomInfo(room.roomId, room.roomName);
$('#messages').html('');
// チャットルーム名を変更する
$('.titleRoomName').text(room.roomName).data('roomName', room.roomName);
});
}
});
// チャットルームリストに追加する
$('#room_list').append(obj);
});
// #36146に対応
if(rooms.length > 0) {
if(!keywordSearchMode) {
$(".roomListIcon").show()
$('#roomDeleteButton, #arrangeRooms').show()
} else {
$(".roomListIcon").show()
$('#roomDeleteButton, #arrangeRooms').hide()
}
} else {
if(!keywordSearchMode) {
$(".roomListIcon").hide()
} else {
$(".roomListIcon").show()
$('#roomDeleteButton, #arrangeRooms').hide()
}
}
$('#createChatRoom').show()
// Rotate
if(CHAT_UI.isLandscapeMode()) {
$(".chat_list").removeClass("col-12").addClass("col-6");
}
$("#userSelectionDeleteBtn").hide();
// チャットルームリスト画面に遷移
$('#pills-chatlist-tab').tab('show');
// loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
});*/
// New Message
// #36170
socket.on('newMessage', function(message, roomId, roomName) {
console.log(message);
var userMessageTemplate;
$.get({ url: "./template/template_user_message.html", async: false }
, function(text) {
userMessageTemplate = text;
});
var myMessageTemplate;
$.get({ url: "./template/template_my_message.html", async: false }
, function(text) {
myMessageTemplate = text;
});
var systemMessageTemplate;
$.get({ url: "./template/template_system_message.html", async: false }
, function(text) {
systemMessageTemplate = text;
});
var openCollaborationMessageTemplate;
$.get({ url: "./template/template_open_collaboration_message.html", async: false }
, function(text) {
openCollaborationMessageTemplate = text;
});
let template = userMessageTemplate;
if (message.id === socket.id) {
// ユーザーが送信したメッセージの場合、自分のメッセージ様式を適用して表示する
template = myMessageTemplate;
}
let messageTime = CHAT_UTIL.formatDate(message.createdAt);
message.profileImagePath = CHAT.getProfileImgUrl(message.profileImagePath)
try {
message.text = decodeURIComponent(message.text)
} catch(e) {
message.text = message.text
}
let type;
let collaborationType;
if (message.text == DATA_MESSAGE_SCHEME + FINISH_ALL_COLLABORATION_SIGNAL) {
$('.collabo_area.start').each(function (index, collaborationMessage) {
$(collaborationMessage).removeClass('start');
$(collaborationMessage).addClass('end');
$(collaborationMessage).addClass('disable');
$(collaborationMessage).find('.collaboation_join_button').attr('disabled', 'disabled');
$(collaborationMessage).find('.collaboration_join_message').text(getLocalizedString('message_ended'));
});
return;
}
if ( message.text.includes(messageSeperator) ) {
let text = message.text.split(messageSeperator);
message.text = text[0];
type = text[1];
if (type == messageType.COMMUNICATIONSTART || type == messageType.COMMUNICATIONEND) {
collaborationType = text[2];
var meetingId = 0;
if (collaborationType == CHAT_UTIL.getCollaborationType(collaborationTypeKey.DOCUMENT)) {
meetingId = text[3];
}
var userInCollaboration;
if (CHAT_UTIL.isIOS()) {
userInCollaboration = JSON.parse(CHAT_DB.getUserInfoList(message.userId));
} else if (CHAT_UTIL.isAndroid()) {
userInCollaboration = JSON.parse(android.getUserInfoList(message.userId));
}
userInCollaboration.forEach(function(user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
})
template = openCollaborationMessageTemplate;
let html = Mustache.render(template, {
roomName: roomName,
userCount: 1,
userList: userInCollaboration,
insertDate: message.insertDate,
collaborationType: collaborationType,
isToday: true,
meetingId: meetingId,
createdAtDay: messageTime.createdAtDay,
createdAtTime: messageTime.createdAtTime,
isOtherYear: false
});
$('#messages').append(html);
} else {
var replacePath = message.text;
replacePath = replacePath.replaceAll('?fileName=', '?sid=' + CHAT.globalLoginParameter.sid + '&fileName=');
message.text = replacePath;
var messageSender;
if (CHAT_UTIL.isIOS()) {
messageSender = JSON.parse(CHAT_DB.getUserInfoList(message.userId));
} else if (CHAT_UTIL.isAndroid()) {
messageSender = JSON.parse(android.getUserInfoList(message.userId));
}
let html = Mustache.render(template, {
text: message.text,
from: messageSender[0].shopMemberName,
profileImage: message.profileImagePath,
shopMemberId: message.userId,
createdAtDay: messageTime.createdAtDay,
createdAtTime: messageTime.createdAtTime,
isToday: true
});
// イメージの場合、img tagを追加する
html = message.text.includes('attachedImages') || message.text.includes('attachedVideos') ? CHAT_UTIL.htmlDecode(html) : html;
$('#messages').append(html);
}
}
// 画像、動画の描画を待ってからスクロール
setTimeout(function () {
CHAT_UI.scrollToBottom();
}, 300);
});
// Notification
socket.on('newNotification', function(keyword, event) {
var notificationString = getLocalizedString(event, keyword)
$('#messageNotification').finish().text(notificationString).delay(500).slideDown().delay(1500).slideUp();
});
// 新しいメッセージを受信する場合の処理
// #36170
// socket.on('loadMessages', function(messages, shopMemberId, users, roomId, roomName){
// let jQueryMessages = $('#messages');
// // スクロールの変化を防ぐため以前画面の高さを保存する
// let beforeHeight = jQueryMessages.prop('scrollHeight');
// // メッセージ文字列の生成
// let workVal = "";
// messages.forEach(function(message) {
// let template = $('#message-template').html();
// if (message.shopMemberId == shopMemberId) {
// template = $('#message-template-me').html();
// }
// let messageTime = CHAT_UTIL.formatDate(message.time.time);
//
// if (users != undefined) {
// let user = users.find((user) => user.loginId == message.loginId)
//
// // userProfilePathが使えるpathかをcheckして使えないpathの場合、default画像の経路に変更
// if (user) {
// message.profileImagePath = CHAT.getProfileImgUrl(user.profileImagePath)
// } else {
// message.profileImagePath = CHAT.getProfileImgUrl("")
// }
// } else {
// message.profileImagePath = CHAT.getProfileImgUrl(message.profileImagePath)
// }
//
// // #36147
// message.message = message.message.toString();
// var replacePath = message.message;
// replacePath = replacePath.replaceAll('/acms',CHAT_SERVER_URL+'/acms');
// message.message = replacePath;
// let html = Mustache.render(template, {
// text: message.message,
// from: message.loginId,
// profileImage: message.profileImagePath,
// createdAtDay: messageTime.createdAtDay,
// createdAtTime: messageTime.createdAtTime
// });
// html = message.message.includes('attachedImages') || message.message.includes('attachedVideos') ? CHAT_UTIL.htmlDecode(html) : html;
// workVal = html + 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();
// }
// }
//
// // ユーザ削除ボタン表示しない
// $("#userSelectionDeleteBtn").hide();
//
// CHAT_UI.dismissLoadingIndicator();// add some...
//
// // チャットに遷移する
// $('#pills-chat-tab').tab('show');
// });
// Update User List In Room
// サイドバーのユーザーリストアップデート。
/* socket.on('updateUserList', function(users, onlineUsers) {
console.log(users);
console.log(onlineUsers);
if (users.length > 0) {
$('#users').removeData();
$('#users').data(users);
} else {
const data = $('#users').data();
if (data && Object.keys(data).length > 0) {
users = Object.keys(data).map(function(key) {
return data[key];
});
}
}
const ul = $('<ul/>', {class: 'list-unstyled components'});
// ユーザーリストを入れる前にユーザー招待ボタンを入れてくれる。
let inviteString = getLocalizedString("inviteUsersButton")
ul.append($('<li/>').append(`<a>${inviteString} <i class='fa fa-user-plus'><i/></a>`).on('click', function(event) {
$('#dismiss').click();
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
let isInvite = true;
CHAT.globalIsInvite = isInvite;
socket.emit('getGroupList', isInvite);
}));
// ユーザーリストを入れる
users.forEach(function(user) {
let li = $('<li/>');
let a = $('<a/>').text(user);
if (onlineUsers.includes(user)) {
// 接続されているユーザにバッジを付ける。
a.append($('<span/>',{class:'badge badge-success'}).text('online'));
}
li.append(a);
ul.append(li);
});
$('#users').html(ul);
});*/
// Update Group List(Invite)
socket.on('refreshGroupList', function(groups, isInvite) {
$('#group_list').html('');
const template = $('#group-template').html();
if (groups.length === 0) {
$('#group_list').append('<center class="text-secondary">'+ getLocalizedString(everyoneIsHere) +'</center>');
}
// グループ名と人数を表記する。
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);
});
$('#group_list').append(obj);
});
// Rotate
if (CHAT_UI.isLandscapeMode()) {
$(".group_list").addClass("col-6").removeClass("col-12");
}
// Set Title
let memberSelectTitle = getLocalizedString("groupSearch")
$('#pills-group-tab').tab('show');
$('#backButton').show();
if (isInvite) {
$('.titleRoomName').text(memberSelectTitle);
$('#newRoomName, .roomListIcon, .chatRoomIcon').hide();
$('#userSelectionConfirmBtn').show();
$("#userSelectionConfirmBtn").off().on('click', function() {
CHAT_UI.setConfirmButtonEvent(isInvite);
});
} else {
$('.titleRoomName').text(memberSelectTitle);
$('.roomListIcon, .chatRoomIcon, #newRoomName').hide();
$('#userSelectionConfirmBtn').show();
$("#userSelectionConfirmBtn").off().on('click', function() {
CHAT_UI.setConfirmButtonEvent(isInvite);
});
}
if (CHAT.globalSelectedUserList.length > 0) {
$('#userSelectionLength').text(CHAT.globalSelectedUserList.length);
} else {
$('#userSelectionLength').text('');
}
$('#backButton').off().on('click', function() {
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
if (isInvite) {
$('#pills-chat-tab').tab('show');
} else {
if (IS_ONLINE == 'true') {
android.updateRoomList();
CHAT_UI.refreshRoomList(chatRoomType.DM);
CHAT_UI.dismissLoadingIndicator();
}
}
});
});
// Update User List(Invite)
// #36170
socket.on('refreshUserListInGroup', function(users, groupId, isInvite) {
$('#user_list').html('');
const template = $('#user-template').html();
// Set Title
let memberSelectTitle = getLocalizedString("userSearch")
$('.titleRoomName').text(memberSelectTitle);
users.forEach( function(user) {
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
user.profileImagePath = CHAT.getProfileImgUrl(user.profileImagePath)
let html = Mustache.render(template, {
id: user.shopMemberId,
profileImage: user.profileImagePath,
name: user.loginId
});
// クリックするとactive クラスを与え、チェック表示を出させる。
let obj = $(jQuery.parseHTML(html)).on('click',function() {
if ($(this).find('.userCheckBox.active').length > 0) {
// remove
CHAT.globalSelectedUserList = CHAT.globalSelectedUserList.filter(function(element) {
return user.loginId != element.loginId;
});
} else {
// add
CHAT.globalSelectedUserList.push({loginId:user.loginId, shopMemberId : user.shopMemberId, profileImagePath: user.profileImagePath});
}
$(this).find('.userCheckBox').toggleClass('active');
if (CHAT.globalSelectedUserList.length > 0) {
$('#userSelectionLength').text(CHAT.globalSelectedUserList.length);
} else {
$('#userSelectionLength').text('');
}
});
let findObj = CHAT.globalSelectedUserList.find(function(selectedUser) {
return selectedUser.loginId == user.loginId;
})
if (findObj) {
$(obj).find('.userCheckBox').toggleClass('active');
}
$('#user_list').append(obj);
})
$('.userCheckBox').show();
function setSocketAction() {
/* ---------------------------------------------------
* Socket Connect/Disconnect
* --------------------------------------------------- */
bindOnConnect();
bindOnDisconnect();
bindOnConnectError();
/* ---------------------------------------------------
* Chat Room List Tab
* --------------------------------------------------- */
bindOnNewMessage();
bindOnNewNotification();
bindOnRefreshGroupList();
bindOnRefreshUserListInGroup();
/* ---------------------------------------------------
/* Show Error Log
/* --------------------------------------------------- */
bindOnShowServerError();
bindOnRetryJoinProcess();
}
// Rotate
if (CHAT_UI.isLandscapeMode()) {
$(".user_list").addClass("col-6").removeClass("col-12");
$(".squareBoxContent span").addClass("landscape_span");
}
var bindOnConnect = function () {
socket.on(SOCKET_KEY.CONNECT, function () {
// socketが接続されたらチャット画面で画面を更新する
$(".overlay").removeClass("active undismissable");
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
requestLoginInfo();
CHAT_UI.dismissLoadingIndicator();
});
};
$('#backButton').off().on('click', function() {
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
socket.emit('getGroupList', isInvite)
});
var requestLoginInfo = function () {
// チャットルームに入場する際、sid, loginId, shopName, roomId, roomNameの情報を取得しNodeJsに渡す
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.getLoginParameter();
}
};
$("#userSelectionConfirmBtn").off().on('click', function() {
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
CHAT_UI.setConfirmButtonEvent(isInvite);
});
var bindOnDisconnect = function () {
socket.on(SOCKET_KEY.DISCONNECT, function () {
//socketが切断されたら黒画面で画面を更新する
$(".overlay").addClass("active undismissable");
CHAT_UI.dismissLoadingIndicator();
});
};
$('#backButton').show();
$('.roomListIcon, .chatRoomIcon').hide();
$('#userSelectionConfirmBtn').show();
$('.userCheckBox').show();
$('#pills-user-tab').tab('show');
});
var bindOnConnectError = function () {
socket.on(SOCKET_KEY.CONNECT_ERROR, function () {
CHAT_UI.dismissLoadingIndicator();
});
};
/* ---------------------------------------------------------------------- */
/* Show Error Log */
/* ---------------------------------------------------------------------- */
var bindOnNewNotification = function () {
// Notification
socket.on(SOCKET_KEY.NEW_NOTIFICATION, function (keyword, event) {
const notificationString = getLocalizedString(event, keyword);
$("#messageNotification")
.finish()
.text(notificationString)
.delay(500)
.slideDown()
.delay(1500)
.slideUp();
});
};
socket.on('showServerError', function(message) {
// #36174
var bindOnShowServerError = function () {
socket.on(SOCKET_KEY.SHOW_SERVER_ERROR, function (message) {
// #36215
if (message.includes("SC_FORBIDDEN")) {
alert("SC_FORBIDDEN");
return;
}
// #36215
if (message.includes("SC_FORBIDDEN"))
{
alert('SC_FORBIDDEN');
return;
}
if (message == "server error Ocurred") {
message = getLocalizedString("serverErrorOccured");
} else if (message == "Room not found") {
message = getLocalizedString("errorRoomNotFound");
}
$("#customAlertTitle").text(message);
$("#customAlertOk").text(getLocalizedString("yesTitle"));
$("#customAlert")
.appendTo("body")
.modal({
backdrop: "static",
keyboard: false,
})
.on("click", "#customAlertOk", function (e) {});
CHAT_UI.dismissLoadingIndicator();
if (message == "Room not found") {
CHAT.saveRoomInfo();
}
});
};
if (message == 'server error Ocurred') {
message = getLocalizedString("serverErrorOccured");
} else if (message == 'Room not found') {
message = getLocalizedString("errorRoomNotFound");
}
$("#customAlertTitle").text(message);
$("#customAlertOk").text(getLocalizedString("yesTitle"));
var bindOnRetryJoinProcess = function () {
socket.on(SOCKET_KEY.RETRY_JOIN_PROCESS, function () {
var ua = window.navigator.userAgent.toLowerCase();
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.getLoginParameter();
} else {
CHAT_UI.htmlElementTextInitialize("ko");
// webでのsocket connect
emitJoin();
}
});
};
$('#customAlert').appendTo("body").modal({
backdrop: 'static',
keyboard: false
})
.on('click', '#customAlertOk', function(e) {
});
CHAT_UI.dismissLoadingIndicator();
var emitJoin = function () {
socket.emit(SOCKET_KEY.JOIN, params, function (err) {
if (err) {
errorHandlingForEmitJoin();
CHAT_UI.dismissLoadingIndicator();
return;
}
if (message == "Room not found") {
CHAT.saveRoomInfo();
}
});
updateRoomName(params.roomName);
// server's request : user info (retry join)
socket.on("retryJoinProcess", () => {
var ua = window.navigator.userAgent.toLowerCase();
//if ((ua.indexOf('iphone') > 0 || ua.indexOf('ipad') > 0) && ua.indexOf("safari") == -1) {
if (CHAT_UTIL.isIOS()) {
// iosでの場合
webkit.messageHandlers.loginInfoRequestMessageHandlerId.postMessage({});
// } else if (ua.indexOf('android') > 0 && ua.indexOf('linux') == -1){
} else if (CHAT_UTIL.isAndroid()) {
// androidでの場合
android.getLoginParameter();
} else {
CHAT_UI.htmlElementTextInitialize("ko")
// webでのsocket connect
socket.emit('join', params, function(err) {
if (err) {
// #36174
$("#customAlertTitle").text(err);
$("#customAlertOk").text(getLocalizedString("yesTitle"));
// loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
});
};
$('#customAlert').appendTo("body").modal({
backdrop: 'static',
keyboard: false
})
.on('click', '#customAlertOk', function(e) {
});
} else {
if (params.roomName != undefined) {
$('.titleRoomName').text(params.roomName).data('roomName', params.roomName);
} else {
let roomListTitle = getLocalizedString("roomListTitle")
$('.titleRoomName').text(roomListTitle)
}
}
// loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator();
});
}
var errorHandlingForEmitJoin = function () {
const positiveButton = $("#customAlertOk");
// #36174
$("#customAlertTitle").text(err);
positiveButton.text(getLocalizedString("yesTitle"));
$("#customAlert")
.appendTo("body")
.modal({
backdrop: "static",
keyboard: false,
})
}
\ No newline at end of file
.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 CHAT = {};
// test comment
//招待するメンバーを保存する変数
CHAT.globalSelectedUserList = new Array();
CHAT.globalIsInvite = false;
......@@ -15,606 +15,762 @@ var beforeHeight = window.innerHeight;
var beforeWidth = window.innerWidth;
var beforeScroll;
CHAT.saveRoomInfo = function(roomId, roomName) {
CHAT.globalLoginParameter.roomId = roomId;
CHAT.globalLoginParameter.roomName = roomName;
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.roomInfosaveMessageHandlerId.postMessage({"roomId":roomId, "roomName":roomName});
} else if (CHAT_UTIL.isAndroid()) {
if (roomId == undefined && roomName == undefined) {
android.saveVisitRoomInfo('', '');
} else {
android.saveVisitRoomInfo(roomId, roomName);
}
CHAT.saveRoomInfo = function (roomId, roomName) {
CHAT.globalLoginParameter.roomId = roomId;
CHAT.globalLoginParameter.roomName = roomName;
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.roomInfosaveMessageHandlerId.postMessage({
roomId: roomId,
roomName: roomName,
});
} else if (CHAT_UTIL.isAndroid()) {
if (roomId == undefined && roomName == undefined) {
android.saveVisitRoomInfo("", "");
} else {
android.saveVisitRoomInfo(roomId, roomName);
}
}
}
};
// #36170 画像パスが存在しない場合はデフォルトの画像を返す
// 存在する場合はプロフィール画像取得用APIのURLを生成して返す
CHAT.getProfileImgUrl = function(path) {
if (path == undefined || path == "") {
return ASSET_PATH + 'img/noImage.png';
CHAT.getProfileImgUrl = function (path) {
if (path == undefined || path == "") {
return ASSET_PATH + "img/noImage.png";
} else {
if (path.includes("/mnt")) {
var userInfo = path.split("/").reverse();
return (
CMS_SERVER_URL +
"/chatapi/user?profileFileName=" +
userInfo[0] +
"&profileGetLoginId=" +
userInfo[1] +
"&sid=" +
CHAT.globalLoginParameter.sid +
"&cmd=12"
);
} else {
if (path.includes('/mnt')) {
var userInfo = path.split("/").reverse();
return CMS_SERVER_URL + '/chatapi/user?profileFileName=' + userInfo[0] + '&profileGetLoginId=' + userInfo[1] + '&sid=' + CHAT.globalLoginParameter.sid + '&cmd=12';
} else {
return path;
}
return path;
}
}
}
};
// Video のサムネイルファイル生成する
CHAT.createVideoThumbnailAndUpload = function(sourceImage, callback) {
var fileReader = new FileReader();
fileReader.onload = function() {
var blob = new Blob([fileReader.result], {type: sourceImage.type});
var url = URL.createObjectURL(blob);
var video = document.createElement('video');
var timeupdate = function() {
if (snapImage()) {
video.removeEventListener('timeupdate', timeupdate);
video.pause();
}
};
video.addEventListener('loadeddata', function() {
if (snapImage()) {
video.removeEventListener('timeupdate', timeupdate);
}
});
var snapImage = function() {
var canvas = document.createElement('canvas');
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
fetch(canvas.toDataURL("image/jpeg"))
.then(function(res) {
return res.arrayBuffer();
})
.then(function(buf) {
// 回転された画像をFormDataに保存
const newFile = new File([buf], sourceImage.name, {type:"image/jpeg"});
callback(newFile, true);
// ajax End
}).catch((error) => { // fetch Error catch Block
if (error) {
console.log(error)
}
});
return true;
};
video.addEventListener('timeupdate', timeupdate);
video.preload = 'metadata';
video.src = url;
// Load video in Safari / IE11
video.muted = true;
video.playsInline = true;
CHAT.createVideoThumbnailAndUpload = function (sourceImage, callback) {
var fileReader = new FileReader();
fileReader.onload = function () {
var blob = new Blob([fileReader.result], { type: sourceImage.type });
var url = URL.createObjectURL(blob);
var video = document.createElement("video");
var timeupdate = function () {
if (snapImage()) {
video.removeEventListener("timeupdate", timeupdate);
video.pause();
}
};
fileReader.readAsArrayBuffer(sourceImage);
}
video.addEventListener("loadeddata", function () {
if (snapImage()) {
video.removeEventListener("timeupdate", timeupdate);
}
});
var snapImage = function () {
var canvas = document.createElement("canvas");
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
canvas
.getContext("2d")
.drawImage(video, 0, 0, canvas.width, canvas.height);
fetch(canvas.toDataURL("image/jpeg"))
.then(function (res) {
return res.arrayBuffer();
})
.then(function (buf) {
// 回転された画像をFormDataに保存
const newFile = new File([buf], sourceImage.name, {
type: "image/jpeg",
});
callback(newFile, true);
// ajax End
})
.catch((error) => {
// fetch Error catch Block
if (error) {
console.log(error);
}
});
return true;
};
video.addEventListener("timeupdate", timeupdate);
video.preload = "metadata";
video.src = url;
// Load video in Safari / IE11
video.muted = true;
video.playsInline = true;
video.pause();
};
fileReader.readAsArrayBuffer(sourceImage);
};
// Ajaxでイメージをアップロードする
CHAT.uploadImage = function(formData) {
formData.append('roomId', CHAT.globalLoginParameter.roomId);
formData.append('sid', CHAT.globalLoginParameter.sid);
jQuery.ajax({
async: true,
url: CMS_SERVER_URL+"/chatapi/file/upload",
type: "post",
data: formData,
contentType: false,
processData: false,
error: function () {
alert("読み込み失敗");
CHAT_UI.dismissLoadingIndicator();
}
}).done(function(res) {
var imgPath = CMS_SERVER_URL + '/chatapi/file/getImage?fileName=' + res.fileName + '&roomId=' + CHAT.globalLoginParameter.roomId;
var imageName = res.fileName
// uploadFileの判断
var extension = imageName.substr(imageName.lastIndexOf('.') + 1).toLowerCase();
// 画像の処理
if (res.fileType == "jpeg" || res.fileType == "jpg" || res.fileType == "png") {
if (res.thumbnailPath && res.thumbnailPath.length > 0) {
imgPath = CMS_SERVER_URL + '/chatapi/file/getImage?fileName=' + res.thumbImageFileName + '&roomId=' + CHAT.globalLoginParameter.roomId;
imageName = res.thumbImageFileName;
}
let downloadPath = CMS_SERVER_URL + '/chatapi/file/download?fileName=' + imageName + '&roomId=' + CHAT.globalLoginParameter.roomId;
// アップロードが終了した後ローディング画面から離れてメッセージをメッセージを転送する
const lightbox = $('<a/>', {'data-lightbox':'attachedImages', 'data-title':imageName});
const image = $('<img/>', {src:imgPath, width:'auto', style:'max-width:100%', 'data-toggle':'modal', onclick:'imageModal(this);'});
const downloadIcon = $('<a/>', {href:downloadPath, class:'fa fa-download', download:res.fileName});
lightbox.append(image);
lightbox.append(downloadIcon);
let text = lightbox.prop('outerHTML')
let encodedText
try {
encodedText = encodeURIComponent(text)
} catch(e) {
encodedText = text;
}
socket.emit('createMessage', {
text: encodedText + messageSeperator + messageType.IMAGE
}, 1);
} else { // 動画の処理
if (res.thumbnailPath && res.thumbnailPath.length > 0) {
imgPath = CMS_SERVER_URL + '/chatapi/file/getImage?fileName=' + res.thumbImageFileName + '&roomId=' + CHAT.globalLoginParameter.roomId;
}
let downloadPath = CMS_SERVER_URL + '/chatapi/file/download?fileName=' + imageName + '&roomId=' + CHAT.globalLoginParameter.roomId;
var videoSrc = CMS_SERVER_URL + '/chatapi/file/getImage?fileName=' + res.fileName + '&roomId=' + CHAT.globalLoginParameter.roomId;
const totalDiv = $('<div/>', {id:"attachedImages"});
const videoTag = $('<video/>', {controls:"true", width:'auto', style:'max-width:100%'});
const source = $('<source/>', {src:videoSrc});
const downloadIcon = $('<a/>',{href:downloadPath, class:'fa fa-download', download:res.fileName});
videoTag.append(source);
totalDiv.append(videoTag);
totalDiv.append(downloadIcon);
let text = totalDiv.prop('outerHTML');
let encodedText
try {
encodedText = encodeURIComponent(text)
} catch(e) {
encodedText = text;
}
socket.emit('createMessage', {
text: encodedText + messageSeperator + messageType.VIDEO
}, 1);
}
$('.overlay').removeClass('active undismissable');
$('.loader').removeClass('active');
CHAT.uploadImage = function (formData) {
formData.append("roomId", CHAT.globalLoginParameter.roomId);
formData.append("sid", CHAT.globalLoginParameter.sid);
jQuery
.ajax({
async: true,
url: CMS_SERVER_URL + "/chatapi/file/upload",
type: "post",
data: formData,
contentType: false,
processData: false,
error: function () {
alert("読み込み失敗");
CHAT_UI.dismissLoadingIndicator();
},
})
}
CHAT.createGetDataUrl = function(fileName, roomId) {
var filePath = CMS_SERVER_URL + '/chatapi/file/getImage?sid=' + CHAT.globalLoginParameter.sid + '&fileName=' + fileName + '&roomId=' + roomId;
return filePath;
}
// Thumbnailのファイルを生成する。
CHAT.createThumbnailAndUpload = function(sourceImage, callback) {
const fileReader = new FileReader();
const img = new Image();
fileReader.onloadend = function() {
img.src = fileReader.result
}
img.onload = function() {
const elem = document.createElement('canvas');
var rate
var width = img.width
var height = img.height
if ((img.width <= 500) && (img.height <= 500))
{
callback(undefined, false)
return
.done(function (res) {
var imgPath =
CMS_SERVER_URL +
"/chatapi/file/getImage?fileName=" +
res.fileName +
"&roomId=" +
CHAT.globalLoginParameter.roomId;
var imageName = res.fileName;
// uploadFileの判断
var extension = imageName
.substr(imageName.lastIndexOf(".") + 1)
.toLowerCase();
// 画像の処理
if (
res.fileType == "jpeg" ||
res.fileType == "jpg" ||
res.fileType == "png"
) {
if (res.thumbnailPath && res.thumbnailPath.length > 0) {
imgPath =
CMS_SERVER_URL +
"/chatapi/file/getImage?fileName=" +
res.thumbImageFileName +
"&roomId=" +
CHAT.globalLoginParameter.roomId;
imageName = res.thumbImageFileName;
}
let downloadPath =
CMS_SERVER_URL +
"/chatapi/file/download?fileName=" +
imageName +
"&roomId=" +
CHAT.globalLoginParameter.roomId;
// アップロードが終了した後ローディング画面から離れてメッセージをメッセージを転送する
const lightbox = $("<a/>", {
"data-lightbox": "attachedImages",
"data-title": imageName,
});
const image = $("<img/>", {
src: imgPath,
width: "auto",
style: "max-width:100%",
"data-toggle": "modal",
onclick: "imageModal(this);",
});
const downloadIcon = $("<a/>", {
href: downloadPath,
class: "fa fa-download",
download: res.fileName,
});
if (img.width > img.height)
{
rate = 500/img.width
} else {
rate = 500/img.height
lightbox.append(image);
lightbox.append(downloadIcon);
let text = lightbox.prop("outerHTML");
let encodedText;
try {
encodedText = encodeURIComponent(text);
} catch (e) {
encodedText = text;
}
elem.width = width * rate;
elem.height = height * rate;
const ctx = elem.getContext('2d')
ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, elem.width, elem.height);
// ctx.drawImage(img, 0, 0, width, height);
fetch(elem.toDataURL("image/jpeg"))
.then(function(res) {
return res.arrayBuffer();
})
.then(function(buf) {
const newFile = new File([buf], sourceImage.name, {type:"image/jpeg"});
callback(newFile, true)
socket.emit(
"createMessage",
{
text: encodedText + messageSeperator + MessageType.IMAGE,
},
1
);
} else {
// 動画の処理
if (res.thumbnailPath && res.thumbnailPath.length > 0) {
imgPath =
CMS_SERVER_URL +
"/chatapi/file/getImage?fileName=" +
res.thumbImageFileName +
"&roomId=" +
CHAT.globalLoginParameter.roomId;
}
}).catch((error) => { // fetch Error catch Block
if (error) {
console.log(error)
}
let downloadPath =
CMS_SERVER_URL +
"/chatapi/file/download?fileName=" +
imageName +
"&roomId=" +
CHAT.globalLoginParameter.roomId;
var videoSrc =
CMS_SERVER_URL +
"/chatapi/file/getImage?fileName=" +
res.fileName +
"&roomId=" +
CHAT.globalLoginParameter.roomId;
const totalDiv = $("<div/>", { id: "attachedImages" });
const videoTag = $("<video/>", {
controls: "true",
width: "auto",
style: "max-width:100%",
});
const source = $("<source/>", { src: videoSrc });
const downloadIcon = $("<a/>", {
href: downloadPath,
class: "fa fa-download",
download: res.fileName,
});
}
fileReader.readAsDataURL(sourceImage);
}
// 該当チャットルームに参加するためログイン情報をサーバに渡す
getLoginParameter = function(sid, loginId, shopName, roomId = undefined, roomName = undefined, languageCode, shopMemberId) {
var loginParam = new Object()
loginParam.sid = sid;
loginParam.loginId = loginId;
loginParam.shopName = shopName;
loginParam.roomId = roomId;
loginParam.roomName = roomName;
loginParam.shopMemberId = shopMemberId;
CHAT.globalLoginParameter = loginParam;
if (!languageCode) {
languageCode = "en"
}
// fermi coview share
globalUserInfo.sid = sid;
globalUserInfo.loginId = shopName + '_' + loginId;
globalUserInfo.shopName = shopName;
globalUserInfo.roomId = roomId;
globalUserInfo.roomName = roomName;
globalUserInfo.languageCode = languageCode;
videoTag.append(source);
totalDiv.append(videoTag);
totalDiv.append(downloadIcon);
CHAT_UI.htmlElementTextInitialize(languageCode);
CHAT_UI.dismissLoadingIndicator();
}
let text = totalDiv.prop("outerHTML");
let encodedText;
try {
encodedText = encodeURIComponent(text);
} catch (e) {
encodedText = text;
}
CHAT.leaveRoom = function() {
socket.emit('leaveRoom', function() {
socket.emit(
"createMessage",
{
text: encodedText + messageSeperator + MessageType.VIDEO,
},
1
);
}
$(".overlay").removeClass("active undismissable");
$(".loader").removeClass("active");
CHAT_UI.dismissLoadingIndicator();
});
}
};
$(function() {
// ルーム名変更イベント
$('.change_room_name_btn button').click(function(){
$('form').submit();
});
CHAT.createGetDataUrl = function (fileName, roomId) {
var filePath =
CMS_SERVER_URL +
"/chatapi/file/getImage?sid=" +
CHAT.globalLoginParameter.sid +
"&fileName=" +
fileName +
"&roomId=" +
roomId;
return filePath;
};
// 検索アイコン押下イベント
$('.nav_item_wrap .search_menu').click(function(){
$('.nav_item_wrap').addClass('none');
$('.footer-wrap').addClass('none');
$('.chat_room_src_form').removeClass('none');
$('.room_container').addClass('none');
$('.overlay_src_msg').removeClass('none');
// フィルタ表示
$('#filter').removeClass('none');
$('#user_list').addClass('none');
$('.chat_room_src_form input[type="search"]').focus();
$('#searchMessage').addClass('onfocus');
$('.chat_list').removeClass('none');
});
$('.chat_room_src_form .cancel').click(function(){
$('.nav_item_wrap').removeClass('none');
$('.footer-wrap').removeClass('none');
$('.chat_room_src_form').addClass('none');
$('.chat_room_src_form input').val('');
$('.room_container').removeClass('none');
$('.overlay_src_msg').empty();
// ユーザーリスト表示
$('#filter').addClass('none');
$('#user_list').removeClass('none');
// Thumbnailのファイルを生成する。
CHAT.createThumbnailAndUpload = function (sourceImage, callback) {
const fileReader = new FileReader();
const img = new Image();
fileReader.onloadend = function () {
img.src = fileReader.result;
};
img.onload = function () {
const elem = document.createElement("canvas");
var rate;
var width = img.width;
var height = img.height;
if (img.width <= 500 && img.height <= 500) {
callback(undefined, false);
return;
}
$('.chat_room_src_form input[type="search"]').blur();
$('#searchMessage').removeClass('onfocus');
$('.chat_list').addClass('none');
CHAT_UI.scrollToBottom();
});
if (img.width > img.height) {
rate = 500 / img.width;
} else {
rate = 500 / img.height;
}
elem.width = width * rate;
elem.height = height * rate;
const ctx = elem.getContext("2d");
ctx.drawImage(
img,
0,
0,
img.width,
img.height,
0,
0,
elem.width,
elem.height
);
// ctx.drawImage(img, 0, 0, width, height);
fetch(elem.toDataURL("image/jpeg"))
.then(function (res) {
return res.arrayBuffer();
})
.then(function (buf) {
const newFile = new File([buf], sourceImage.name, {
type: "image/jpeg",
});
$('.chat_room_src_form input[type="search"]').click(function() {
if($('#searchMessage').hasClass('onfocus')) {
$('#searchMessage').removeClass('onfocus');
$('#searchMessage').blur();
} else {
$('#searchMessage').addClass('onfocus');
$('#searchMessage').focus();
callback(newFile, true);
})
.catch((error) => {
// fetch Error catch Block
if (error) {
console.log(error);
}
})
});
};
$('#searchMessage').blur(function() {
$('#searchMessage').removeClass('onfocus');
})
fileReader.readAsDataURL(sourceImage);
};
// フィルタ選択イベント
$(document).on('click', '#filter .img_wrap', function(event) {
// チェックアイコン追加
$(this).toggleClass("filter");
});
// 該当チャットルームに参加するためログイン情報をサーバに渡す
getLoginParameter = function (
sid,
loginId,
shopName,
roomId = undefined,
roomName = undefined,
languageCode,
shopMemberId
) {
var loginParam = new Object();
loginParam.sid = sid;
loginParam.loginId = loginId;
loginParam.shopName = shopName;
loginParam.roomId = roomId;
loginParam.roomName = roomName;
loginParam.shopMemberId = shopMemberId;
CHAT.globalLoginParameter = loginParam;
if (!languageCode) {
languageCode = "en";
}
// fermi coview share
globalUserInfo.sid = sid;
globalUserInfo.loginId = shopName + "_" + loginId;
globalUserInfo.shopName = shopName;
globalUserInfo.roomId = roomId;
globalUserInfo.roomName = roomName;
globalUserInfo.languageCode = languageCode;
CHAT_UI.htmlElementTextInitialize(languageCode);
CHAT_UI.dismissLoadingIndicator();
};
$('#chat .search_form input[type="search"]').click(function(){
let roomListTitle = getLocalizedString("room_search_placeholder");
$('#chatTitle').text(roomListTitle);
});
// for android native call
CHAT.leaveRoom = function () {
socket.emit("leaveRoom", function () {});
};
$('#chat .search_form .cancel').click(function(){
let roomListTitle = getLocalizedString("roomListTitle");
$('#chatTitle').text(roomListTitle);
});
document.addEventListener("DOMContentLoaded", function () {
// ルーム名変更イベント
$(".change_room_name_btn button").click(function () {
$("form").submit();
});
// 検索アイコン押下イベント
$(".nav_item_wrap .search_menu").click(function () {
$(".nav_item_wrap").addClass("none");
$(".footer-wrap").addClass("none");
$(".chat_room_src_form").removeClass("none");
$(".room_container").addClass("none");
$(".overlay_src_msg").removeClass("none");
// フィルタ表示
$("#filter").removeClass("none");
$("#user_list").addClass("none");
$('.chat_room_src_form input[type="search"]').focus();
$("#searchMessage").addClass("onfocus");
$(".chat_list").removeClass("none");
});
$(".chat_room_src_form .cancel").click(function () {
$(".nav_item_wrap").removeClass("none");
$(".footer-wrap").removeClass("none");
$(".chat_room_src_form").addClass("none");
$(".chat_room_src_form input").val("");
$(".room_container").removeClass("none");
$(".overlay_src_msg").empty();
// ユーザーリスト表示
$("#filter").addClass("none");
$("#user_list").removeClass("none");
$('.chat_room_src_form input[type="search"]').blur();
$("#searchMessage").removeClass("onfocus");
$(".chat_list").addClass("none");
CHAT_UI.scrollToBottom();
});
$('.chat_room_src_form input[type="search"]').click(function () {
if ($("#searchMessage").hasClass("onfocus")) {
$("#searchMessage").removeClass("onfocus");
$("#searchMessage").blur();
} else {
$("#searchMessage").addClass("onfocus");
$("#searchMessage").focus();
}
});
$('#chat_add_user .search_form .cancel').click(function() {
let roomListTitle = getLocalizedString("inviteUsersSubtitle");
$('#addUserTitle').text(roomListTitle);
});
$("#searchMessage").blur(function () {
$("#searchMessage").removeClass("onfocus");
});
$('#chatMakeRoom .search_form .cancel').click(function() {
let roomListTitle = getLocalizedString("createRoomTitle");
$('#makeRoomTitle').text(roomListTitle);
});
// フィルタ選択イベント
$(document).on("click", "#filter .img_wrap", function (event) {
// チェックアイコン追加
$(this).toggleClass("filter");
});
// チャットメンバー検索
$('#chat .search_form input[type="search"]').keyup(function(e){
$('#chat .search_form input[type="search"]').click(function () {
let roomListTitle = getLocalizedString("room_search_placeholder");
$("#chatTitle").text(roomListTitle);
});
$("#chat .search_form .cancel").click(function () {
let roomListTitle = getLocalizedString("roomListTitle");
$("#chatTitle").text(roomListTitle);
});
$("#chat_add_user .search_form .cancel").click(function () {
let roomListTitle = getLocalizedString("inviteUsersSubtitle");
$("#addUserTitle").text(roomListTitle);
});
$("#chatMakeRoom .search_form .cancel").click(function () {
let roomListTitle = getLocalizedString("createRoomTitle");
$("#makeRoomTitle").text(roomListTitle);
});
// チャットメンバー検索
$('#chat .search_form input[type="search"]').keyup(function (e) {
var rooms;
var keyword = $('#chat .search_form input[type="search"]').val();
if (e.KeyCode == 13 || e.key == "Enter") {
if (keyword.length != 0 && keyword != "") {
$('#chat .search_form input[type="search"]').blur();
return;
}
} else if (keyword == "" || keyword.length < 2) {
$(".overlay_src_msg").empty();
return;
}
CHAT.searchRoom(keyword, rooms);
if (e.KeyCode == 13 || e.key == "Enter") {
$('#chat .search_form input[type="search"]').blur();
return;
}
});
// iOSキーボード変換検知用
$('#chat .search_form input[type="search"]').on(
"compositionend",
function () {
if (CHAT_UTIL.isIOS()) {
var rooms;
var keyword = $('#chat .search_form input[type="search"]').val();
if (e.KeyCode == 13 || e.key == "Enter") {
if (keyword.length != 0 && keyword != '') {
$('#chat .search_form input[type="search"]').blur();
return;
}
} else if (keyword == '' || keyword.length < 2) {
$('.overlay_src_msg').empty();
return;
}
CHAT.searchRoom(keyword, rooms);
if (e.KeyCode == 13 || e.key == "Enter") {
$('#chat .search_form input[type="search"]').blur();
return ;
}
});
// iOSキーボード変換検知用
$('#chat .search_form input[type="search"]').on('compositionend', function(){
if (CHAT_UTIL.isIOS()) {
var rooms;
var keyword = $('#chat .search_form input[type="search"]').val();
CHAT.searchRoom(keyword, rooms);
}
});
var footerHeight = $('.footer-wrap').height();
window.addEventListener("resize", function() {
var afterHeight = window.innerHeight;
var afterWidth = window.innerWidth;
var moreScroll = beforeHeight - afterHeight;
if (beforeHeight > afterHeight && (beforeHeight - afterHeight) > 50) {
if (CHAT_UTIL.isIOS()) {
window.scrollTo(0, beforeScroll + moreScroll);
} else if (beforeWidth == afterWidth) {
//キーボード表示時
$('.room_container').css('margin-bottom', 0);
window.scrollTo(0, beforeScroll + moreScroll - $('.footer_content_b').height());
} else {
//画面回転時
window.scrollTo(0, beforeScroll + (moreScroll * 2) - $('.footer_content_b').height());
}
} else if (beforeHeight < afterHeight) {
$('.room_container').css('margin-bottom', footerHeight);
if (CHAT_UTIL.isIOS()) {
window.scrollTo(0, beforeScroll + moreScroll);
} else if (beforeWidth == afterWidth) {
//キーボード非表示
window.scrollTo(0, beforeScroll + moreScroll + $('.footer_content_b').height());
} else {
//画面回転時
window.scrollTo(0, beforeScroll + (moreScroll * 2) + $('.footer_content_b').height());
}
}
beforeHeight = window.innerHeight;
beforeWidth = window.innerWidth;
});
$('#messageInput').focusin(function(e) {
beforeHeight = window.innerHeight;
beforeWidth = window.innerWidth;
beforeScroll = window.scrollY;
})
// チャットルーム
// メッセージ検索イベント
$('.chat_room_src_form input[type="search"]').keyup(function(e){
}
}
);
var footerHeight = $(".footer-wrap").height();
window.addEventListener("resize", function () {
var afterHeight = window.innerHeight;
var afterWidth = window.innerWidth;
var moreScroll = beforeHeight - afterHeight;
if (beforeHeight > afterHeight && beforeHeight - afterHeight > 50) {
if (CHAT_UTIL.isIOS()) {
window.scrollTo(0, beforeScroll + moreScroll);
} else if (beforeWidth == afterWidth) {
//キーボード表示時
$(".room_container").css("margin-bottom", 0);
window.scrollTo(
0,
beforeScroll + moreScroll - $(".footer_content_b").height()
);
} else {
//画面回転時
window.scrollTo(
0,
beforeScroll + moreScroll * 2 - $(".footer_content_b").height()
);
}
} else if (beforeHeight < afterHeight) {
$(".room_container").css("margin-bottom", footerHeight);
if (CHAT_UTIL.isIOS()) {
window.scrollTo(0, beforeScroll + moreScroll);
} else if (beforeWidth == afterWidth) {
//キーボード非表示
window.scrollTo(
0,
beforeScroll + moreScroll + $(".footer_content_b").height()
);
} else {
//画面回転時
window.scrollTo(
0,
beforeScroll + moreScroll * 2 + $(".footer_content_b").height()
);
}
}
beforeHeight = window.innerHeight;
beforeWidth = window.innerWidth;
});
$("#messageInput").focusin(function (e) {
beforeHeight = window.innerHeight;
beforeWidth = window.innerWidth;
beforeScroll = window.scrollY;
});
// チャットルーム
// メッセージ検索イベント
$('.chat_room_src_form input[type="search"]').keyup(function (e) {
let workVal = "";
var keyword = $('.chat_room_src_form input[type="search"]').val();
if (e.key == "Enter" || e.KeyCode == 13) {
if (keyword != "" && keyword.length != 0) {
$('.chat_room_src_form input[type="search"]').blur();
return;
}
} else if (keyword == "" || keyword.length < 2) {
$(".overlay_src_msg").empty();
return;
}
CHAT.searchMessage(keyword, workVal);
if (e.key == "Enter" || e.KeyCode == 13) {
$("#searchMessage").removeClass("onfocus");
$('.chat_room_src_form input[type="search"]').blur();
return;
}
});
// iOSキーボード変換検知用
$('.chat_room_src_form input[type="search"]').on(
"compositionend",
function () {
if (CHAT_UTIL.isIOS()) {
let workVal = "";
var keyword = $('.chat_room_src_form input[type="search"]').val();
if (e.key == "Enter" || e.KeyCode == 13) {
if (keyword != '' && keyword.length != 0) {
$('.chat_room_src_form input[type="search"]').blur();
return;
}
} else if (keyword == '' || keyword.length < 2) {
$('.overlay_src_msg').empty();
return;
}
CHAT.searchMessage(keyword, workVal);
if (e.key == "Enter" || e.KeyCode == 13) {
$('#searchMessage').removeClass('onfocus');
$('.chat_room_src_form input[type="search"]').blur();
return;
}
});
// iOSキーボード変換検知用
$('.chat_room_src_form input[type="search"]').on('compositionend', function(){
if (CHAT_UTIL.isIOS()) {
let workVal = "";
var keyword = $('.chat_room_src_form input[type="search"]').val();
CHAT.searchMessage(keyword, workVal);
}
});
$(document).on('click', '.filter_img', function(event) {
let workVal = "";
var keyword = $('.chat_room_src_form input[type="search"]').val();
$('.overlay_src_msg').empty();
var checkedUserList = [];
$('.img_wrap.filter').each(function(user) {
var selectedUser = $('.img_wrap.filter')[user];
checkedUserList.push($(selectedUser).data('user-id'));
})
if (keyword.length == 1) { return; }
var messages = CHAT_DB.searchMessages(keyword, checkedUserList.join(','));
var userMessageTemplate;
$.get({ url: "./template/template_user_message.html", async: false }
, function(text) {
userMessageTemplate = text;
});
var myMessageTemplate;
$.get({ url: "./template/template_my_message.html", async: false }
, function(text) {
myMessageTemplate = text;
});
let jQueryMessages = $('.overlay_src_msg');
messages.forEach(function(message) {
let template = userMessageTemplate;
if (message.shopMemberId == CHAT.globalLoginParameter.shopMemberId) {
template = myMessageTemplate;
}
if (message.messageType == messageType.SYSTEM) {
template = systemMessageTemplate;
}
let messageTime = CHAT_UTIL.formatDate(message.insertDate);
// ユーザの様式を読み込む
if (message.profileUrl) {
message.profileUrl = CHAT.getProfileImgUrl(message.profileUrl)
} else {
message.profileUrl = CHAT.getProfileImgUrl("")
}
message.message = message.message.toString();
var replacePath = message.message;
replacePath = replacePath.replaceAll('?fileName=', '?sid=' + CHAT.globalLoginParameter.sid + '&fileName=');
message.message = replacePath;
let html = Mustache.render(template, {
text: message.message,
from: message.loginId,
shopMemberId: message.shopMemberId,
profileImage: message.profileUrl,
createdAtDay: messageTime.createdAtDay,
createdAtTime: messageTime.createdAtTime
});
html = message.message.includes('attachedImages') || message.message.includes('attachedVideos') ? CHAT_UTIL.htmlDecode(html) : html;
workVal = html + workVal;
})
jQueryMessages.prepend(workVal);
}
}
);
$(document).on("click", ".filter_img", function (event) {
let workVal = "";
var keyword = $('.chat_room_src_form input[type="search"]').val();
$(".overlay_src_msg").empty();
let checkedUserList = getCheckedUserList();
if (keyword.length == 1) {
return;
}
const messages = CHAT_DB.searchMessages(keyword, checkedUserList.join(","));
var userMessageTemplate = getTemplate(TemplateURL.USER_MESSAGE);
var myMessageTemplate = getTemplate(TemplateURL.MY_MESSAGE);
let jQueryMessages = $(".overlay_src_msg");
messages.forEach(function (message) {
let template = userMessageTemplate;
if (message.shopMemberId == CHAT.globalLoginParameter.shopMemberId) {
template = myMessageTemplate;
}
if (message.messageType == MessageType.SYSTEM) {
template = systemMessageTemplate;
}
let messageTime = CHAT_UTIL.formatDate(message.insertDate);
// ユーザの様式を読み込む
if (message.profileUrl) {
message.profileUrl = CHAT.getProfileImgUrl(message.profileUrl);
} else {
message.profileUrl = CHAT.getProfileImgUrl("");
}
message.message = message.message.toString();
var replacePath = message.message;
replacePath = replacePath.replaceAll(
"?fileName=",
"?sid=" + CHAT.globalLoginParameter.sid + "&fileName="
);
message.message = replacePath;
let html = Mustache.render(template, {
text: message.message,
from: message.loginId,
shopMemberId: message.shopMemberId,
profileImage: message.profileUrl,
createdAtDay: messageTime.createdAtDay,
createdAtTime: messageTime.createdAtTime,
});
html =
message.message.includes("attachedImages") ||
message.message.includes("attachedVideos")
? CHAT_UTIL.htmlDecode(html)
: html;
workVal = html + workVal;
});
jQueryMessages.prepend(workVal);
});
});
var getCheckedUserList = function () {
let checkedUserList = [];
$(".img_wrap.filter").each(function (user) {
const selectedUser = $(".img_wrap.filter")[user];
checkedUserList.push($(selectedUser).data("user-id"));
});
return checkedUserList;
};
// チャットルーム検索
CHAT.searchRoom = function(keyword, rooms) {
$('.overlay_src_msg').empty();
rooms = CHAT_DB.getRoomList(chatRoomType.ALL, keyword);
let roomListTitle = getLocalizedString("room_search_placeholder");
$('#chatTitle').text(roomListTitle);
var template;
$.get({ url: "./template/template_room_list.html", async: false }
, function(text) {
template = text;
});
rooms.forEach(function(room) {
room.profileImagePath = ASSET_PATH + 'images/user-profile.png'
if (room.message) {
room.message = room.message.toString()
} else {
room.message = getLocalizedString("noMessages")
}
var displayMsg;
if (room.messageType == messageType.TEXT || room.messageType == messageType.SYSTEM) displayMsg = room.message;
if (room.messageType == messageType.IMAGE) displayMsg = getLocalizedString("image");
if (room.messageType == messageType.VIDEO) displayMsg = getLocalizedString("video");
if (room.messageType == messageType.TEXT) displayMsg = room.message;
if (room.messageType == messageType.COMMUNICATIONSTART) displayMsg = getLocalizedString("collaboration_start");
if (room.messageType == messageType.COMMUNICATIONEND) displayMsg = getLocalizedString("collaboration_end");
var attendUserName = [];
room.attendUsers.forEach(function(user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
attendUserName.push(user.shopMemberName);
});
var thumbnailCount = room.attendUsers.length > 4 ? 4 : room.attendUsers.length;
if (room.chatRoomName == "") {
room.chatRoomName = attendUserName.join(', ');
}
let html = Mustache.render(template, {
thumbnailCount: thumbnailCount,
roomName: room.chatRoomName,
roomId: room.chatRoomId,
profileImage: room.profileImagePath,
lastMessage: displayMsg ,
time: room.insertDate ? CHAT_UTIL.formatDate(room.insertDate).createdAt : '',
unreadMsgCnt: room.unreadCount == 0 ? '' : room.unreadCount,
userCnt: room.attendUsers.length + 1,
attendUsers: room.attendUsers
});
// Click event
let obj = jQuery.parseHTML(html);
$('.overlay_src_msg').append(obj);
});
if (rooms.length == 0) {
const noResultMsg = $('<div/>',{width:'auto', style:'text-align: center'});
noResultMsg.append(getLocalizedString("noResult"))
$('.overlay_src_msg').append(noResultMsg);
}
CHAT.searchRoom = function (keyword, rooms) {
const overlayMessage = $(".overlay_src_msg");
overlayMessage.empty();
rooms = CHAT_DB.getRoomList(ChatRoomType.ALL, keyword);
let roomListTitle = getLocalizedString("room_search_placeholder");
$("#chatTitle").text(roomListTitle);
var template = getTemplate(TemplateURL.ROOM_LIST);
rooms.forEach(function (room) {
room.profileImagePath = ASSET_PATH + "images/user-profile.png";
const roomMessage = getRoomMessage(room.message);
const displayMessage = getDisplayMessage(room.messageType, roomMessage);
let html = renderRoom(template, room, displayMessage);
// Click event
let obj = jQuery.parseHTML(html);
overlayMessage.append(obj);
});
if (rooms.length == 0) {
const noResultMsg = getNoResultMessage();
overlayMessage.append(noResultMsg);
}
};
// メッセージ検索
CHAT.searchMessage = function(keyword, workVal) {
$('.overlay_src_msg').empty();
var checkedUserList = [];
$('.img_wrap.filter').each(function(user) {
var selectedUser = $('.img_wrap.filter')[user];
checkedUserList.push($(selectedUser).data('user-id'));
})
var messages = CHAT_DB.searchMessages(keyword, checkedUserList.join(','));
var userMessageTemplate;
$.get({ url: "./template/template_user_message.html", async: false }
, function(text) {
userMessageTemplate = text;
});
var myMessageTemplate;
$.get({ url: "./template/template_my_message.html", async: false }
, function(text) {
myMessageTemplate = text;
});
var getRoomMessage = function (message) {
if (message) {
return message.toString();
} else {
return getLocalizedString("noMessages");
}
};
let jQueryMessages = $('.overlay_src_msg');
messages.forEach(function(message) {
let template = userMessageTemplate;
if (message.shopMemberId == CHAT.globalLoginParameter.shopMemberId) {
template = myMessageTemplate;
}
if (message.messageType == messageType.SYSTEM) {
template = systemMessageTemplate;
}
let messageTime = CHAT_UTIL.formatDate(message.insertDate);
if (message.profileUrl) {
message.profileUrl = CHAT.getProfileImgUrl(message.profileUrl)
} else {
message.profileUrl = CHAT.getProfileImgUrl("")
}
message.message = message.message.toString();
var replacePath = message.message;
replacePath = replacePath.replaceAll('?fileName=', '?sid=' + CHAT.globalLoginParameter.sid + '&fileName=');
message.message = replacePath;
let html = Mustache.render(template, {
text: message.message,
from: message.loginId,
shopMemberId: message.shopMemberId,
profileImage: message.profileUrl,
createdAtDay: messageTime.createdAtDay,
createdAtTime: messageTime.createdAtTime
});
html = message.message.includes('attachedImages') || message.message.includes('attachedVideos') ? CHAT_UTIL.htmlDecode(html) : html;
workVal = html + workVal;
})
jQueryMessages.prepend(workVal);
if (messages.length == 0) {
const noResultMsg = $('<div/>',{width:'auto', style:'text-align: center'});
noResultMsg.append(getLocalizedString("noResult"))
jQueryMessages.append(noResultMsg);
var getDisplayMessage = function (messageType, roomMessage) {
switch (messageType) {
case MessageType.TEXT:
return roomMessage;
case MessageType.SYSTEM:
return roomMessage;
case MessageType.IMAGE:
return getLocalizedString("image");
case MessageType.VIDEO:
return getLocalizedString("video");
case MessageType.COMMUNICATIONSTART:
return getLocalizedString("collaboration_start");
case MessageType.COMMUNICATIONEND:
return getLocalizedString("collaboration_end");
default:
return "";
}
};
var renderRoom = function (template, room, displayMessage) {
var attendUserName = [];
room.attendUsers.forEach(function (user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
attendUserName.push(user.shopMemberName);
});
const thumbnailCount =
room.attendUsers.length > 4 ? 4 : room.attendUsers.length;
const time = room.insertDate
? CHAT_UTIL.formatDate(room.insertDate).createdAt
: "";
if (room.chatRoomName == "") {
room.chatRoomName = attendUserName.join(", ");
}
return Mustache.render(template, {
thumbnailCount: thumbnailCount,
roomName: room.chatRoomName,
roomId: room.chatRoomId,
profileImage: room.profileImagePath,
lastMessage: displayMessage,
time: time,
unreadMsgCnt: room.unreadCount == 0 ? "" : room.unreadCount,
userCnt: room.attendUsers.length + 1,
attendUsers: room.attendUsers,
});
};
// メッセージ検索
CHAT.searchMessage = function (keyword, workVal) {
$(".overlay_src_msg").empty();
var checkedUserList = [];
$(".img_wrap.filter").each(function (user) {
const selectedUser = $(".img_wrap.filter")[user];
checkedUserList.push($(selectedUser).data("user-id"));
});
var messages = CHAT_DB.searchMessages(keyword, checkedUserList.join(","));
var userMessageTemplate = getTemplate(TemplateURL.USER_MESSAGE);
var myMessageTemplate = getTemplate(TemplateURL.MY_MESSAGE);
let jQueryMessages = $(".overlay_src_msg");
messages.forEach(function (message) {
let template = userMessageTemplate;
if (message.shopMemberId == CHAT.globalLoginParameter.shopMemberId) {
template = myMessageTemplate;
}
if (message.messageType == MessageType.SYSTEM) {
template = systemMessageTemplate;
}
let messageTime = CHAT_UTIL.formatDate(message.insertDate);
if (message.profileUrl) {
message.profileUrl = CHAT.getProfileImgUrl(message.profileUrl);
} else {
message.profileUrl = CHAT.getProfileImgUrl("");
}
message.message = message.message.toString();
var replacePath = message.message;
replacePath = replacePath.replaceAll(
"?fileName=",
"?sid=" + CHAT.globalLoginParameter.sid + "&fileName="
);
message.message = replacePath;
let html = Mustache.render(template, {
text: message.message,
from: message.loginId,
shopMemberId: message.shopMemberId,
profileImage: message.profileUrl,
createdAtDay: messageTime.createdAtDay,
createdAtTime: messageTime.createdAtTime,
});
html =
message.message.includes("attachedImages") ||
message.message.includes("attachedVideos")
? CHAT_UTIL.htmlDecode(html)
: html;
workVal = html + workVal;
});
jQueryMessages.prepend(workVal);
if (messages.length == 0) {
const noResultMsg = getNoResultMessage();
jQueryMessages.append(noResultMsg);
}
};
// 名前空間
var CHAT_MAKE_ROOM = {};
$(function() {
// メンバー検索
$('#chatMakeRoom .search_form input[type="search"]').click(function(e) {
let contactListTitle = getLocalizedString("userSearch");
$('#makeRoomTitle').text(contactListTitle);
});
$('#chatMakeRoom .search_form input[type="search"]').keyup(function(e) {
//画面タイトル設定
var keyword = $('#chatMakeRoom .search_form input[type="search"]').val();
if (e.KeyCode == 13 || e.key == "Enter") {
if (keyword != '' && keyword.length != 0) {
$('#chatMakeRoom .search_form input[type="search"]').blur();
return false;
}
} else if (keyword == '' || keyword.length < 2) {
$('.overlay_src_msg').empty();
return false;
}
CHAT_MAKE_ROOM.searchUser(keyword);
if (e.key == "Enter" || e.KeyCode == 13) {
$('#chatMakeRoom .search_form input[type="search"]').blur();
return;
}
});
// iOSキーボード変換検知用
$('#chatMakeRoom .search_form input[type="search"]').on('compositionend', function() {
if (CHAT_UTIL.isIOS()) {
var keyword = $('#chatMakeRoom .search_form input[type="search"]').val();
CHAT_MAKE_ROOM.searchUser(keyword);
}
});
document.addEventListener("DOMContentLoaded", function () {
// メンバー検索
searchMember();
// iOSキーボード変換検知用
bindiOSKeyBoardEvent();
});
// メンバー検索
CHAT_MAKE_ROOM.searchUser = function(keyword) {
var isAllGroup = $('#tabAllGroupOnMakeRoom').is(':checked');
$('.overlay_src_msg').empty();
CHAT_MAKE_ROOM.searchUser = function (keyword) {
const overlayMessage = $(".overlay_src_msg");
const isAllGroup = $("#tabAllGroupOnMakeRoom").is(":checked");
let hasNoData = false;
overlayMessage.empty();
//全グループ検索画面
if (isAllGroup) {
//グループデータ検索
var groupList = CHAT_DB.getGroupByName(keyword);
var groupTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_LIST);
groupList.forEach(function (group) {
renderRoomList(groupTemplate, group.groupName, group.groupId);
let obj = jQuery.parseHTML(html);
overlayMessage.append(obj);
});
//ユーザデータ検索
var userList = CHAT_DB.getAllGroupShopMemberByName(keyword);
searchUserData(userList);
var userTemplate = getTemplate(TemplateURL.MAKE_ROOM_USER_LIST);
let html = renderUser(userTemplate, userList);
let obj = jQuery.parseHTML(html);
overlayMessage.append(obj);
hasNoData = groupList.length == 0 && userList.length == 0;
//連絡先画面
} else {
const userList = CHAT_DB.getMyGroupShopMemberByName(keyword);
searchUserData();
var userTemplate = getTemplate(TemplateURL.MAKE_ROOM_USER_LIST);
let html = renderUser(userTemplate, userList);
let obj = jQuery.parseHTML(html);
$(".overlay_src_msg").html(obj);
//全グループ検索画面
if (isAllGroup) {
//グループデータ検索
var groupList = CHAT_DB.getGroupByName(keyword);
var groupTemplate;
$.get({ url: "./template/template_make_room_group_list.html", async: false }
, function(text) {
groupTemplate = text;
});
hasNoData = userList.length == 0;
}
groupList.forEach(function(group) {
let html = Mustache.render(groupTemplate, {
name: group.groupName,
id: group.groupId,
});
if (hasNoData) {
const noResultMsg = getNoResultMessage();
overlayMessage.append(noResultMsg);
}
};
let obj = jQuery.parseHTML(html);
$('.overlay_src_msg').append(obj);
})
/** UTIL */
//ユーザデータ検索
var userList = CHAT_DB.getAllGroupShopMemberByName(keyword);
var userTemplate;
$.get({ url: "./template/template_make_room_user_list.html", async: false }
, function(text) {
userTemplate = text;
});
userList.forEach(function(user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
let findObj = CHAT.globalSelectedUserList.find(function(shopMemberId) {
return shopMemberId == user.shopMemberId;
})
if (findObj) {
user.checked = 'checked';
}
});
let html = Mustache.render(userTemplate, {
userList: userList
});
let obj = jQuery.parseHTML(html);
$('.overlay_src_msg').append(obj);
if (groupList.length == 0 && userList.length == 0) {
const noResultMsg = $('<div/>',{width:'auto', style:'text-align: center'});
noResultMsg.append(getLocalizedString("noResult"))
$('.overlay_src_msg').append(noResultMsg);
}
  //連絡先画面
} else {
var userList = CHAT_DB.getMyGroupShopMemberByName(keyword);
var userTemplate;
$.get({ url: "./template/template_make_room_user_list.html", async: false }
, function(text) {
userTemplate = text;
});
userList.forEach(function(user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
let findObj = CHAT.globalSelectedUserList.find(function(shopMemberId) {
return shopMemberId == user.shopMemberId;
})
if (findObj) {
user.checked = 'checked';
}
});
let html = Mustache.render(userTemplate, {
userList: userList
});
let obj = jQuery.parseHTML(html);
$('.overlay_src_msg').html(obj);
if (userList.length == 0) {
const noResultMsg = $('<div/>',{width:'auto', style:'text-align: center'});
noResultMsg.append(getLocalizedString("noResult"))
$('.overlay_src_msg').append(noResultMsg);
}
var searchMember = function () {
const searchInput = $('#chatMakeRoom .search_form input[type="search"]');
searchInput.click(function (e) {
let contactListTitle = getLocalizedString("userSearch");
$("#makeRoomTitle").text(contactListTitle);
});
searchInput.keyup(function (e) {
const enterKeyPressed = e.KeyCode == 13 || e.key == "Enter";
const keywordEmpty = keyword == "" || keyword.length < 2;
const keywordNotEmpty = keyword != "" && keyword.length != 0;
//画面タイトル設定
var keyword = searchInput.val();
if (enterKeyPressed) {
if (keywordNotEmpty) {
searchInput.blur();
return false;
}
} else if (keywordEmpty) {
$(".overlay_src_msg").empty();
return false;
}
}
CHAT_MAKE_ROOM.searchUser(keyword);
if (enterKeyPressed) {
searchInput.blur();
return;
}
});
};
var bindiOSKeyBoardEvent = function () {
const searchInput = $('#chatMakeRoom .search_form input[type="search"]');
searchInput.on("compositionend", function () {
if (CHAT_UTIL.isIOS()) {
var keyword = searchInput.val();
CHAT_MAKE_ROOM.searchUser(keyword);
}
});
};
var renderRoomList = function (url, groupName, groupID) {
return Mustache.render(url, {
name: groupName,
id: groupID,
});
};
var searchUserData = function (userList) {
userList.forEach(function (user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
let findObj = CHAT.globalSelectedUserList.find(function (shopMemberId) {
return shopMemberId == user.shopMemberId;
});
if (findObj) {
user.checked = "checked";
}
});
};
var renderUser = function (url, userList) {
return Mustache.render(url, {
userList: userList,
});
};
$(function () {
document.addEventListener("DOMContentLoaded", function () {
// メニューオーバーレイ表示
$(".menu_btn").click(function () {
var w = $(this).width();
......@@ -8,7 +8,6 @@ $(function () {
.toggleClass("slidein")
.css({ transform: "translateX(" & -w & ")" });
$("#collabo_main").toggleClass("noscroll");
});
// ユーザーリストオーバーレイ表示
......@@ -21,7 +20,6 @@ $(function () {
.css({ transform: "translateX(" & -w & ")" });
$("#collabo_main").toggleClass("noscroll");
if ($("#overlay_user_list.overlay").hasClass("noscroll")) {
$("#overlay_user_list.overlay").removeClass("noscroll");
} else {
......@@ -33,7 +31,7 @@ $(function () {
$(".footer_menu_btn").click(function () {
var h_active = $("#collabo_footer").height();
var h_hide = h_active - $("#collabo_footer_menu").height();
// 非アクティブ時
if ($(this).hasClass("hide")) {
$(this).removeClass("hide");
......@@ -70,60 +68,66 @@ $(function () {
// ユーザー招待メンバー検索
$(".add_user_btn").click(function () {
CHAT_UI.showLoadingIndicator();
CHAT.globalSelectedUserList = [];
CHAT_UI.refreshMyGroupForAddUserInCollaboration();
$('#addUserConfirmBtnInCollaboration').off().on('click', function() {
$('#addUserInCollaboration').modal('hide');
if (typeof(android) != "undefined") {
android.saveSelectedUserList(CHAT.globalSelectedUserList.join(","));
} else {
webkit.messageHandlers.saveSelectedUserList.postMessage(CHAT.globalSelectedUserList.join(","));
}
CHAT_UI.confirmInviteUserListInCollaboration();
CHAT_UI.showLoadingIndicator();
CHAT.globalSelectedUserList = [];
CHAT_UI.refreshMyGroupForAddUserInCollaboration();
$("#addUserConfirmBtnInCollaboration")
.off()
.on("click", function () {
$("#addUserInCollaboration").modal("hide");
if (typeof android != "undefined") {
android.saveSelectedUserList(CHAT.globalSelectedUserList.join(","));
} else {
webkit.messageHandlers.saveSelectedUserList.postMessage(
CHAT.globalSelectedUserList.join(",")
);
}
CHAT_UI.confirmInviteUserListInCollaboration();
});
});
$('#penBtn').click(function () {
$('#coviewPenCtrBtn').click();
if ($('#penBtn').hasClass('bg_red')) {
$('#penBtn').removeClass('bg_red');
$('#penBtn').addClass('bg_blue');
$("#penBtn").click(function () {
$("#coviewPenCtrBtn").click();
if ($("#penBtn").hasClass("bg_red")) {
$("#penBtn").removeClass("bg_red");
$("#penBtn").addClass("bg_blue");
} else {
$('#penBtn').addClass('bg_red');
$('#penBtn').removeClass('bg_blue');
$("#penBtn").addClass("bg_red");
$("#penBtn").removeClass("bg_blue");
}
})
$('#photo_open_place_holder').click(function () {
$("#open_file_upload").trigger("click");
})
$('#eraserBtn').click(function () {
$('#coviewEraserCtrBtn').click();
})
$('#captureBtn').click(function () {
if ($('#recordBtn').hasClass('bg_red')) {
});
$("#photo_open_place_holder").click(function () {
$("#open_file_upload").trigger("click");
});
$("#eraserBtn").click(function () {
$("#coviewEraserCtrBtn").click();
});
$("#captureBtn").click(function () {
if ($("#recordBtn").hasClass("bg_red")) {
screenLock();
recordStop(function() {
$('#screenLock').remove();
coview_api.Capture(CMS_SERVER_URL + '/chatapi/file/uploadArchive');
recordStop(function () {
$("#screenLock").remove();
coview_api.Capture(CMS_SERVER_URL + "/chatapi/file/uploadArchive");
});
} else {
coview_api.Capture(CMS_SERVER_URL + '/chatapi/file/uploadArchive');
coview_api.Capture(CMS_SERVER_URL + "/chatapi/file/uploadArchive");
}
})
});
$('#captureRequestBtn').click(function () {
fw.sendToMsg('others', 'CAPTURE_REQUEST', {"name": CHAT.globalLoginParameter.loginId});
})
$("#captureRequestBtn").click(function () {
fw.sendToMsg("others", "CAPTURE_REQUEST", {
name: CHAT.globalLoginParameter.loginId,
});
});
});
function penOff() {
if ($('#penBtn').hasClass('bg_blue')) {
$('#coviewPenCtrBtn').click();
$('#penBtn').addClass('bg_red');
$('#penBtn').removeClass('bg_blue');
if ($("#penBtn").hasClass("bg_blue")) {
$("#coviewPenCtrBtn").click();
$("#penBtn").addClass("bg_red");
$("#penBtn").removeClass("bg_blue");
}
};
}
function includeJs(jsFilePath) {
var js = document.createElement("script");
js.type = "text/javascript";
js.src = jsFilePath;
document.body.appendChild(js);
}
function getTemplate(url) {
var template;
$.get({ url: url, async: false }, function (text) {
template = text;
});
return template;
}
function getNoResultMessage() {
const noResultMsg = $("<div/>", {
width: "auto",
style: "text-align: center",
});
noResultMsg.append(getLocalizedString("noResult"));
return noResultMsg;
}
// アコーディオン
$('.category').on('click', function() {
$(".category").on("click", function () {
$(this).toggleClass("open");
$(this).next().slideToggle();
});
$('.home_btn').on('click', function() {
$(".home_btn").on("click", function () {
if (CHAT_UTIL.isAndroid()) {
android.goHome();
} else if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.goHome.postMessage({});
}
});
$(function() {
document.addEventListener("DOMContentLoaded", function () {
var h = $(window).height(); //画面の高さを取得
// ローディング表示
......@@ -29,41 +56,40 @@ $(function() {
$('.search_form input[type="search"]').click(function () {
$(this).addClass("focus");
// キャンセルボタン表示
$('.cancel').removeClass('none');
$('.search_form form').addClass('d-flex flex-row h-100 align-items-center');
$('.content').addClass('none');
$('.craeteRoomButton').addClass('none');
$(".cancel").removeClass("none");
$(".search_form form").addClass("d-flex flex-row h-100 align-items-center");
$(".content").addClass("none");
$(".craeteRoomButton").addClass("none");
});
// 共通検索フォーム キャンセルボタン押下イベント
$('.search_form .cancel').click(function(){
$(this).addClass('none');
$('.search_form input').removeClass('focus');
$('.search_form input').val('');
$('.search_form form').removeClass();
$('.content').removeClass('none');
$('.overlay_src_msg').empty();
$('.craeteRoomButton').removeClass('none');
$(".search_form .cancel").click(function () {
$(this).addClass("none");
$(".search_form input").removeClass("focus");
$(".search_form input").val("");
$(".search_form form").removeClass();
$(".content").removeClass("none");
$(".overlay_src_msg").empty();
$(".craeteRoomButton").removeClass("none");
});
$('.message_input_form').on('focus',function(e){
setTimeout(function() {
$('.message_input_send').removeClass('none');
$('.attach_file').addClass('none');
$('.footer_content_b').addClass('none');
$(".message_input_form").on("focus", function (e) {
setTimeout(function () {
$(".message_input_send").removeClass("none");
$(".attach_file").addClass("none");
$(".footer_content_b").addClass("none");
}, 10);
});
$('.message_input_form').on('focusout',function(e){
setTimeout(function() {
if($(e.relatedTarget).hasClass('message_input_send')){
$(".message_input_form").on("focusout", function (e) {
setTimeout(function () {
if ($(e.relatedTarget).hasClass("message_input_send")) {
CHAT_UI.sendMessage();
} else {
$('.message_input_send').addClass('none');
$('.attach_file').removeClass('none');
$('.footer_content_b').removeClass('none');
$(".message_input_send").addClass("none");
$(".attach_file").removeClass("none");
$(".footer_content_b").removeClass("none");
}
}, 10);
});
});
......@@ -9,64 +9,143 @@ const readyState = {
COMPLETED: 4,
};
const messageType = {
TEXT : 0 ,
IMAGE : 1 ,
VIDEO : 2 ,
SYSTEM : 3 ,
COMMUNICATIONSTART : 4,
COMMUNICATIONEND : 5
}
const userAPICmd = {
MYINFO : 9
}
const chatRoomType = {
DM : "1",
GROUP : "0",
ALL : "2"
}
const groupSearchFlg = {
ROOT : "0"
}
const MessageType = {
TEXT: 0,
IMAGE: 1,
VIDEO: 2,
SYSTEM: 3,
COMMUNICATIONSTART: 4,
COMMUNICATIONEND: 5,
};
const nameCardAreaId = {
MY : "myNamecard",
USER : "userNamecard"
}
const ChatRoomType = {
DM: "1",
GROUP: "0",
ALL: "2",
};
const collaborationTypeKey = {
AUDIO : "audio",
CAMERA : "camera",
VIDEO : "video" ,
DOCUMENT : "document",
BOARD : "board"
}
const CollaborationTypeKey = {
AUDIO: "audio",
CAMERA: "camera",
VIDEO: "video",
DOCUMENT: "document",
BOARD: "board",
};
const COLLABORATION_TYPE = {
AUDIO : 0,
CAMERA : 2,
VIDEO : 3,
DOCUMENT : 4,
BOARD : 5
}
AUDIO: 0,
CAMERA: 2,
VIDEO: 3,
DOCUMENT: 4,
BOARD: 5,
};
const makeRoomFlg = {
NAME_CARD : 0,
MAKE_ROOM : 1
}
const MakeRoomFlag = {
NAME_CARD: 0,
MAKE_ROOM: 1,
};
const ANDROID_SDK_VERSION = {
O : 26
}
O: 26,
};
const HOST_REQUEST_FLG = {
DONE : 0,
DOING : 1
}
const HostRequestFlag = {
DONE: 0,
DOING: 1,
};
const messageSeperator = "<::split>";
const DATA_MESSAGE_SCHEME = "::NOT_MESSAGE";
const FINISH_ALL_COLLABORATION_SIGNAL = "::ALL_COLLABORATION_END";
const TemplateURL = {
GROUP_PATH: "./template/template_group_path.html",
GROUP_LIST: "./template/template_group_list.html",
ARCHIVE_LIST: "./template/template_archive_list.html",
MAKE_ROOM_GROUP_LIST: "./template/template_make_room_group_list.html",
GROUP_USER_LIST: "./template/template_group_user_list.html",
ROOM_LIST: "./template/template_room_list.html",
SYSTEM_MESSAGE: "./template/template_system_message.html",
USER_LIST: "./template/template_user_list.html",
USER_NAME_CARD: "./template/template_user_name_card.html",
USER_MESSAGE: "./template/template_user_message.html",
MY_NAME_CARD: "./template/template_my_name_card.html",
MY_MESSAGE: "./template/template_my_message.html",
OPEN_COLLABORATION_MESSAGE:
"./template/template_open_collaboration_message.html",
CHATROOM_USER_LIST: "./template/template_chatroom_user_list.html",
CHATROOM_USER_FILTER_LIST:
"./template/template_chatroom_user_filter_list.html",
MAKE_ROOM_USER_LIST: "./template/template_make_room_user_list.html",
MAKE_ROOM_GROUP_USER_LIST:
"./template/template_make_room_group_user_list.html",
MAKE_ROOM_GROUP_PATH: "./template/template_make_room_group_path.html",
MAKE_ROOM_CONFIRM_USER_LIST:
"./template/template_make_room_confirm_user_list.html",
ADD_USER_CONFIRM_USER_LIST:
"./template/template_add_user_confirm_user_list.html",
ADD_USER_USER_LIST: "./template/template_add_user_user_list.html",
ADD_USER_USER_LIST_IN_COLLABORATION:
"./template/template_add_user_user_list_in_collaboration.html",
ADD_USER_GROUP_PATH: "./template/template_add_user_group_path.html",
ADD_USER_GROUP_LIST: "./template/template_add_user_group_list.html",
ADD_USER_GROUP_LIST_IN_COLLABORATION:
"./template/template_add_user_group_list_in_collaboration.html",
ADD_USER_GROUP_USER_LIST: "./template/template_add_user_group_user_list.html",
ADD_USER_GROUP_USER_LIST_IN_COLLABORATION:
"./template/template_add_user_group_user_list_in_collaboration.html",
ADD_USER_GROUP_PATH_IN_COLLABORATION:
"./template/template_add_user_group_path_in_collaboration.html",
};
const SOCKET_KEY = {
CONNECT: "connect",
DISCONNECT: "disconnect",
CONNECT_ERROR: "connect_error",
NEW_MESSAGE: "newMessage",
NEW_NOTIFICATION: "newNotification",
REFRESH_GROUPLIST: "refreshGroupList",
REFRESH_USERLIST_INGROUP: "refreshUserListInGroup",
SHOW_SERVER_ERROR: "showServerError",
RETRY_JOIN_PROCESS: "retryJoinProcess",
JOIN: "join",
};
const NATIVE_KEY_IOS = {
getBeforeRoomType: "getBeforeRoomType",
getRoomType: "getRoomType",
removeFavoriteUser: "removeFavoriteUser",
addFavoriteUser: "addFavoriteUser",
removeFavoriteGroup: "removeFavoriteGroup",
addFavoriteGroup: "addFavoriteGroup",
getCollaborationJoinFlg: "getCollaborationJoinFlg",
getUserInfoList: "getUserInfoList",
createContentView: "createContentView",
getToMoveGroupId: "getToMoveGroupId",
getJoinCollaborationType: "getJoinCollaborationType",
getHostRequestFlg: "getHostRequestFlg",
getRoomList: "getRoomList",
getMyInfo: "getMyInfo",
getMessages: "getMessages",
getFavoriteUsersNotInRoom: "getFavoriteUsersNotInRoom",
getFavoriteUsers: "getFavoriteUsers",
getFavoriteGroups: "getFavoriteGroups",
getMyGroupUsers: "getMyGroupUsers",
getGroupInfo: "getGroupInfo",
getGroupInfoForAddUser: "getGroupInfoForAddUser",
getSelectedUserList: "getSelectedUserList",
getNameCardData: "getNameCardData",
getMyGroupShopMemberByName: "getMyGroupShopMemberByName",
getMyGroupShopMemberNotInRoomByName: "getMyGroupShopMemberNotInRoomByName",
getAllGroupShopMemberByName: "getAllGroupShopMemberByName",
getAllGroupShopMemberNotInRoomByName: "getAllGroupShopMemberNotInRoomByName",
getGroupByName: "getGroupByName",
getUsersInRoom: "getUsersInRoom",
getArchiveList: "getArchiveList",
getArchiveByName: "getArchiveByName",
getArchiveDetail: "getArchiveDetail",
searchMessages: "searchMessages",
getMyGroupUsersNotInRoom: "getMyGroupUsersNotInRoom",
getUserInfo: "getUserInfo",
getUserListByLoginId: "getUserListByLoginId",
};
// 名前空間
var CONTACT = {};
$(function () {
// メンバー検索
$('#contact .search_form input[type="search"]').keyup(function(e) {
var keyword = $('#contact .search_form input[type="search"]').val();
if (e.key == "Enter" || e.KeyCode == 13) {
if (keyword != '' && keyword.length != 0) {
$('#contact .search_form input[type="search"]').blur();
return;
}
} else if (keyword == '' || keyword.length < 2) {
$('.overlay_src_msg').empty();
return;
}
CONTACT.searchUser(keyword);
if (e.key == "Enter" || e.KeyCode == 13) {
$('#contact .search_form input[type="search"]').blur();
return;
}
});
// iOSキーボード変換検知用
$('#contact .search_form input[type="search"]').on('compositionend', function() {
if (CHAT_UTIL.isIOS()) {
var keyword = $('#contact .search_form input[type="search"]').val();
CONTACT.searchUser(keyword);
}
});
document.addEventListener("DOMContentLoaded", function () {
// メンバー検索
bindMemeberSearch();
// iOSキーボード変換検知用
bindiOSKeyBoardEvent();
});
// ユーザー検索
CONTACT.searchUser = function(keyword) {
var groupList;
$('.overlay_src_msg').empty();
var isAllGroup = $('#tabAllGroup').is(':checked');
//全グループ検索画面
if (isAllGroup) {
//グループデータ検索
groupList = CHAT_DB.getGroupByName(keyword);
var groupTemplate;
$.get({ url: "./template/template_group_list.html", async: false }
, function(text) {
groupTemplate = text;
});
groupList.forEach(function(group) {
let html = Mustache.render(groupTemplate, {
name: group.groupName,
id: group.groupId,
isFavorite: group.isFavorite
});
let obj = jQuery.parseHTML(html);
$('.overlay_src_msg').append(obj);
})
//ユーザデータ検索
var userList = CHAT_DB.getAllGroupShopMemberByName(keyword);
var userTemplate;
$.get({ url: "./template/template_user_list.html", async: false }
, function(text) {
userTemplate = text;
});
userList.forEach(function(user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
});
let html = Mustache.render(userTemplate, {
userList: userList
});
let obj = jQuery.parseHTML(html);
$('.overlay_src_msg').append(obj);
if (userList.length == 0 && groupList.length == 0) {
const noResultMsg = $('<div/>',{width:'auto', style:'text-align: center'});
noResultMsg.append(getLocalizedString("noResult"))
$('.overlay_src_msg').append(noResultMsg);
}
CONTACT.searchUser = function (keyword) {
const overlayMessage = $(".overlay_src_msg");
const isAllGroup = $("#tabAllGroup").is(":checked");
let hasNoData = false;
overlayMessage.empty();
//全グループ検索画面
if (isAllGroup) {
//グループデータ検索
const groupList = CHAT_DB.getGroupByName(keyword);
groupDataSearch(groupList);
//ユーザデータ検索
const userList = CHAT_DB.getAllGroupShopMemberByName(keyword);
userDataSearch(userList);
hasNoData = userList.length == 0 && groupList.length == 0;
//連絡先画面
} else {
var userList = CHAT_DB.getMyGroupShopMemberByName(keyword);
var userTemplate;
$.get({ url: "./template/template_user_list.html", async: false }
, function(text) {
userTemplate = text;
});
userList.forEach(function(user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
});
let html = Mustache.render(userTemplate, {
userList: userList
});
let obj = jQuery.parseHTML(html);
$('.overlay_src_msg').html(obj);
if (userList.length == 0) {
const noResultMsg = $('<div/>',{width:'auto', style:'text-align: center'});
noResultMsg.append(getLocalizedString("noResult"))
$('.overlay_src_msg').append(noResultMsg);
}
} else {
const userList = CHAT_DB.getMyGroupShopMemberByName(keyword);
userDataSearch(userList);
hasNoData = userList.length == 0;
}
if (hasNoData) {
const noResultMsg = getNoResultMessage();
overlayMessage.append(noResultMsg);
}
};
/** UTILS */
var bindiOSKeyBoardEvent = function () {
const searchInput = $('#contact .search_form input[type="search"]');
searchInput.on("compositionend", function () {
if (CHAT_UTIL.isIOS()) {
var keyword = searchInput.val();
CONTACT.searchUser(keyword);
}
});
};
var bindMemeberSearch = function () {
const searchInput = $('#contact .search_form input[type="search"]');
searchInput.keyup(function (e) {
const keyword = searchInput.val();
const enterKeyPressed = e.key == "Enter" || e.KeyCode == 13;
const keywordEmpty = keyword == "" || keyword.length < 2;
const keywordNotEmpty = keyword != "" && keyword.length != 0;
if (enterKeyPressed) {
if (keywordNotEmpty) {
searchInput.blur();
return;
}
} else if (keywordEmpty) {
$(".overlay_src_msg").empty();
return;
}
CONTACT.searchUser(keyword);
if (enterKeyPressed) {
searchInput.blur();
return;
}
});
};
var groupDataSearch = function (groupList) {
const groupTemplate = getTemplate(TemplateURL.GROUP_LIST);
groupList.forEach(function (group) {
let html = renderGroupList(
groupTemplate,
group.groupName,
group.groupId,
group.isFavorite
);
let obj = jQuery.parseHTML(html);
$(".overlay_src_msg").append(obj);
});
};
var renderGroupList = function (url, groupName, groupID, isFavorite) {
return Mustache.render(url, {
name: groupName,
id: groupID,
isFavorite: isFavorite,
});
};
var userDataSearch = function (userList) {
userList.forEach(function (user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
});
var userTemplate = getTemplate(TemplateURL.USER_LIST);
let html = renderUserList(userTemplate, userList);
let obj = jQuery.parseHTML(html);
$(".overlay_src_msg").append(obj);
};
var renderUserList = function (url, userList) {
return Mustache.render(url, {
userList: userList,
});
};
\ No newline at end of file
$(window).on('load',function () { //読み込み完了したら実行する
$('#loader-bg').delay(900).fadeOut(800);//ローディングを隠す
$('#loader').delay(600).fadeOut(300);
$(window).on("load", function () {
//読み込み完了したら実行する
$("#loader-bg").delay(900).fadeOut(800); //ローディングを隠す
$("#loader").delay(600).fadeOut(300);
});
$(function () {
document.addEventListener('DOMContentLoaded', function() {
setTimeout("stopload()", 3000); //いつまでもローディング状態にならないように10秒で強制表示させる
});
......
......@@ -9,7 +9,7 @@ let timeInterval = null;
var backgroundFileName;
var isIos;
$(function () {
document.addEventListener("DOMContentLoaded", function () {
var coviewApiActive = coview_api.Init({
testSTRParam: "param1",
testNUMParam: 77,
......@@ -50,14 +50,14 @@ $(function () {
$(document).on("click", ".coview_share_request", function () {
console.log("globalUserInfo", globalUserInfo);
if ($(this).hasClass(collaborationTypeKey.VIDEO) == true) {
globalUserInfo.coWorkType = collaborationTypeKey.VIDEO;
if ($(this).hasClass(CollaborationTypeKey.VIDEO) == true) {
globalUserInfo.coWorkType = CollaborationTypeKey.VIDEO;
$(".coview_share_title_name").text("LIVE");
} else if ($(this).hasClass(collaborationTypeKey.CAMERA) == true) {
globalUserInfo.coWorkType = collaborationTypeKey.CAMERA;
} else if ($(this).hasClass(CollaborationTypeKey.CAMERA) == true) {
globalUserInfo.coWorkType = CollaborationTypeKey.CAMERA;
$(".coview_share_title_name").text("ライブラリ");
} else if ($(this).hasClass(collaborationTypeKey.AUDIO) == true) {
globalUserInfo.coWorkType = collaborationTypeKey.AUDIO;
} else if ($(this).hasClass(CollaborationTypeKey.AUDIO) == true) {
globalUserInfo.coWorkType = CollaborationTypeKey.AUDIO;
$(".coview_share_title_name").text("音声通話");
}
......@@ -85,7 +85,7 @@ $(function () {
$("#coviewSharePhotoCamera").on("click", function () {
$(".coview_share_photo_select_bubble").hide();
globalUserInfo.coWorkType = collaborationTypeKey.CAMERA;
globalUserInfo.coWorkType = CollaborationTypeKey.CAMERA;
coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
Coview_moveToVideoShareArea();
......@@ -121,13 +121,15 @@ $(function () {
coview_api.Login(globalUserInfo.loginId);
initCollaborationUI(joinCollaborationType);
if (CHAT_UTIL.isAndroid()) {
android.setHostRequestFlg(HOST_REQUEST_FLG.DONE);
android.setHostRequestFlg(HostRequestFlag.DONE);
} else {
webkit.messageHandlers.setHostRequestFlg.postMessage(HOST_REQUEST_FLG.DONE);
webkit.messageHandlers.setHostRequestFlg.postMessage(
HostRequestFlag.DONE
);
}
fw.socket.on('message', async function(data) {
console.log('====> message::data: ', data);
if (data.type ==="CHANGE_COLLABORATION") {
fw.socket.on("message", async function (data) {
console.log("====> message::data: ", data);
if (data.type === "CHANGE_COLLABORATION") {
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.exitMeetingRoom.postMessage({});
......@@ -136,9 +138,13 @@ $(function () {
}
}
if (CHAT_UTIL.isAndroid() && data.payload.collaborationType == COLLABORATION_TYPE.DOCUMENT && androidVersion < ANDROID_SDK_VERSION.O) {
if (
CHAT_UTIL.isAndroid() &&
data.payload.collaborationType == COLLABORATION_TYPE.DOCUMENT &&
androidVersion < ANDROID_SDK_VERSION.O
) {
coview_api.HeartBeatUser(globalUserInfo.loginId);
alert(getLocalizedString('not_support_version'));
alert(getLocalizedString("not_support_version"));
joinCollaborationType = COLLABORATION_TYPE.CAMERA;
} else {
joinCollaborationType = data.payload.collaborationType;
......@@ -147,98 +153,166 @@ $(function () {
initCollaborationUI(joinCollaborationType);
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.joinChangedCollaboration.postMessage({"joinCollaborationType": joinCollaborationType, "meetingId": data.payload.newMeetingId});
webkit.messageHandlers.joinChangedCollaboration.postMessage({
joinCollaborationType: joinCollaborationType,
meetingId: data.payload.newMeetingId,
});
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
webkit.messageHandlers.joinMeetingRoom.postMessage(data.payload.newMeetingId);
webkit.messageHandlers.joinMeetingRoom.postMessage(
data.payload.newMeetingId
);
}
} else if (CHAT_UTIL.isAndroid()) {
android.joinChangedCollaboration(joinCollaborationType, data.payload.newMeetingId);
android.joinChangedCollaboration(
joinCollaborationType,
data.payload.newMeetingId
);
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
android.joinMeetingRoom(data.payload.newMeetingId);
}
}
} else if (data.type ==="SHARE_FILE") {
} else if (data.type === "SHARE_FILE") {
if (joinCollaborationType != COLLABORATION_TYPE.CAMERA) {
initCollaborationUI(COLLABORATION_TYPE.CAMERA);
joinCollaborationType = COLLABORATION_TYPE.CAMERA;
fw.sendToMsg('others', 'SHARE_FILE_HOST', {"collaborationType": COLLABORATION_TYPE.CAMERA});
fw.sendToMsg("others", "SHARE_FILE_HOST", {
collaborationType: COLLABORATION_TYPE.CAMERA,
});
}
} else if (data.type ==="SHARE_FILE_HOST") {
} else if (data.type === "SHARE_FILE_HOST") {
if (joinCollaborationType != COLLABORATION_TYPE.CAMERA && g_isMainMan) {
initCollaborationUI(COLLABORATION_TYPE.CAMERA);
joinCollaborationType = COLLABORATION_TYPE.CAMERA;
}
} else if (data.type === "CAPTURE_REQUEST" && g_isMainMan) {
if (confirm(data.payload.name + getLocalizedString("request_capture"))) {
if ($('#recordBtn').hasClass('bg_red')) {
if (
confirm(data.payload.name + getLocalizedString("request_capture"))
) {
if ($("#recordBtn").hasClass("bg_red")) {
screenLock();
recordStop(function() {
$('#screenLock').remove();
captureAndShareImage(CMS_SERVER_URL + '/chatapi/file/uploadArchive', data.payload.name);
recordStop(function () {
$("#screenLock").remove();
captureAndShareImage(
CMS_SERVER_URL + "/chatapi/file/uploadArchive",
data.payload.name
);
});
} else {
captureAndShareImage(CMS_SERVER_URL + '/chatapi/file/uploadArchive', data.payload.name);
captureAndShareImage(
CMS_SERVER_URL + "/chatapi/file/uploadArchive",
data.payload.name
);
}
}
} else if (data.type === "HOST_CHANGE_REQUEST") {
if (data.payload.loginId == globalUserInfo.loginId) {
fw.sendToMsg('others', 'HOST_CHANGE_RESPONSE', {"isAndroid": CHAT_UTIL.isAndroid(), "isAble" : androidVersion >= ANDROID_SDK_VERSION.O, "loginId": CHAT.globalLoginParameter.loginId});
fw.sendToMsg("others", "HOST_CHANGE_RESPONSE", {
isAndroid: CHAT_UTIL.isAndroid(),
isAble: androidVersion >= ANDROID_SDK_VERSION.O,
loginId: CHAT.globalLoginParameter.loginId,
});
}
} else if (data.type === "HOST_CHANGE_RESPONSE") {
var isAndroid = data.payload.isAndroid;
var isAble = data.payload.isAble
if (g_isMainMan && isAndroid && !isAble && joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
var isAble = data.payload.isAble;
if (
g_isMainMan &&
isAndroid &&
!isAble &&
joinCollaborationType == COLLABORATION_TYPE.DOCUMENT
) {
coview_api.HeartBeatUser(globalUserInfo.loginId);
alert(getLocalizedString('err_target_android_version_not_support'));
} else if (g_isMainMan){
alert(getLocalizedString("err_target_android_version_not_support"));
} else if (g_isMainMan) {
fw.sendToMsg("others", "PIP_END_REQUEST", {
loginId: getFermiLoginId(data.payload.loginId),
});
await new Promise(done => setTimeout(() => done(), 500));
Coview_changeHost(getFermiLoginId(data.payload.loginId));
}
} else if (data.type === "PIP_END_REQUEST") {
if (data.payload.loginId == globalUserInfo.loginId && joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
if (CHAT_UTIL.isAndroid()) {
android.finishPip();
mChatWebView.loadUrl("javascript:$('.pip_indicator').addClass('none');");
} else {
webkit.messageHandlers.finishPipMode.postMessage({});
}
}
} else if (data.type === "API_SEND_OWNER_CHANGE_COMPLETE") {
penOff();
if ($('#recordBtn').hasClass('bg_red')) {
recordStop(function() {
if ($("#recordBtn").hasClass("bg_red")) {
recordStop(function () {
console.log("ホスト変更によりレコードを終了しました");
});
}
if ($('#micBtn').hasClass('bg_red')) {
if ($("#micBtn").hasClass("bg_red")) {
micOff();
} else {
micOn();
}
} else if (data.type === "CHANGE_HOST_APPLY") {
if (g_isMainMan) {
coview_api.HeartBeatUser(globalUserInfo.loginId);
if (CHAT_UTIL.isAndroid()) {
$(".pip_indicator").addClass("none");
android.finishPip();
} else {
webkit.messageHandlers.finishPipMode.postMessage({});
}
}
if (CHAT_UTIL.isAndroid()) {
android.setHostRequestFlg(HOST_REQUEST_FLG.DOING);
android.setHostRequestFlg(HostRequestFlag.DOING);
} else {
webkit.messageHandlers.setHostRequestFlg.postMessage(HOST_REQUEST_FLG.DOING);
webkit.messageHandlers.setHostRequestFlg.postMessage(
HostRequestFlag.DOING
);
}
await new Promise(done => setTimeout(() => done(), 500));
if (g_isMainMan) {
coview_api.HeartBeatUser(globalUserInfo.loginId);
if(confirm(getLocalizedString('norify_request_host_change', data.payload.hostId))) {
if (
confirm(
getLocalizedString(
"norify_request_host_change",
data.payload.hostId
)
)
) {
Coview_changeHost(getFermiLoginId(data.payload.hostId));
if (CHAT_UTIL.isAndroid()) {
android.setHostRequestFlg(HOST_REQUEST_FLG.DONE);
android.setHostRequestFlg(HostRequestFlag.DONE);
} else {
webkit.messageHandlers.setHostRequestFlg.postMessage(HOST_REQUEST_FLG.DONE);
webkit.messageHandlers.setHostRequestFlg.postMessage(
HostRequestFlag.DONE
);
}
} else {
fw.sendToMsg('others', 'HOST_REQUEST_REJECT', {"hostId": data.payload.hostId});
fw.sendToMsg("others", "HOST_REQUEST_REJECT", {
hostId: data.payload.hostId,
});
}
fw.sendToMsg('others', 'HOST_REQUEST_DONE', {"hostId": data.payload.hostId});
fw.sendToMsg("others", "HOST_REQUEST_DONE", {
hostId: data.payload.hostId,
});
}
} else if (data.type === "HOST_REQUEST_DONE") {
if (CHAT_UTIL.isAndroid()) {
android.setHostRequestFlg(HOST_REQUEST_FLG.DONE);
android.setHostRequestFlg(HostRequestFlag.DONE);
} else {
webkit.messageHandlers.setHostRequestFlg.postMessage(HOST_REQUEST_FLG.DONE);
webkit.messageHandlers.setHostRequestFlg.postMessage(
HostRequestFlag.DONE
);
}
} else if (data.type === "HOST_REQUEST_REJECT") {
if (data.payload.hostId == CHAT.globalLoginParameter.loginId) {
alert('REJECT for owner user');
alert("REJECT for owner user");
}
if (CHAT_UTIL.isAndroid()) {
android.setHostRequestFlg(HOST_REQUEST_FLG.DONE);
android.setHostRequestFlg(HostRequestFlag.DONE);
} else {
webkit.messageHandlers.setHostRequestFlg.postMessage(HOST_REQUEST_FLG.DONE);
webkit.messageHandlers.setHostRequestFlg.postMessage(
HostRequestFlag.DONE
);
}
}
});
......@@ -276,9 +350,9 @@ $(function () {
Coview_exitCollaboration(isDocument);
$("#loadingIndicator").removeClass("full_active");
});
var meetingId;
coview_api.addEventListener("message", async function (event, json) {
console.log("+++ addEventListener", json);
console.log("processMessage api = ", json.api);
......@@ -286,13 +360,13 @@ $(function () {
let loginIdList = new Array();
switch (json.api) {
case "LoginResponse":
if (globalUserInfo.coWorkType == collaborationTypeKey.DOCUMENT) {
if (globalUserInfo.coWorkType == CollaborationTypeKey.DOCUMENT) {
isDocument = true;
globalUserInfo.coWorkType = collaborationTypeKey.AUDIO;
globalUserInfo.coWorkType = CollaborationTypeKey.AUDIO;
}
if (globalUserInfo.coWorkType == collaborationTypeKey.BOARD) {
if (globalUserInfo.coWorkType == CollaborationTypeKey.BOARD) {
isBoard = true;
globalUserInfo.coWorkType = collaborationTypeKey.AUDIO;
globalUserInfo.coWorkType = CollaborationTypeKey.AUDIO;
}
hostSearchInterval();
if (collaborationJoinFlg == "1") {
......@@ -330,23 +404,23 @@ $(function () {
coviewInviteMessage =
"" +
messageSeperator +
messageType.COMMUNICATIONSTART +
MessageType.COMMUNICATIONSTART +
messageSeperator +
CHAT_UTIL.getCollaborationType(collaborationTypeKey.DOCUMENT) +
CHAT_UTIL.getCollaborationType(CollaborationTypeKey.DOCUMENT) +
messageSeperator +
meetingId;
} else if (isBoard) {
coviewInviteMessage =
"" +
messageSeperator +
messageType.COMMUNICATIONSTART +
MessageType.COMMUNICATIONSTART +
messageSeperator +
COLLABORATION_TYPE.BOARD;
} else {
coviewInviteMessage =
"" +
messageSeperator +
messageType.COMMUNICATIONSTART +
MessageType.COMMUNICATIONSTART +
messageSeperator +
CHAT_UTIL.getCollaborationType(globalUserInfo.coWorkType);
}
......@@ -401,14 +475,19 @@ $(function () {
console.log("consoleLog", json);
break;
case "fileChange":
if (joinCollaborationType != COLLABORATION_TYPE.CAMERA) { break; }
if (joinCollaborationType != COLLABORATION_TYPE.CAMERA) {
break;
}
LoadMobileShareFile(json.fileName);
backgroundFileName = json.fileName;
console.log("fileChange", json);
break;
case "ReceiveMediaResponse":
if (isBoard && g_isMainMan) {
wc_api.dispatchEvent (new Event ("message"), {"api":"fileChange","fileName":backgroundFileName});
wc_api.dispatchEvent(new Event("message"), {
api: "fileChange",
fileName: backgroundFileName,
});
}
break;
default:
......@@ -433,109 +512,123 @@ function changeCollaboration(changeCollaborationType) {
var newMeetingId = 0;
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.exitMeetingRoom.postMessage({});
webkit.messageHandlers.exitMeetingRoom.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.exitMeetingRoom();
android.exitMeetingRoom();
}
}
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.setJoinCollaborationType.postMessage(changeCollaborationType);
webkit.messageHandlers.setJoinCollaborationType.postMessage(
changeCollaborationType
);
} else if (CHAT_UTIL.isAndroid()) {
if (changeCollaborationType == COLLABORATION_TYPE.DOCUMENT && androidVersion < ANDROID_SDK_VERSION.O) {
alert(getLocalizedString('not_support_version'));
if (
changeCollaborationType == COLLABORATION_TYPE.DOCUMENT &&
androidVersion < ANDROID_SDK_VERSION.O
) {
alert(getLocalizedString("not_support_version"));
return;
}
android.setJoinCollaborationType(changeCollaborationType);
}
joinCollaborationType = changeCollaborationType;
if ($('#recordBtn').hasClass('bg_red')) {
recordStop(function() {
if ($("#recordBtn").hasClass("bg_red")) {
recordStop(function () {
console.log("レコードを終了しました");
});
}
initCollaborationUI(changeCollaborationType);
switch (changeCollaborationType) {
case COLLABORATION_TYPE.AUDIO:
coview_api.ChangeCollaboration('audio');
coview_api.ChangeCollaboration("audio");
break;
case COLLABORATION_TYPE.CAMERA:
coview_api.ChangeCollaboration('image');
coview_api.ChangeCollaboration("image");
break;
case COLLABORATION_TYPE.VIDEO:
coview_api.ChangeCollaboration('video');
coview_api.ChangeCollaboration("video");
break;
case COLLABORATION_TYPE.DOCUMENT:
coview_api.ChangeCollaboration('audio');
coview_api.ChangeCollaboration("audio");
if (CHAT_UTIL.isIOS()) {
newMeetingId = CHAT_DB.createContentView();
} else if (CHAT_UTIL.isAndroid()) {
newMeetingId = android.createContentView();
console.log('newMeetingId = ' + newMeetingId);
console.log("newMeetingId = " + newMeetingId);
}
break;
case COLLABORATION_TYPE.BOARD:
coview_api.ChangeCollaboration('audio');
coview_api.ChangeCollaboration("audio");
break;
}
if ($('#micBtn').hasClass('bg_red')) {
if ($("#micBtn").hasClass("bg_red")) {
micOff();
} else {
micOn();
}
penOff();
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.changeCollaboration.postMessage({"changeCollaborationType": changeCollaborationType, "meetingId": newMeetingId});
webkit.messageHandlers.changeCollaboration.postMessage({
changeCollaborationType: changeCollaborationType,
meetingId: newMeetingId,
});
} else if (CHAT_UTIL.isAndroid()) {
android.changeCollaboration(changeCollaborationType, newMeetingId);
}
fw.sendToMsg('others', 'CHANGE_COLLABORATION', {"collaborationType": changeCollaborationType, "newMeetingId": newMeetingId});
fw.sendToMsg("others", "CHANGE_COLLABORATION", {
collaborationType: changeCollaborationType,
newMeetingId: newMeetingId,
});
}
var scrollLock = function (e) {
if (CHAT_UTIL.isIOS()) {
if ($(e.target).closest('.add_user_modal').length > 0
|| $(e.target).closest('#overlay_user_list').length > 0
|| $(e.target).closest('.pip_indicator').length > 0)
{
if (
$(e.target).closest(".add_user_modal").length > 0 ||
$(e.target).closest("#overlay_user_list").length > 0 ||
$(e.target).closest(".pip_indicator").length > 0
) {
e.stopPropagation();
} else {
e.preventDefault();
}
}
}
}
};
let collaboScreen = document.getElementById('collabo_main');
let collaboScreen = document.getElementById("collabo_main");
function scrollLockON() {
collaboScreen.addEventListener('touchmove', scrollLock, {passive: false});
collaboScreen.addEventListener("touchmove", scrollLock, { passive: false });
}
function scrollLockOFF() {
collaboScreen.removeEventListener('touchmove', scrollLock, {passive: false});
collaboScreen.removeEventListener("touchmove", scrollLock, {
passive: false,
});
}
function initCollaborationUI(changeCollaborationType){
$('#coviewEraserCtrBtn').click();
if ($('.user_btn').hasClass("hide")) {
$('.user_btn').click();
function initCollaborationUI(changeCollaborationType) {
$("#coviewEraserCtrBtn").click();
if ($(".user_btn").hasClass("hide")) {
$(".user_btn").click();
}
if ($('.menu_btn').hasClass("hide")) {
if ($(".menu_btn").hasClass("hide")) {
$(".menu_btn").click();
}
if (CHAT_UTIL.isIOS) {
roomType = CHAT_DB.getRoomType();
if (roomType == chatRoomType.DM) {
$('.add_user_btn').removeClass('none');
if (roomType == ChatRoomType.DM) {
$(".add_user_btn").removeClass("none");
}
}
$("link[href='./css/collaboration_board.css']").remove();
penOff();
switch (changeCollaborationType) {
case COLLABORATION_TYPE.AUDIO:
$('.collaboration_contents').addClass('none');
$('.voice_contents').removeClass('none');
var w = $('.user_btn').width();
$('.user_btn').toggleClass("hide");
$(".collaboration_contents").addClass("none");
$(".voice_contents").removeClass("none");
var w = $(".user_btn").width();
$(".user_btn").toggleClass("hide");
$("#overlay_user_list.overlay")
.toggleClass("slidein")
.css({ transform: "translateX(" & -w & ")" });
......@@ -548,20 +641,20 @@ function initCollaborationUI(changeCollaborationType){
break;
case COLLABORATION_TYPE.CAMERA:
$('.collaboration_contents').addClass('none');
$('.picture_contents').removeClass('none');
$(".collaboration_contents").addClass("none");
$(".picture_contents").removeClass("none");
break;
case COLLABORATION_TYPE.VIDEO:
$('.collaboration_contents').addClass('none');
$('.video_contents').removeClass('none');
$(".collaboration_contents").addClass("none");
$(".video_contents").removeClass("none");
break;
case COLLABORATION_TYPE.DOCUMENT:
$('.collaboration_contents').addClass('none');
$('.document_contents').removeClass('none');
var w = $('.user_btn').width();
$('.user_btn').toggleClass("hide");
$(".collaboration_contents").addClass("none");
$(".document_contents").removeClass("none");
var w = $(".user_btn").width();
$(".user_btn").toggleClass("hide");
$("#overlay_user_list.overlay")
.toggleClass("slidein")
.css({ transform: "translateX(" & -w & ")" });
......@@ -574,9 +667,11 @@ function initCollaborationUI(changeCollaborationType){
break;
case COLLABORATION_TYPE.BOARD:
$('.collaboration_contents').addClass('none');
$('.board_contents').removeClass('none');
$('head').append('<link rel="stylesheet" href="./css/collaboration_board.css">');
$(".collaboration_contents").addClass("none");
$(".board_contents").removeClass("none");
$("head").append(
'<link rel="stylesheet" href="./css/collaboration_board.css">'
);
break;
}
}
......@@ -590,12 +685,17 @@ function Coview_exitCollaboration(isDocument = false) {
android.exitMeetingRoom();
}
}
if (socket != null && socket.connected) {
socket.emit('createMessage', {
text: DATA_MESSAGE_SCHEME + FINISH_ALL_COLLABORATION_SIGNAL
}, 0);
socket.emit(
"createMessage",
{
text: DATA_MESSAGE_SCHEME + FINISH_ALL_COLLABORATION_SIGNAL,
},
0
);
}
if ($('#recordBtn').hasClass('bg_red')) {
if ($("#recordBtn").hasClass("bg_red")) {
recordStop(Coview_finishCollaboration);
} else {
Coview_finishCollaboration();
......@@ -611,9 +711,9 @@ function Coview_finishCollaboration() {
} else if (CHAT_UTIL.isAndroid()) {
android.finishCollaboration();
}
};
}
isLeaved = true;
if (collaborationJoinFlg != '2') {
if (collaborationJoinFlg != "2") {
CHAT_UI.joinRoom(
CHAT.globalLoginParameter.roomId,
CHAT.globalLoginParameter.name
......@@ -636,26 +736,29 @@ function Coview_addLoginId(loginId) {
console.log("addUser loginId = " + loginId);
var url = "https://biztaskyell.abookcloud.com/auth/getuser";
$.ajax({
url : url,
method : 'post',
data : {
id : loginId
url: url,
method: "post",
data: {
id: loginId,
},
success : function (result) {
success: function (result) {
console.log("result", result);
if (result.statusCode != 200) {
coview_api.addUser(loginId);
}
},
error : function (err) {
error: function (err) {
console.log(err.toString());
}
},
});
}
function applyForHostChange() {
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT && androidVersion < ANDROID_SDK_VERSION.O) {
alert(getLocalizedString('not_support_version'));
if (
joinCollaborationType == COLLABORATION_TYPE.DOCUMENT &&
androidVersion < ANDROID_SDK_VERSION.O
) {
alert(getLocalizedString("not_support_version"));
return;
}
var hostRequestFlg = 0;
......@@ -664,20 +767,22 @@ function applyForHostChange() {
} else {
hostRequestFlg = CHAT_DB.getHostRequestFlg();
}
if (hostRequestFlg == HOST_REQUEST_FLG.DOING) {
alert(getLocalizedString('already_processing_host_request'));
if (hostRequestFlg == HostRequestFlag.DOING) {
alert(getLocalizedString("already_processing_host_request"));
return;
}
if (CHAT_UTIL.isAndroid()) {
android.setHostRequestFlg(HOST_REQUEST_FLG.DOING);
android.setHostRequestFlg(HostRequestFlag.DOING);
} else {
webkit.messageHandlers.setHostRequestFlg.postMessage(HOST_REQUEST_FLG.DOING);
webkit.messageHandlers.setHostRequestFlg.postMessage(HostRequestFlag.DOING);
}
fw.sendToMsg('others', 'CHANGE_HOST_APPLY', {"hostId": CHAT.globalLoginParameter.loginId});
};
fw.sendToMsg("others", "CHANGE_HOST_APPLY", {
hostId: CHAT.globalLoginParameter.loginId,
});
}
function Coview_connect_audio_collaboration() {
globalUserInfo.coWorkType = collaborationTypeKey.AUDIO;
globalUserInfo.coWorkType = CollaborationTypeKey.AUDIO;
coview_api.deleteRoom(globalUserInfo.roomId);
coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
Coview_moveToVideoShareArea();
......@@ -689,43 +794,63 @@ function hostSearchInterval() {
let hostName = "";
function hostSearch() {
if (g_isMainMan) {
$("#collaboration_user_" + CHAT.globalLoginParameter.loginId).addClass("host");
$('.host_contents').removeClass('none');
$("#collaboration_user_" + CHAT.globalLoginParameter.loginId).addClass(
"host"
);
$(".host_contents").removeClass("none");
if (joinCollaborationType == COLLABORATION_TYPE.CAMERA) {
$('.photo_select_button').removeClass('none');
$(".photo_select_button").removeClass("none");
}
if (joinCollaborationType == COLLABORATION_TYPE.VIDEO) {
$('.video_contents_host').removeClass('none');
$('.video_contents_user').addClass('none');
$(".video_contents_host").removeClass("none");
$(".video_contents_user").addClass("none");
}
if (CHAT_UTIL.isIOS()) isIos = true;
} else {
$("#collaboration_user_" + CHAT.globalLoginParameter.loginId).removeClass("host");
$('.host_contents').addClass('none');
$("#collaboration_user_" + CHAT.globalLoginParameter.loginId).removeClass(
"host"
);
$(".host_contents").addClass("none");
if (joinCollaborationType == COLLABORATION_TYPE.CAMERA) {
$('.photo_select_button').addClass('none');
$(".photo_select_button").addClass("none");
}
if (joinCollaborationType == COLLABORATION_TYPE.VIDEO) {
$('.video_contents_user').removeClass('none');
$('.video_contents_host').addClass('none');
$(".video_contents_user").removeClass("none");
$(".video_contents_host").addClass("none");
}
}
if (hostName != g_isMainManUsername) {
if (hostName != "") {
$("#collaboration_user_" + getReplacedLoginId(hostName)).removeClass("host");
$("#collaboration_user_" + getReplacedLoginId(hostName)).removeClass(
"host"
);
}
$("#collaboration_user_" + getReplacedLoginId(g_isMainManUsername)).addClass("host");
$(
"#collaboration_user_" + getReplacedLoginId(g_isMainManUsername)
).addClass("host");
hostName = g_isMainManUsername;
} else {
if (hostName == "") {
if (!$("#collaboration_user_" + CHAT.globalLoginParameter.loginId).hasClass("host") && coview_api.getRoomUsers()) {
$("#collaboration_user_" + CHAT.globalLoginParameter.loginId).addClass("host");
if (
!$(
"#collaboration_user_" + CHAT.globalLoginParameter.loginId
).hasClass("host") &&
coview_api.getRoomUsers()
) {
$(
"#collaboration_user_" + CHAT.globalLoginParameter.loginId
).addClass("host");
}
} else {
if (!$("#collaboration_user_" + getReplacedLoginId(hostName)).hasClass('host')) {
$("#collaboration_user_" + getReplacedLoginId(hostName)).addClass("host");
if (
!$("#collaboration_user_" + getReplacedLoginId(hostName)).hasClass(
"host"
)
) {
$("#collaboration_user_" + getReplacedLoginId(hostName)).addClass(
"host"
);
}
}
}
}
......@@ -733,57 +858,71 @@ function hostSearchInterval() {
}
function hostChangeRequest(loginId) {
fw.sendToMsg('others', 'HOST_CHANGE_REQUEST', {"loginId": getFermiLoginId(loginId)});
fw.sendToMsg("others", "HOST_CHANGE_REQUEST", {
loginId: getFermiLoginId(loginId),
});
}
function getFermiLoginId(loginId) {
return globalUserInfo.shopName + '_' + loginId;
return globalUserInfo.shopName + "_" + loginId;
}
function getReplacedLoginId(loginId) {
return loginId.replaceAll(globalUserInfo.shopName + '_', '');
return loginId.replaceAll(globalUserInfo.shopName + "_", "");
}
function captureAndShareImage(urls, changeHostName) {
addCaptureEffect();
$(this).removeClass("on");
var w,h;
var w, h;
var video = document.getElementById("localVideo");
var canvas = document.createElement('canvas');
var canvas = document.createElement("canvas");
if (clientOrientaionState == 1) {
canvas.width = w = 680;
canvas.width = w = 680;
canvas.height = h = 515;
} else {
canvas.width = w = 386;
canvas.width = w = 386;
canvas.height = h = 515;
}
if (canvas.getContext) {
var ctx = canvas.getContext('2d');
var ctx = canvas.getContext("2d");
ctx.drawImage(video, 0, 0, w, h);
ctx.drawImage(document.getElementById("canvasRemote"), 0, 0, w, h);
}
canvas.toBlob(function(blob) {
var newImg = document.createElement('img')
canvas.toBlob(function (blob) {
var newImg = document.createElement("img");
var url = URL.createObjectURL(blob);
canvasRemote.style.backgroundImage = "url('"+ URL.createObjectURL(blob) + "')";
canvasRemote.style.backgroundSize = "contain";
$(canvasRemote).attr("height", $(snapshots[cpatureViewIndex]).attr("height"));
canvasRemote.style.backgroundImage =
"url('" + URL.createObjectURL(blob) + "')";
canvasRemote.style.backgroundSize = "contain";
$(canvasRemote).attr(
"height",
$(snapshots[cpatureViewIndex]).attr("height")
);
$(canvasRemote).attr("width", $(snapshots[cpatureViewIndex]).attr("width"));
console.log ('url', URL.createObjectURL(blob));
if ($(".canvas_wrap").css("width").replace("px","") / $(".canvas_wrap").css("height").replace("px","") < $(canvas).attr("width") / $(canvas).attr("height")) {
var h = $(".canvas_wrap").css("width").replace("px","") * ($(canvas).attr("height") / $(canvas).attr("width"));
var w = $(".canvas_wrap").css("width").replace("px","");
console.log("url", URL.createObjectURL(blob));
if (
$(".canvas_wrap").css("width").replace("px", "") /
$(".canvas_wrap").css("height").replace("px", "") <
$(canvas).attr("width") / $(canvas).attr("height")
) {
var h =
$(".canvas_wrap").css("width").replace("px", "") *
($(canvas).attr("height") / $(canvas).attr("width"));
var w = $(".canvas_wrap").css("width").replace("px", "");
$(canvasRemote).css("height", h);
$(canvasRemote).css("width", w);
$(canvasRemote).css("margin-top", (-h/2));
$(canvasRemote).css("margin-left", (-w/2));
$(canvasRemote).css("margin-top", -h / 2);
$(canvasRemote).css("margin-left", -w / 2);
} else {
var h = $(".canvas_wrap").css("height").replace("px","");
var w = $(".canvas_wrap").css("height").replace("px","") / ($(canvas).attr("height") / $(canvas).attr("width"));
var h = $(".canvas_wrap").css("height").replace("px", "");
var w =
$(".canvas_wrap").css("height").replace("px", "") /
($(canvas).attr("height") / $(canvas).attr("width"));
$(canvasRemote).css("height", h);
$(canvasRemote).css("width", w);
$(canvasRemote).css("margin-top", (-h/2));
$(canvasRemote).css("margin-left", (-w/2));
$(canvasRemote).css("margin-top", -h / 2);
$(canvasRemote).css("margin-left", -w / 2);
}
$(".canvas_wrap").css("background-color", "#000");
$(".clear_img").show();
......@@ -792,145 +931,157 @@ function captureAndShareImage(urls, changeHostName) {
//Fermi側にイメージ保存。
var formData = new FormData();
var uploadFileName = "capture_share_" + g_webroom + "_" + g_shareCount + ".png"
var uploadFileName =
"capture_share_" + g_webroom + "_" + g_shareCount + ".png";
g_shareCount++;
formData.append("imgFile", blob, uploadFileName);
var uploadUrl = location.protocol + "//" + location.hostname + ":" + location.port + "/upload/create";
var uploadUrl =
location.protocol +
"//" +
location.hostname +
":" +
location.port +
"/upload/create";
if (!location.port) {
uploadUrl = location.protocol + "//" + location.hostname + "/upload/create";
uploadUrl =
location.protocol + "//" + location.hostname + "/upload/create";
}
$.ajax({
type: 'post',
type: "post",
url: g_coviewapiserverADDR + "/upload/create",
data: formData,
processData: false,
contentType: false,
success: function(res) {
setTimeout(function() {
success: function (res) {
setTimeout(function () {
SendFileShare(uploadFileName);
$("#coviewCaptureCtrBtn").hide();
$("#coviewRecCtrBtn").hide();
$(".coview_share_title_name").text("LIVE(CAPTURE IMAGE)");
$(".coview_on_media_btn_back").show();
//アーカイブ保存。
ArchiveFileManage(blob,uploadFileName,urls);
ArchiveFileManage(blob, uploadFileName, urls);
}, 1500);
},
error: function(err) {
error: function (err) {
console.log(err);
}
},
});
});
}
function micOn() {
coview_api.MicMuteControl('off');
$('#micBtn').addClass('bg_blue');
$('#micBtn').removeClass('bg_red');
};
coview_api.MicMuteControl("off");
$("#micBtn").addClass("bg_blue");
$("#micBtn").removeClass("bg_red");
}
function micOff() {
coview_api.MicMuteControl('on');
$('#micBtn').removeClass('bg_blue');
$('#micBtn').addClass('bg_red');
};
coview_api.MicMuteControl("on");
$("#micBtn").removeClass("bg_blue");
$("#micBtn").addClass("bg_red");
}
function micTogle() {
if ($('#micBtn').hasClass('bg_red')) {
micOn();
if ($("#micBtn").hasClass("bg_red")) {
micOn();
} else {
micOff();
micOff();
}
};
}
function recordStart() {
console.log("レコードを開始しました");
MainManRecord('on');
$('#recordBtn').removeClass('bg_gray');
$('#recordBtn').addClass('bg_red');
};
MainManRecord("on");
$("#recordBtn").removeClass("bg_gray");
$("#recordBtn").addClass("bg_red");
}
function recordFinished() {
$('#recordBtn').addClass('bg_gray');
$('#recordBtn').removeClass('bg_red');
$("#recordBtn").addClass("bg_gray");
$("#recordBtn").removeClass("bg_red");
// ロック画面の削除
delete_dom_obj('screenLock');
};
delete_dom_obj("screenLock");
}
function recordTogle() {
if ($('#recordBtn').hasClass('bg_gray')) {
if ($("#recordBtn").hasClass("bg_gray")) {
recordStart();
} else {
recordStop(function() {
recordStop(function () {
console.log("レコードを終了しました");
});
}
};
}
function recordStop(callback) {
// アーカイブ保存中は画面操作不可(協業終了,協業切り替え防止)
screenLock();
// アーカイブ保存処理
MainManRecordWithCollaboration('stop', CMS_SERVER_URL + '/chatapi/file/uploadArchive', callback);
MainManRecordWithCollaboration(
"stop",
CMS_SERVER_URL + "/chatapi/file/uploadArchive",
callback
);
}
function MainManRecordWithCollaboration(action, url, callback) {
mediaRecorder.stop();
console.log('Recorded Blobs: ', recordedBlobs);
console.log("Recorded Blobs: ", recordedBlobs);
setTimeout(function() {
setTimeout(function () {
console.log("Recoding File upload..");
const blob = new Blob(recordedBlobs, {type: 'video/webm'});
console.log(blob)
const blob = new Blob(recordedBlobs, { type: "video/webm" });
console.log(blob);
var uploadFileName = "record_" + g_webroom + "_" + g_shareCount + ".webm";
g_shareCount++;
var formData = new FormData();
formData.append("fileData",blob,uploadFileName);
formData.append('sid', globalUserInfo.sid);
formData.append('roomId', globalUserInfo.roomId);
formData.append("fileData", blob, uploadFileName);
formData.append("sid", globalUserInfo.sid);
formData.append("roomId", globalUserInfo.roomId);
if (joinCollaborationType == COLLABORATION_TYPE.VIDEO) {
formData.append('archiveType', 1);
formData.append("archiveType", 1);
} else {
formData.append('archiveType', 2);
formData.append("archiveType", 2);
}
console.log(uploadFileName)
console.log(uploadFileName);
$.ajax({
type :'post',
url,
data : formData,
contentType: false,
processData: false,
success : function(res) {
recordFinished();
console.log(res);
callback();
}
,error : function(err){
recordFinished();
console.log(err);
callback();
}
type: "post",
url,
data: formData,
contentType: false,
processData: false,
success: function (res) {
recordFinished();
console.log(res);
callback();
},
error: function (err) {
recordFinished();
console.log(err);
callback();
},
});
}, 1000);
}
function screenLock(){
function screenLock() {
// ロック用のdivを生成
var element = document.createElement('div');
element.id = "screenLock";
var element = document.createElement("div");
element.id = "screenLock";
// ロック用のスタイル
element.style.height = '100%';
element.style.left = '0px';
element.style.position = 'fixed';
element.style.top = '0px';
element.style.width = '100%';
element.style.zIndex = '9999';
element.style.opacity = '0';
var objBody = document.getElementsByTagName("body").item(0);
element.style.height = "100%";
element.style.left = "0px";
element.style.position = "fixed";
element.style.top = "0px";
element.style.width = "100%";
element.style.zIndex = "9999";
element.style.opacity = "0";
var objBody = document.getElementsByTagName("body").item(0);
objBody.appendChild(element);
}
......
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