Commit 37bc4f94 by Kim Peace

Fixed var to const and let

parent ab1b8a92
......@@ -81,9 +81,9 @@
var archiveId;
window.addEventListener('DOMContentLoaded', function () {
var urlPrm = new Object;
var urlSearch = location.search.substring(1).split('&');
var kv = urlSearch[0].split('=');
let urlPrm = new Object;
const urlSearch = location.search.substring(1).split('&');
const kv = urlSearch[0].split('=');
urlPrm[kv[0]] = kv[1];
archiveId = urlPrm.archiveId
ArchiveUI.refreshArchiveDetailScreen(urlPrm.archiveId);
......
......@@ -69,6 +69,13 @@ const COLLABORATION_JOIN_TYPE = {
INVITED: "2",
};
const ARCHIVE_TYPE = {
PICTURE: 0,
VIDEO: 1,
VOICE: 2,
DOCUMENT: 3,
};
const messageSeperator = "<::split>";
const DATA_MESSAGE_SCHEME = "::NOT_MESSAGE";
const FINISH_ALL_COLLABORATION_SIGNAL = "::ALL_COLLABORATION_END";
......
// ios用
function callNativeApp(iosKey, jsonData) {
console.log("callNativeApp called: " + iosKey);
console.debug("callNativeApp called: " + iosKey);
var result;
try {
var key = iosKey;
......@@ -10,7 +10,7 @@ function callNativeApp(iosKey, jsonData) {
// resにObjective-cからのレスポンスが返る
result = prompt(JSON.stringify(payload));
} catch (err) {
console.log("The native context does not exist yet");
console.debug("The native context does not exist yet");
}
return result;
}
......@@ -75,26 +75,26 @@ NativeBridgeDataSource.getMyInfo = function () {
}
};
NativeBridgeDataSource.getMessages = function (roomId) {
NativeBridgeDataSource.getMessagesByRoomID = function (roomID) {
if (deviceInfo.isiOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getMessages, { roomId: roomId })
callNativeApp(NATIVE_KEY_IOS.getMessages, { roomId: roomID })
);
} else if (deviceInfo.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMessageList(roomId));
return JSON.parse(android.getMessageList(roomID));
}
};
NativeBridgeDataSource.getMessagesWithMessageId = function (messageId) {
NativeBridgeDataSource.getMessagesByMessageID = function (messageID) {
if (deviceInfo.isiOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getMessageListFromMessageId, {
messageId: messageId,
messageId: messageID,
})
);
} else if (deviceInfo.isAndroid()) {
return JSON.parse(android.getMessageListFromMessageId(messageId));
return JSON.parse(android.getMessageListFromMessageId(messageID));
}
};
......@@ -153,7 +153,6 @@ NativeBridgeDataSource.getGroupInfoForAddUser = function (groupId) {
callNativeApp(NATIVE_KEY_IOS.getGroupInfoForAddUser, { groupId: groupId })
);
} else if (deviceInfo.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getGroupInfoForAddUser(groupId));
}
};
......@@ -162,8 +161,6 @@ NativeBridgeDataSource.loadSelectedUsers = function () {
if (deviceInfo.isiOS()) {
return JSON.parse(callNativeApp(NATIVE_KEY_IOS.getSelectedUserList, {}));
} else if (deviceInfo.isAndroid()) {
//String形式をJsonに変更してReturn
console.log(JSON.parse(android.getSelectedUserList()));
return JSON.parse(android.getSelectedUserList());
}
};
......@@ -334,7 +331,6 @@ NativeBridgeDataSource.getUserInfo = function (shopMemberId) {
};
NativeBridgeDataSource.getUserListByLoginId = function (loginIdList) {
console.log(loginIdList);
if (deviceInfo.isiOS()) {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getUserListByLoginId, {
......
......@@ -190,15 +190,15 @@ NativeBridgeDelegate.goHome = function () {
}
};
NativeBridgeDelegate.updatePreMessage = function (messageId) {
NativeBridgeDelegate.updatePreMessage = function (messageID) {
if (typeof android != "undefined") {
if (serverInfo.isOnline == "true") {
android.updatePreMessage(messageId);
android.updatePreMessage(messageID);
}
} else {
// 追加メッセージUpdate、get
webkit.messageHandlers.updatePreMessage.postMessage({
messageId: messageId,
messageId: messageID,
});
}
};
......
var bindOnNewMessage = function () {
// New Message
// #36170
socket.on(SOCKET_KEY.NEW_MESSAGE, function (message, roomId, roomName) {
socket.on(SOCKET_KEY.NEW_MESSAGE, function (message, roomID, roomName) {
const systemMessageTemplate = getTemplate(TemplateURL.SYSTEM_MESSAGE);
const unwrappedMessageInfo = decodeMessage(message.text);
......
......@@ -181,7 +181,7 @@ var bindOnRefreshUserListInGroup = function () {
socket.on(
SOCKET_KEY.REFRESH_USERLIST_INGROUP,
function (users, groupId, isInvite) {
console.log(
console.debug(
SOCKET_KEY.REFRESH_USERLIST_INGROUP +
"message received but it does nothing."
);
......
......@@ -22,8 +22,7 @@ $("#image-form").on("submit", function (e) {
$(".overlay").addClass("active undismissable");
$(".loader").addClass("active");
Common.showLoadingIndicator();
var fd = new FormData($(this)[0]);
console.log($(this)[0]);
let fd = new FormData($(this)[0]);
//画像の大きさが500pixelより大きかったら、thumbnailを生成
ChatMediaHandler.createThumbnailAndUpload(
file,
......@@ -180,9 +179,11 @@ ChatMediaHandler.videoEncodeEnd = function (encodedUri) {
xhr.send();
};
// Video のサムネイルファイル生成する
ChatMediaHandler.createVideoThumbnailAndUpload = function (sourceImage, callback) {
ChatMediaHandler.createVideoThumbnailAndUpload = function (
sourceImage,
callback
) {
var fileReader = new FileReader();
fileReader.onload = function () {
......@@ -223,7 +224,7 @@ ChatMediaHandler.createVideoThumbnailAndUpload = function (sourceImage, callback
.catch((error) => {
// fetch Error catch Block
if (error) {
console.log(error);
console.error(error);
}
});
return true;
......@@ -239,7 +240,6 @@ ChatMediaHandler.createVideoThumbnailAndUpload = function (sourceImage, callback
fileReader.readAsArrayBuffer(sourceImage);
};
// Ajaxでイメージをアップロードする
ChatMediaHandler.uploadImage = function (formData) {
formData.append("roomId", roomInfo.roomID);
......@@ -379,7 +379,6 @@ ChatMediaHandler.uploadImage = function (formData) {
});
};
// Thumbnailのファイルを生成する。
ChatMediaHandler.createThumbnailAndUpload = function (sourceImage, callback) {
const fileReader = new FileReader();
......@@ -435,7 +434,7 @@ ChatMediaHandler.createThumbnailAndUpload = function (sourceImage, callback) {
.catch((error) => {
// fetch Error catch Block
if (error) {
console.log(error);
console.error(error);
}
});
};
......
......@@ -3,18 +3,18 @@ var ArchiveUI = {};
document.addEventListener("DOMContentLoaded", function () {
// アーカイブ検索
bindArchiveSearch();
ArchiveUI.bindArchiveSearch();
// iOSキーボード変換検知用
bindiOSKeyBoardEvent();
ArchiveUI.bindiOSKeyBoardEvent();
});
ArchiveUI.refreshSearchScreen = function (keyword) {
const archiveList = NativeBridgeDataSource.getArchiveByName(keyword);
const typeImage = getArchiveTypeIconURL(archive.archiveType);
const typeImage = ArchiveUI.getArchiveTypeIconURL(archive.archiveType);
getArchiveTemplate().then(function (archiveTemplate) {
ArchiveUI.getArchiveTemplate().then(function (archiveTemplate) {
archiveList.forEach(function (archive) {
let html = renderArchiveTemplate(
let html = ArchiveUI.renderArchiveTemplate(
archiveTemplate,
archive.archiveId,
archive.archiveName,
......@@ -28,15 +28,7 @@ ArchiveUI.refreshSearchScreen = function (keyword) {
});
};
//* UTILS *//
const ARCHIVE_TYPE = {
PICTURE: 0,
VIDEO: 1,
VOICE: 2,
DOCUMENT: 3,
};
var getArchiveTypeIconURL = function (type) {
ArchiveUI.getArchiveTypeIconURL = function (type) {
switch (type) {
case ARCHIVE_TYPE.PICTURE:
return "icon/icon_collabo_picture.png";
......@@ -51,7 +43,7 @@ var getArchiveTypeIconURL = function (type) {
}
};
var getArchiveTemplate = function () {
ArchiveUI.getArchiveTemplate = function () {
return new Promise(function (resolve, reject) {
$.get({ url: TemplateURL.ARCHIVE_LIST, async: false }, function (text) {
resolve(text);
......@@ -59,10 +51,10 @@ var getArchiveTemplate = function () {
});
};
var bindArchiveSearch = function () {
ArchiveUI.bindArchiveSearch = function () {
const searchInput = $('#archive .search_form input[type="search"]');
searchInput.keyup(function (e) {
var keyword = searchInput.val();
const keyword = searchInput.val();
const enterKeyPressed = e.KeyCode == 13 || e.key == "Enter";
const keywordEmpty = keyword == "" || keyword.length < 2;
const keywordNotEmpty = keyword.length != 0 && keyword != "";
......@@ -87,18 +79,18 @@ var bindArchiveSearch = function () {
});
};
var bindiOSKeyBoardEvent = function () {
ArchiveUI.bindiOSKeyBoardEvent = function () {
const searchInput = $('#archive .search_form input[type="search"]');
searchInput.on("compositionend", function () {
if (deviceInfo.isiOS()) {
var keyword = searchInput.val();
const keyword = searchInput.val();
$(".overlay_src_msg").empty();
ArchiveUI.refreshSearchScreen(keyword);
}
});
};
var renderArchiveTemplate = function (
ArchiveUI.renderArchiveTemplate = function (
html,
archiveId,
archiveName,
......@@ -131,13 +123,13 @@ ArchiveUI.refreshArchiveDetailScreen = function (archiveId) {
const archive = NativeBridgeDataSource.getArchiveDetail(archiveId);
// template archive detail
appendArchiveDetailScreen(archive);
ArchiveUI.appendArchiveDetailScreen(archive);
// setup player
appendPlayer(archive);
ArchiveUI.appendPlayer(archive);
// append attended users
appendAttendUsers(archive.attendUserIds);
ArchiveUI.appendAttendUsers(archive.attendUserIds);
// set languages
currentUserInfo.configureLanguage();
......@@ -159,7 +151,7 @@ ArchiveUI.refreshArchiveDetailScreen = function (archiveId) {
Common.dismissLoadingIndicator();
};
var appendArchiveDetailScreen = function (archive) {
ArchiveUI.appendArchiveDetailScreen = function (archive) {
// 保存ユーザ情報を取得
const userInfo = NativeBridgeDataSource.getUserInfo(archive.saveUserId);
userInfo.profileUrl = Common.getProfileImgUrl(userInfo.profileUrl);
......@@ -182,7 +174,7 @@ var appendArchiveDetailScreen = function (archive) {
$("#archiveDetail").append(obj);
};
var appendPlayer = function (archive) {
ArchiveUI.appendPlayer = function (archive) {
// プレイヤーの切り替え
const archiveFilePath = ArchiveUI.createGetDataUrl(
archive.filePath,
......@@ -192,15 +184,15 @@ var appendPlayer = function (archive) {
switch (archive.archiveType) {
case "0": // 画像
case 0:
appendImageTypePlayer(archiveFilePath);
ArchiveUI.appendImageTypePlayer(archiveFilePath);
break;
case "1": // 動画
case 1:
appendVideoTypePlayer(archiveFilePath);
ArchiveUI.appendVideoTypePlayer(archiveFilePath);
break;
case "2": // 音声
case 2:
appendVoiceTypePlayer(archiveFilePath);
ArchiveUI.appendVoiceTypePlayer(archiveFilePath);
break;
case "3": // 文書
case 3:
......@@ -211,13 +203,13 @@ var appendPlayer = function (archive) {
}
};
var appendImageTypePlayer = function (filePath) {
ArchiveUI.appendImageTypePlayer = function (filePath) {
$("#archive_player").prepend(
'<img class="archive_player" src="' + filePath + '" />'
);
};
var appendVideoTypePlayer = function (filePath) {
ArchiveUI.appendVideoTypePlayer = function (filePath) {
if (deviceInfo.isiOS()) {
$("#archive_player").prepend(
'<video class="archive_player" controls autoplay muted playsinline controlsList="nodownload"><source src="' +
......@@ -237,7 +229,7 @@ var appendVideoTypePlayer = function (filePath) {
}
};
var appendVoiceTypePlayer = function (filePath) {
ArchiveUI.appendVoiceTypePlayer = function (filePath) {
if (deviceInfo.isiOS()) {
$("#archive_player").prepend(
'<audio class="archive_audio_player" controls controlsList="nodownload"><source src="' +
......@@ -258,7 +250,7 @@ var appendVoiceTypePlayer = function (filePath) {
);
};
var appendAttendUsers = function (attendedUserList) {
ArchiveUI.appendAttendUsers = function (attendedUserList) {
// ユーザの様式を読み込む
const archiveUserTemplate = getTemplate(TemplateURL.ARCHIVE_USER);
......@@ -271,7 +263,7 @@ var appendAttendUsers = function (attendedUserList) {
if (user == "") {
return;
}
var userInfo = NativeBridgeDataSource.getUserInfo(user);
const userInfo = NativeBridgeDataSource.getUserInfo(user);
userInfo.profileUrl = Common.getProfileImgUrl(userInfo.profileUrl);
const html = Mustache.render(archiveUserTemplate, {
profileImage: userInfo.profileUrl,
......@@ -288,15 +280,15 @@ var appendAttendUsers = function (attendedUserList) {
};
ArchiveUI.createGetDataUrl = function (fileName, roomId) {
var filePath =
return (
serverInfo.cmsURL +
"/chatapi/file/getImage?sid=" +
currentUserInfo.sid +
"&fileName=" +
fileName +
"&roomId=" +
roomId;
return filePath;
roomId
);
};
// アーカイブ一覧
......@@ -316,7 +308,7 @@ ArchiveUI.refreshArchiveScreen = function () {
}
// ローカルDBのデータを表示
var archiveList = NativeBridgeDataSource.getArchiveList();
const archiveList = NativeBridgeDataSource.getArchiveList();
if (typeof archiveList == "undefined") {
Common.dismissLoadingIndicator();
return;
......@@ -340,13 +332,13 @@ ArchiveUI.refreshArchiveScreen = function () {
// その他
typeImage = "";
}
let html = Mustache.render(archiveTemplate, {
const html = Mustache.render(archiveTemplate, {
archiveId: archive.archiveId,
fileName: archive.archiveName,
insertDate: archive.archiveDate,
typeImage: typeImage,
});
let obj = $(jQuery.parseHTML(html)).on("click", function () {});
const obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#archiveList").append(obj);
});
......
......@@ -95,7 +95,8 @@ ChatRoom.loadMessages = function (joinRoomID, joinRoomName) {
ChatRoom.appendAttendedUsers(roomID);
// メッセージ表示
ChatRoom.prependMessage(roomID);
let messages = NativeBridgeDataSource.getMessagesByRoomID(roomID);
ChatRoom.prependMessage(messages);
// スクロール調整
let jQueryMessages = $("#messages");
......@@ -144,8 +145,7 @@ ChatRoom.appendAttendedUsers = function (roomID) {
$("#filter").append(filterObj);
};
ChatRoom.prependMessage = function (roomID) {
const messages = NativeBridgeDataSource.getMessages(roomID);
ChatRoom.prependMessage = function (messages) {
const now = new Date();
// メッセージ文字列の生成
let workVal = "";
......
......@@ -17,9 +17,9 @@ window.onscroll = function () {
'<div id="chatLoader" class="text-center"><div class="spinner-grow spinner-grow-sm" role="status" /></div>'
);
$("#messages").prepend(loader);
const messageId = $($(".chat_message").get(0)).data("messageid");
NativeBridgeDelegate.updatePreMessage(messageId);
let messages = NativeBridgeDataSource.getMessagesWithMessageId(messageId);
const messageID = $($(".chat_message").get(0)).data("messageid");
NativeBridgeDelegate.updatePreMessage(messageID);
let messages = NativeBridgeDataSource.getMessagesByMessageID(messageID);
ChatRoom.prependMessage(messages);
loader.remove();
var afterHeight = $(".room_container").height();
......
......@@ -3,9 +3,9 @@ var ChatAddUser = {};
document.addEventListener("DOMContentLoaded", function () {
// メンバー検索
bindMemberSearch();
ChatAddUser.bindMemberSearch();
// iOSキーボード変換検知用
bindiOSKeyBoardEvent();
ChatAddUser.bindiOSKeyBoardEvent();
$("#chat_add_user .search_form .cancel").click(function () {
let roomListTitle = getLocalizedString("inviteUsersSubtitle");
......@@ -24,17 +24,17 @@ ChatAddUser.searchUser = function (keyword) {
if (isAllGroup) {
//グループデータ検索
const groupList = NativeBridgeDataSource.getGroupByName(keyword);
searchGroupData(groupList, overlayMessage);
ChatAddUser.searchGroupData(groupList, overlayMessage);
//ユーザデータ検索
var userList =
const userList =
NativeBridgeDataSource.getAllGroupShopMemberNotInRoomByName(keyword);
searchUserData(userList, overlayMessage);
ChatAddUser.searchUserData(userList, overlayMessage);
hasNoData = userList.length == 0 && groupList.length == 0;
//連絡先画面
} else {
var userList =
const userList =
NativeBridgeDataSource.getMyGroupShopMemberNotInRoomByName(keyword);
searchUserData(userList, overlayMessage);
hasNoData = userList.length == 0;
......@@ -48,7 +48,7 @@ ChatAddUser.searchUser = function (keyword) {
/** UTILS */
var bindMemberSearch = function () {
ChatAddUser.bindMemberSearch = function () {
const searchInput = $('#chat_add_user .search_form input[type="search"]');
searchInput.click(function (e) {
//画面タイトル設定
......@@ -81,7 +81,7 @@ var bindMemberSearch = function () {
});
};
var bindiOSKeyBoardEvent = function () {
ChatAddUser.bindiOSKeyBoardEvent = function () {
const searchInput = $('#chat_add_user .search_form input[type="search"]');
searchInput.on("compositionend", function () {
if (deviceInfo.isiOS()) {
......@@ -91,7 +91,7 @@ var bindiOSKeyBoardEvent = function () {
});
};
var searchGroupData = function (groupList, overlayMessage) {
ChatAddUser.searchGroupData = function (groupList, overlayMessage) {
const groupTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_LIST);
groupList.forEach(function (group) {
......@@ -106,40 +106,40 @@ var searchGroupData = function (groupList, overlayMessage) {
});
};
var renderGroupTemplate = function (groupTemplate, groupName, groupID) {
ChatAddUser.renderGroupTemplate = function (groupTemplate, groupName, groupID) {
return Mustache.render(groupTemplate, {
name: groupName,
id: groupID,
});
};
var searchUserData = function (userList, overlayMessage) {
ChatAddUser.searchUserData = function (userList, overlayMessage) {
const userTemplate = getTemplate(TemplateURL.MAKE_ROOM_USER_LIST);
userList.forEach(function (user) {
setUserProfile(user);
checkUser(user);
ChatAddUser.setUserProfile(user);
ChatAddUser.checkUser(user);
});
let html = renderUserTemplate(userTemplate, userList);
let html = ChatAddUser.renderUserTemplate(userTemplate, userList);
let obj = jQuery.parseHTML(html);
overlayMessage.append(obj);
};
var setUserProfile = function (user) {
ChatAddUser.setUserProfile = function (user) {
user.profileUrl = Common.getProfileImgUrl(user.profileUrl);
};
var checkUser = function (user) {
ChatAddUser.checkUser = function (user) {
let findObj = ChatManagementCommon.selectedUserList.find(function (
shopMemberId
shopMemberID
) {
return shopMemberId == user.shopMemberId;
return shopMemberID == user.shopMemberId;
});
if (findObj) {
user.checked = "checked";
}
};
var renderUserTemplate = function (userTemplate, userList) {
ChatAddUser.renderUserTemplate = function (userTemplate, userList) {
return Mustache.render(userTemplate, {
userList: userList,
});
......@@ -254,7 +254,7 @@ ChatAddUser.refreshAllGroupForAddUser = function (paramGroupId) {
NativeBridgeDelegate.updateGroupInfo(groupId);
//画面エリアを初期化。
initialzScreen();
ChatAddUser.initialzScreen();
//DBからグループ情報を取得。
const result = NativeBridgeDataSource.getGroupInfoForAddUser(groupId);
......@@ -284,16 +284,16 @@ ChatAddUser.refreshAllGroupForAddUser = function (paramGroupId) {
}
//該当グループのパースを表示。
appendGroupPath(result.groupPathList);
ChatAddUser.appendGroupPath(result.groupPathList);
//該当グループの下位グループ表示。
appendGroupInGroup(result.childGroupList);
ChatAddUser.appendGroupInGroup(result.childGroupList);
//該当グループの所属ユーザを表示。
appendUserInGroup(result.groupUserList);
ChatAddUser.appendUserInGroup(result.groupUserList);
};
var initialzScreen = function () {
ChatAddUser.initialzScreen = function () {
$("#parentGroupBtnForAddUser").off();
$("#rootGroupBtnForAddUser").off();
$("#childGroupListAreaForAddUser").html("");
......@@ -301,7 +301,7 @@ var initialzScreen = function () {
$("#groupPathAreaForAddUser").html("");
};
var appendGroupPath = function (groupPathList) {
ChatAddUser.appendGroupPath = function (groupPathList) {
const groupPathTemplate = getTemplate(TemplateURL.ADD_USER_GROUP_PATH);
let groupPathCount = 0;
groupPathList.forEach(function (groupPath) {
......@@ -317,7 +317,7 @@ var appendGroupPath = function (groupPathList) {
});
};
var appendGroupInGroup = function (childGroupList) {
ChatAddUser.appendGroupInGroup = function (childGroupList) {
const groupTemplate = getTemplate(TemplateURL.ADD_USER_GROUP_LIST);
childGroupList.forEach(function (childGroup) {
......@@ -331,14 +331,14 @@ var appendGroupInGroup = function (childGroupList) {
});
};
var appendUserInGroup = function (groupUserList) {
ChatAddUser.appendUserInGroup = function (groupUserList) {
const userTemplate = getTemplate(TemplateURL.ADD_USER_USER_LIST);
groupUserList.forEach(function (groupUser) {
groupUser.profileUrl = Common.getProfileImgUrl(groupUser.profileUrl);
let findObj = ChatManagementCommon.selectedUserList.find(function (
shopMemberId
shopMemberID
) {
return shopMemberId == groupUser.shopMemberId;
return shopMemberID == groupUser.shopMemberId;
});
if (findObj) {
groupUser.checked = "checked";
......
......@@ -3,12 +3,12 @@ var ChatMakeRoom = {};
document.addEventListener("DOMContentLoaded", function () {
// メンバー検索
searchMember();
ChatMakeRoom.searchMember();
// iOSキーボード変換検知用
bindiOSKeyBoardEvent();
ChatMakeRoom.bindiOSKeyBoardEvent();
bindSearchCancel();
ChatMakeRoom.bindSearchCancel();
});
// メンバー検索
......@@ -21,29 +21,35 @@ ChatMakeRoom.searchUser = function (keyword) {
//全グループ検索画面
if (isAllGroup) {
//グループデータ検索
var groupList = NativeBridgeDataSource.getGroupByName(keyword);
var groupTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_LIST);
const groupList = NativeBridgeDataSource.getGroupByName(keyword);
const groupTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_LIST);
groupList.forEach(function (group) {
let html = renderRoomList(groupTemplate, group.groupName, group.groupId);
let html = ChatMakeRoom.renderRoomList(
groupTemplate,
group.groupName,
group.groupId
);
let obj = jQuery.parseHTML(html);
overlayMessage.append(obj);
});
//ユーザデータ検索
const userList = NativeBridgeDataSource.getAllGroupShopMemberByName(keyword);
searchUserData(userList);
var userTemplate = getTemplate(TemplateURL.MAKE_ROOM_USER_LIST);
let html = renderUser(userTemplate, userList);
let obj = jQuery.parseHTML(html);
const userList =
NativeBridgeDataSource.getAllGroupShopMemberByName(keyword);
ChatMakeRoom.searchUserData(userList);
const userTemplate = getTemplate(TemplateURL.MAKE_ROOM_USER_LIST);
const html = ChatMakeRoom.renderUser(userTemplate, userList);
const obj = jQuery.parseHTML(html);
overlayMessage.append(obj);
hasNoData = groupList.length == 0 && userList.length == 0;
} else { // 連絡先画面
} else {
// 連絡先画面
const userList = NativeBridgeDataSource.getMyGroupShopMemberByName(keyword);
searchUserData(userList);
ChatMakeRoom.searchUserData(userList);
var userTemplate = getTemplate(TemplateURL.MAKE_ROOM_USER_LIST);
let html = renderUser(userTemplate, userList);
let html = ChatMakeRoom.renderUser(userTemplate, userList);
let obj = jQuery.parseHTML(html);
overlayMessage.html(obj);
......@@ -58,14 +64,14 @@ ChatMakeRoom.searchUser = function (keyword) {
/** UTIL */
var searchMember = function () {
ChatMakeRoom.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) {
var keyword = searchInput.val();
const keyword = searchInput.val();
const enterKeyPressed = e.KeyCode == 13 || e.key == "Enter";
const keywordEmpty = keyword == "" || keyword.length < 2;
const keywordNotEmpty = keyword != "" && keyword.length != 0;
......@@ -87,31 +93,31 @@ var searchMember = function () {
});
};
var bindiOSKeyBoardEvent = function () {
ChatMakeRoom.bindiOSKeyBoardEvent = function () {
if (deviceInfo.isiOS()) {
const searchInput = $('#chatMakeRoom .search_form input[type="search"]');
searchInput.on("compositionend", function () {
if (deviceInfo.isiOS()) {
var keyword = searchInput.val();
ChatMakeRoom.searchUser(keyword);
}
});
}
};
var bindSearchCancel = function () {
ChatMakeRoom.bindSearchCancel = function () {
$("#chatMakeRoom .search_form .cancel").click(function () {
let roomListTitle = getLocalizedString("createRoomTitle");
$("#makeRoomTitle").text(roomListTitle);
});
};
var renderRoomList = function (url, groupName, groupID) {
ChatMakeRoom.renderRoomList = function (url, groupName, groupID) {
return Mustache.render(url, {
name: groupName,
id: groupID,
});
};
var searchUserData = function (userList) {
ChatMakeRoom.searchUserData = function (userList) {
userList.forEach(function (user) {
user.profileUrl = Common.getProfileImgUrl(user.profileUrl);
let findObj = ChatManagementCommon.selectedUserList.find(function (
......@@ -125,15 +131,14 @@ var searchUserData = function (userList) {
});
};
var renderUser = function (url, userList) {
ChatMakeRoom.renderUser = function (url, userList) {
return Mustache.render(url, {
userList: userList,
});
};
$("#makeRoomConfirmBtn").on("click", function (e) {
const selectedUserList =
ChatManagementCommon.selectedUserList.join(",");
const selectedUserList = ChatManagementCommon.selectedUserList.join(",");
NativeBridgeDelegate.saveSelectedUserList(selectedUserList);
$("#makeRoomForm").submit();
});
......@@ -154,18 +159,20 @@ ChatMakeRoom.refreshMyGroupForMakeRoom = function () {
let contactListTitle = getLocalizedString("userSearch");
$("#title").text(contactListTitle);
// グループの様式を読み込む
var groupTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_LIST);
NativeBridgeDelegate.updateContactInfo();
// ユーザの様式を読み込む
var userTemplate = getTemplate(TemplateURL.MAKE_ROOM_USER_LIST);
ChatMakeRoom.appendFavoriteGroupList();
var groupUserTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_USER_LIST);
ChatMakeRoom.appendFavoriteUserList();
NativeBridgeDelegate.updateContactInfo();
ChatMakeRoom.appendMyGroupList();
};
ChatMakeRoom.appendFavoriteGroupList = function () {
// グループの様式を読み込む
const groupTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_LIST);
//お気に入りグループ取得。
var favoriteGroupList = NativeBridgeDataSource.getFavoriteGroups();
const favoriteGroupList = NativeBridgeDataSource.getFavoriteGroups();
favoriteGroupList.forEach(function (favoriteGroup) {
let html = Mustache.render(groupTemplate, {
name: favoriteGroup.groupName,
......@@ -175,14 +182,18 @@ ChatMakeRoom.refreshMyGroupForMakeRoom = function () {
let obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#favoriteListForMakeRoom").append(obj);
});
//お気に入りユーザ取得。
var favoriteUserList = NativeBridgeDataSource.getFavoriteUsers();
};
ChatMakeRoom.appendFavoriteUserList = function () {
// ユーザの様式を読み込む
const userTemplate = getTemplate(TemplateURL.MAKE_ROOM_USER_LIST);
const favoriteUserList = NativeBridgeDataSource.getFavoriteUsers();
favoriteUserList.forEach(function (favoriteUser) {
favoriteUser.profileUrl = Common.getProfileImgUrl(favoriteUser.profileUrl);
let findObj = ChatManagementCommon.selectedUserList.find(function (
shopMemberId
shopMemberID
) {
return shopMemberId == favoriteUser.shopMemberId;
return shopMemberID == favoriteUser.shopMemberId;
});
if (findObj) {
favoriteUser.checked = "checked";
......@@ -193,15 +204,18 @@ ChatMakeRoom.refreshMyGroupForMakeRoom = function () {
});
let obj = jQuery.parseHTML(html);
$("#favoriteListForMakeRoom").append(obj);
};
var myGroupList = NativeBridgeDataSource.getMyGroupUsers();
ChatMakeRoom.appendMyGroupList = function () {
const groupUserTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_USER_LIST);
const myGroupList = NativeBridgeDataSource.getMyGroupUsers();
myGroupList.forEach(function (myGroup) {
myGroup.groupUserList.forEach(function (groupUser) {
groupUser.profileUrl = Common.getProfileImgUrl(groupUser.profileUrl);
let findObj = ChatManagementCommon.selectedUserList.find(function (
shopMemberId
shopMemberID
) {
return shopMemberId == groupUser.shopMemberId;
return shopMemberID == groupUser.shopMemberId;
});
if (findObj) {
groupUser.checked = "checked";
......@@ -218,7 +232,7 @@ ChatMakeRoom.refreshMyGroupForMakeRoom = function () {
};
ChatMakeRoom.refreshAllGroupForMakeRoom = function (paramGroupId) {
var groupId = paramGroupId;
let groupId = paramGroupId;
$(".cancel").addClass("none");
$(".search_form input").removeClass("focus");
$(".search_form input").val("");
......@@ -264,11 +278,21 @@ ChatMakeRoom.refreshAllGroupForMakeRoom = function (paramGroupId) {
$("#parentGroupArea").removeClass("none");
}
//該当グループのパースを表示。
var groupPathTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_PATH);
ChatMakeRoom.appendGroupPathList(result.groupPathList);
//該当グループの下位グループ表示。
ChatMakeRoom.appendGroupList(result.childGroupList);
//該当グループの所属ユーザを表示。
ChatMakeRoom.appendUsersInGroup(result.groupUserList);
};
var groupPathCount = 0;
result.groupPathList.forEach(function (groupPath) {
if (!(groupPathCount < result.groupPathList.length - 3)) {
ChatMakeRoom.appendGroupPathList = function (groupPathList) {
const groupPathTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_PATH);
let groupPathCount = 0;
groupPathList.forEach(function (groupPath) {
if (!(groupPathCount < groupPathList.length - 3)) {
let html = Mustache.render(groupPathTemplate, {
name: groupPath.groupName,
id: groupPath.groupId,
......@@ -278,11 +302,12 @@ ChatMakeRoom.refreshAllGroupForMakeRoom = function (paramGroupId) {
}
groupPathCount++;
});
};
//該当グループの下位グループ表示。
var groupTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_LIST);
ChatMakeRoom.appendGroupList = function (childGroupList) {
const groupTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_LIST);
result.childGroupList.forEach(function (childGroup) {
childGroupList.forEach(function (childGroup) {
let html = Mustache.render(groupTemplate, {
name: childGroup.groupName,
id: childGroup.groupId,
......@@ -291,23 +316,24 @@ ChatMakeRoom.refreshAllGroupForMakeRoom = function (paramGroupId) {
let obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#childGroupListAreaForMakeRoom").append(obj);
});
};
//該当グループの所属ユーザを表示。
ChatMakeRoom.appendUsersInGroup = function (groupUserList) {
var userTemplate = getTemplate(TemplateURL.MAKE_ROOM_USER_LIST);
result.groupUserList.forEach(function (groupUser) {
groupUserList.forEach(function (groupUser) {
groupUser.profileUrl = Common.getProfileImgUrl(groupUser.profileUrl);
let findObj = ChatManagementCommon.selectedUserList.find(function (
shopMemberId
shopMemberID
) {
return shopMemberId == groupUser.shopMemberId;
return shopMemberID == groupUser.shopMemberId;
});
if (findObj) {
groupUser.checked = "checked";
}
});
let html = Mustache.render(userTemplate, {
userList: result.groupUserList,
userList: groupUserList,
});
let obj = jQuery.parseHTML(html);
$("#userInGroupListForMakeRoom").append(obj);
......
......@@ -6,17 +6,17 @@ ChatManagementCommon.selectedUserList = new Array();
ChatManagementCommon.showMakeRoomConfirmView = function () {
$("#selectedUserList").html("");
var userTemplate = getTemplate(TemplateURL.MAKE_ROOM_CONFIRM_USER_LIST);
const userTemplate = getTemplate(TemplateURL.MAKE_ROOM_CONFIRM_USER_LIST);
var selectedUserList = NativeBridgeDataSource.loadSelectedUsers();
const selectedUserList = NativeBridgeDataSource.loadSelectedUsers();
selectedUserList.forEach(function (user) {
let html = Mustache.render(userTemplate, {
const html = Mustache.render(userTemplate, {
id: user.shopMemberId,
profileImage: Common.getProfileImgUrl(user.profileUrl),
name: user.shopMemberName,
});
let obj = jQuery.parseHTML(html);
const obj = jQuery.parseHTML(html);
$("#selectedUserList").append(obj);
});
......@@ -28,11 +28,11 @@ ChatManagementCommon.showMakeRoomConfirmView = function () {
if (trimmedRoomName.length == 0) {
// loadingIndicatorを表示
Common.showLoadingIndicator();
let userIdList = new Array();
let userIDList = new Array();
let userNameList = new Array();
selectedUserList.forEach(function (user) {
userIdList.push(user.shopMemberId);
userIDList.push(user.shopMemberId);
userNameList.push(user.shopMemberName);
});
......@@ -41,7 +41,7 @@ ChatManagementCommon.showMakeRoomConfirmView = function () {
currentUserInfo.loginID + "," + userNameList.join(",");
NativeBridgeDelegate.createChatRoom(
ChatRoomType.DM,
userIdList.join(","),
userIDList.join(","),
newRoomName,
MakeRoomFlag.MAKE_ROOM,
false
......@@ -130,8 +130,8 @@ ChatManagementCommon.showMakeRoomConfirmView = function () {
ChatManagementCommon.showAddUserConfirmView = function () {
$("#selectedUserList").html("");
var userTemplate = getTemplate(TemplateURL.ADD_USER_CONFIRM_USER_LIST);
var selectedUserList = NativeBridgeDataSource.loadSelectedUsers();
const userTemplate = getTemplate(TemplateURL.ADD_USER_CONFIRM_USER_LIST);
const selectedUserList = NativeBridgeDataSource.loadSelectedUsers();
selectedUserList.forEach(function (user) {
let html = Mustache.render(userTemplate, {
......@@ -155,35 +155,36 @@ ChatManagementCommon.showAddUserConfirmView = function () {
});
};
ChatManagementCommon.checkForMakeChat = function (checkMemberId) {
ChatManagementCommon.checkForMakeChat = function (checkMemberID) {
let findObj = ChatManagementCommon.selectedUserList.find(function (
shopMemberId
shopMemberID
) {
return shopMemberId == checkMemberId;
return shopMemberID == checkMemberID;
});
if (findObj) {
// remove
ChatManagementCommon.selectedUserList =
ChatManagementCommon.selectedUserList.filter(function (
shopMemberId
) {
return checkMemberId != shopMemberId;
ChatManagementCommon.selectedUserList.filter(function (shopMemberID) {
return checkMemberID != shopMemberID;
});
$(".checkbox" + checkMemberId)
.prop("checked", false)
.trigger("change");
ChatManagementCommon.updateCheckBox(checkMemberID, false);
} else {
// add
ChatManagementCommon.selectedUserList.push(checkMemberId);
$(".checkbox" + checkMemberId)
.prop("checked", true)
.trigger("change");
ChatManagementCommon.selectedUserList.push(checkMemberID);
ChatManagementCommon.updateCheckBox(checkMemberID, true);
}
let cnt = ChatManagementCommon.selectedUserList.length;
const cnt = ChatManagementCommon.selectedUserList.length;
if (ChatManagementCommon.selectedUserList.length > 0) {
$(".select_member_num").text(cnt);
} else {
$(".select_member_num").text("0");
}
};
ChatManagementCommon.updateCheckBox = function (checkMemberID, checked) {
$(".checkbox" + checkMemberID)
.prop("checked", checked)
.trigger("change");
};
......@@ -63,7 +63,6 @@ function toggleMic() {
* レコード関連
*************/
function recordStart() {
console.log("peacekim:: レコードを開始しました");
MainManRecord("on");
$("#recordBtn .record").addClass("disable");
$(".flash-txt").addClass("on");
......@@ -81,7 +80,7 @@ function toggleRecord() {
recordStart();
} else {
recordStop(function () {
console.log("peacekim:: レコードを終了しました");
console.info("Did record stop");
});
}
}
......@@ -107,13 +106,11 @@ function mainManRecordWithCollaboration(action, url, callback) {
try {
mediaRecorder.stop();
} catch (exeption) {
console.log("peacekim:: Record fail");
console.error("Record failed");
callback();
}
console.log("peacekim:: Recorded Blobs: ", recordedBlobs);
setTimeout(function () {
console.log("peacekim:: Recoding File upload..");
const blob = new Blob(recordedBlobs, { type: "video/webm" });
const uploadFileName = "record_" + g_webroom + "_" + g_shareCount + ".webm";
g_shareCount++;
......
......@@ -209,7 +209,6 @@ CoviewBridge.bindMessageEvent = function () {
case "HostRequest":
// to be called by
// wc_api.dispatchEvent (new Event ("message"), {"HostRequest":"userID"});
console.log("peacekim:: t2 consoleLog", json);
break;
case "fileChange":
if (globalUserInfo.collaborationType != COLLABORATION_TYPE.CAMERA) {
......@@ -227,7 +226,7 @@ CoviewBridge.bindMessageEvent = function () {
}
break;
default:
console.log("peacekim:: Unrecognized api", json);
console.debug("Unrecognized api", json);
break;
}
});
......@@ -348,7 +347,6 @@ function captureAndShareImage(urls, changeHostName) {
$(snapshots[cpatureViewIndex]).attr("height")
);
$(canvasRemote).attr("width", $(snapshots[cpatureViewIndex]).attr("width"));
console.log("peacekim:: t5 url", URL.createObjectURL(blob));
if (
$(".canvas_wrap").css("width").replace("px", "") /
$(".canvas_wrap").css("height").replace("px", "") <
......@@ -412,7 +410,7 @@ function captureAndShareImage(urls, changeHostName) {
}, 1500);
},
error: function (err) {
console.log(err);
console.error(err);
},
});
});
......
......@@ -45,13 +45,13 @@ Contact.searchUser = function (keyword) {
/** UTILS */
Contact.bindiOSKeyBoardEvent = function () {
if (deviceInfo.isiOS()) {
const searchInput = $('#contact .search_form input[type="search"]');
searchInput.on("compositionend", function () {
if (deviceInfo.isiOS()) {
var keyword = searchInput.val();
const keyword = searchInput.val();
Contact.searchUser(keyword);
}
});
}
};
Contact.bindMemeberSearch = function () {
......@@ -83,14 +83,14 @@ Contact.appendGroupList = function (groupList) {
const groupTemplate = getTemplate(TemplateURL.GROUP_LIST);
groupList.forEach(function (group) {
let html = renderGroupList(
const html = renderGroupList(
groupTemplate,
group.groupName,
group.groupId,
group.isFavorite
);
let obj = jQuery.parseHTML(html);
const obj = jQuery.parseHTML(html);
$(".overlay_src_msg").append(obj);
});
};
......@@ -107,9 +107,9 @@ Contact.appendUserList = function (userList) {
userList.forEach(function (user) {
user.profileUrl = Common.getProfileImgUrl(user.profileUrl);
});
var userTemplate = getTemplate(TemplateURL.USER_LIST);
let html = Contact.renderUserList(userTemplate, userList);
let obj = jQuery.parseHTML(html);
const userTemplate = getTemplate(TemplateURL.USER_LIST);
const html = Contact.renderUserList(userTemplate, userList);
const obj = jQuery.parseHTML(html);
$(".overlay_src_msg").append(obj);
};
......@@ -179,13 +179,13 @@ Contact.appendFavoritGroupList = function () {
//お気に入りグループ取得。
const favoriteGroupList = NativeBridgeDataSource.getFavoriteGroups();
favoriteGroupList.forEach(function (favoriteGroup) {
let html = Mustache.render(groupTemplate, {
const html = Mustache.render(groupTemplate, {
name: favoriteGroup.groupName,
id: favoriteGroup.groupId,
isFavorite: true,
});
let obj = $(jQuery.parseHTML(html)).on("click", function () {});
const obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#favoriteList").append(obj);
});
};
......@@ -197,10 +197,10 @@ Contact.appendFavoritUsers = function () {
favoriteUser.profileUrl = Common.getProfileImgUrl(favoriteUser.profileUrl);
favoriteUser.isFavorite = true;
});
let html = Mustache.render(userTemplate, {
const html = Mustache.render(userTemplate, {
userList: favoriteUserList,
});
let obj = jQuery.parseHTML(html);
const obj = jQuery.parseHTML(html);
$("#favoriteList").append(obj);
};
......@@ -254,20 +254,12 @@ Contact.insertFavoriteGroup = function (groupID) {
Common.dismissLoadingIndicator();
};
// contact.html
// contact.js
// template_group_list.html (GROUP_LIST)
// >> contact.js
// template_group_path.html (GROUP_PATH)
// >> self
// template_user_name_card.html(USER_NAME_CARD)
// >> Namecard.makeNameCard
//全グループ検索画面表示。
Contact.refreshAllGroupSearch = function (paramGroupId) {
var groupId = paramGroupId;
Contact.refreshAllGroupSearch = function (paramGroupID) {
const groupID = paramGroupID;
if (window.location.pathname.includes("chat_room")) {
if (groupId == "") return;
NativeBridgeDelegate.setToMoveGroupId(groupId);
if (groupID == "") return;
NativeBridgeDelegate.setToMoveGroupId(groupID);
window.location.href = "contact.html";
}
......@@ -276,16 +268,16 @@ Contact.refreshAllGroupSearch = function (paramGroupId) {
Contact.initialzeForAllGroupSearch();
//オンライン状態であればサーバから情報更新。
NativeBridgeDelegate.updateGroupInfo(groupId);
NativeBridgeDelegate.updateGroupInfo(groupID);
//DBからグループ情報を取得。
const result = NativeBridgeDataSource.getGroupInfo(groupId);
const result = NativeBridgeDataSource.getGroupInfo(groupID);
Contact.bindGroupCellClick(
result.parentGroupId,
result.rootGroupId,
paramGroupId,
groupId
paramGroupID,
groupID
);
Contact.appendGroupPathList(result.groupPathList);
......@@ -367,13 +359,13 @@ Contact.appendSubGroupsInGroup = function (groupList) {
//該当グループの下位グループ表示。
const groupTemplate = getTemplate(TemplateURL.GROUP_LIST);
groupList.forEach(function (childGroup) {
let html = Mustache.render(groupTemplate, {
const html = Mustache.render(groupTemplate, {
name: childGroup.groupName,
id: childGroup.groupId,
isFavorite: childGroup.isFavorite,
});
let obj = $(jQuery.parseHTML(html)).on("click", function () {});
const obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#childGroupListArea").append(obj);
});
};
......@@ -385,9 +377,9 @@ Contact.appendUsersInGroup = function (userList) {
userList.forEach(function (user) {
user.profileUrl = Common.getProfileImgUrl(user.profileUrl);
});
let html = Mustache.render(userTemplate, {
const html = Mustache.render(userTemplate, {
userList: userList,
});
let obj = jQuery.parseHTML(html);
const obj = jQuery.parseHTML(html);
$("#userInGroupList").append(obj);
};
......@@ -31,11 +31,11 @@ Namecard.makeNameCard = function (shopMemberID) {
// template_user_name_card.html
Namecard.startChat = function (userShopMemberID, userName) {
Common.showLoadingIndicator();
var userIDList = [];
let userIDList = [];
userIDList.push(userShopMemberID);
// 参加ユーザ名でルーム名を生成
let newRoomName = currentUserInfo.loginID + "," + userName;
const newRoomName = currentUserInfo.loginID + "," + userName;
NativeBridgeDelegate.createChatRoom(
ChatRoomType.DM,
userIDList.join(","),
......@@ -52,7 +52,7 @@ Namecard.startVoice = function (userShopMemberID, userName) {
userIDList.push(userShopMemberID);
// 参加ユーザ名でルーム名を生成
let newRoomName = currentUserInfo.loginID + "," + userName;
const newRoomName = currentUserInfo.loginID + "," + userName;
NativeBridgeDelegate.createChatRoom(
ChatRoomType.DM,
userIDList.join(","),
......@@ -62,10 +62,6 @@ Namecard.startVoice = function (userShopMemberID, userName) {
);
};
// template_group_user_list.html (GROUP_USER_LIST)
// >> chat-room.js
// >> contact.js
// template_user_list.html
Namecard.favoriteUserChange = function (shopMemberID, star) {
if ($(star).hasClass("active")) {
Namecard.removeFavoriteUser(shopMemberID);
......@@ -74,9 +70,6 @@ Namecard.favoriteUserChange = function (shopMemberID, star) {
}
};
// modal_collabo_profile.html
// collaboration.js
// template_user_name_card.html
Namecard.removeFavoriteUser = function (shopMemberID) {
Common.showLoadingIndicator();
$("#userNameCard").modal("hide");
......@@ -92,8 +85,6 @@ Namecard.removeFavoriteUser = function (shopMemberID) {
Common.dismissLoadingIndicator();
};
// template_user_name_card.html (USER_NAME_CARD)
// >> Namecard.makeNameCard()
Namecard.insertFavoriteUser = function (shopMemberID) {
$("#userNameCard").modal("hide");
$("#myNameCard").modal("hide");
......@@ -115,4 +106,3 @@ Namecard.refreshForOnline = function () {
Namecard.refreshForOffline = function () {
$("#favoriteButton").prop("disabled", true);
};
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