Commit 9f6b13cc by Kim Peace

Fixed share.js as javascript indent

parent 0af9fdc9
...@@ -4,297 +4,316 @@ ...@@ -4,297 +4,316 @@
let coview_api = new CoviewApi(); let coview_api = new CoviewApi();
var isDocument = false; var isDocument = false;
let isLeaved = false; let isLeaved = false;
$(function() {
var coviewApiActive = coview_api.Init(
{
testSTRParam : "param1",
testNUMParam : 77,
testBOOLParam : false,
coview_api_srv_addr: "https://livetaskyell.abookcloud.com",
coview_wrap_id : "coviewShare",
coview_api_key: "8dda7092c5820d663"
}
);
// special button IN Chat ui
$("#coviewShareMainBtn").on("click", function(e) {
e.stopPropagation();
if ($(".coview_share_dropdown_bar").is(':visible') == true) {
Coview_shareDropdownHide();
if ($(".coview_share_photo_select_bubble").is(':visible') == true) {
$(".coview_share_photo_select_bubble").slideUp();
}
} else {
$(".coview_share_dropdown_bar").slideDown();
}
});
$("#coviewShareCloseButton").on("click", function(e) {
coview_api.LeaveRoom();
$(".coview_share_area").hide();
});
$("body").on("click", function(){
Coview_shareDropdownHide();
if ($(".coview_share_photo_select_bubble").is(':visible') == true) {
$(".coview_share_photo_select_bubble").slideUp();
} else {
$(".coview_share_dropdown_bar").slideDown();
}
});
$(document).on("click", ".coview_share_request", function() {
console.log("globalUserInfo", globalUserInfo);
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;
$(".coview_share_title_name").text("ライブラリ");
} else if ($(this).hasClass(collaborationTypeKey.AUDIO) == true) {
globalUserInfo.coWorkType = collaborationTypeKey.AUDIO;
$(".coview_share_title_name").text("音声通話");
}
coview_api.JoinRoom(globalUserInfo.roomId, globalUserInfo.coWorkType); $(function () {
Coview_moveToVideoShareArea(); var coviewApiActive = coview_api.Init({
}); testSTRParam: "param1",
testNUMParam: 77,
testBOOLParam: false,
coview_api_srv_addr: "https://livetaskyell.abookcloud.com",
coview_wrap_id: "coviewShare",
coview_api_key: "8dda7092c5820d663",
});
// special button IN Chat ui
$("#coviewShareMainBtn").on("click", function (e) {
e.stopPropagation();
if ($(".coview_share_dropdown_bar").is(":visible") == true) {
Coview_shareDropdownHide();
if ($(".coview_share_photo_select_bubble").is(":visible") == true) {
$(".coview_share_photo_select_bubble").slideUp();
}
} else {
$(".coview_share_dropdown_bar").slideDown();
}
});
$("#coviewShareCloseButton").on("click", function (e) {
coview_api.LeaveRoom();
$(".coview_share_area").hide();
});
/* --------------------------------------------------- */ $("body").on("click", function () {
/* Video, photo, chat, doc */ Coview_shareDropdownHide();
/* --------------------------------------------------- */
$("#coviewShareChat").on("click", function() {
console.log("ON click coviewShareChat");
});
$("#coviewSharePhoto").on("click", function(e) { if ($(".coview_share_photo_select_bubble").is(":visible") == true) {
e.stopPropagation(); $(".coview_share_photo_select_bubble").slideUp();
console.log("ON click coviewSharePhoto"); } else {
$(".coview_share_dropdown_bar").slideDown();
}
});
$(document).on("click", ".coview_share_request", function () {
console.log("globalUserInfo", globalUserInfo);
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;
$(".coview_share_title_name").text("ライブラリ");
} else if ($(this).hasClass(collaborationTypeKey.AUDIO) == true) {
globalUserInfo.coWorkType = collaborationTypeKey.AUDIO;
$(".coview_share_title_name").text("音声通話");
}
if ($(".coview_share_photo_select_bubble").is(':visible') == true) { coview_api.JoinRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
$(".coview_share_photo_select_bubble").slideUp(); Coview_moveToVideoShareArea();
} else { });
$(".coview_share_photo_select_bubble").slideDown();
}
});
/* --------------------------------------------------- */
/* Video, photo, chat, doc */
/* --------------------------------------------------- */
$("#coviewShareChat").on("click", function () {
console.log("ON click coviewShareChat");
});
$("#coviewSharePhoto").on("click", function (e) {
e.stopPropagation();
console.log("ON click coviewSharePhoto");
if ($(".coview_share_photo_select_bubble").is(":visible") == true) {
$(".coview_share_photo_select_bubble").slideUp();
} else {
$(".coview_share_photo_select_bubble").slideDown();
}
});
$("#coviewSharePhotoCamera").on("click", function() { $("#coviewSharePhotoCamera").on("click", function () {
$(".coview_share_photo_select_bubble").hide(); $(".coview_share_photo_select_bubble").hide();
globalUserInfo.coWorkType = collaborationTypeKey.CAMERA; globalUserInfo.coWorkType = collaborationTypeKey.CAMERA;
coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType); coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
Coview_moveToVideoShareArea(); Coview_moveToVideoShareArea();
$(".coview_share_title_name").text("カメラ"); $(".coview_share_title_name").text("カメラ");
}); });
$("#coviewSharePhotoGallery").on("click", function() { $("#coviewSharePhotoGallery").on("click", function () {
$(".coview_share_photo_select_bubble").hide(); $(".coview_share_photo_select_bubble").hide();
globalUserInfo.coWorkType = "gallery"; globalUserInfo.coWorkType = "gallery";
coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType); coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
Coview_moveToVideoShareArea(); Coview_moveToVideoShareArea();
$(".coview_share_title_name").text("ライブラリ"); $(".coview_share_title_name").text("ライブラリ");
}); });
$("#coviewShareAudio").on("click", function() { $("#coviewShareAudio").on("click", function () {
Coview_connect_audio_collaboration(); Coview_connect_audio_collaboration();
}) });
$("#coviewShareLive").on("click", function () {
console.log("ON click coviewShareLive");
globalUserInfo.coWorkType = "video";
console.log("globalUserInfo", globalUserInfo);
$("#coviewShareLive").on("click", function() { coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
console.log("ON click coviewShareLive"); Coview_moveToVideoShareArea();
globalUserInfo.coWorkType = "video";
console.log("globalUserInfo", globalUserInfo);
coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType); $(".coview_share_title_name").text("LIVE");
});
// $("#coviewShareDoc").on("click", function(){
// console.log("ON click coviewShareDoc");
// alert("INTO a document share mode (only audio)");
// globalUserInfo.coWorkType = "audio";
// });
coview_api.addEventListener("ready", function () {
console.log("=============> READY : ready for coview api");
Coview_addLoginId(globalUserInfo.loginId);
coview_api.Login(globalUserInfo.loginId);
});
coview_api.addEventListener("start", function () {
console.log("=============> START : share start");
$("#loadingIndicator").removeClass("full_active");
});
coview_api.addEventListener("allbye", function () {
console.log("=============> ALL BYE : share allbye");
$("#loadingIndicator").removeClass("full_active");
});
coview_api.addEventListener("guestbye", function () {
console.log("=============> GUEST BYE : share guestbye");
$("#loadingIndicator").removeClass("full_active");
});
coview_api.addEventListener("hostbye", function () {
console.log("=============> HOST BYE : share hostbye");
alert(getLocalizedString("inform_exit_host_collaboration"));
Coview_exitCollaboration();
$("#loadingIndicator").removeClass("full_active");
});
coview_api.addEventListener("destroy", function () {
console.log("=============> DESTROY : share destroy");
coview_api.LeaveRoom();
$(".coview_share_area").hide();
$("#loadingIndicator").removeClass("full_active");
});
var meetingId;
coview_api.addEventListener("message", async function (event, json) {
console.log("+++ addEventListener", json);
console.log("processMessage api = ", json.api);
if (isLeaved) return;
let loginIdList = new Array();
switch (json.api) {
case "LoginResponse":
console.log("------------------------------");
console.log(globalUserInfo.coWorkType);
console.log(collaborationJoinFlg);
if (globalUserInfo.coWorkType == collaborationTypeKey.DOCUMENT) {
isDocument = true;
globalUserInfo.coWorkType = collaborationTypeKey.AUDIO;
}
if (collaborationJoinFlg == "1") {
coview_api.JoinRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
if (isDocument) {
if (CHAT_UTIL.isIOS()) {
//TODO 画面を縮小し、会議室に入場する処理
} else if (CHAT_UTIL.isAndroid()) {
android.startContentView(meetingId);
}
}
} else if (collaborationJoinFlg == "0") {
coview_api.CreateRoom(
globalUserInfo.roomId,
globalUserInfo.coWorkType
);
if (isDocument) {
if (CHAT_UTIL.isIOS()) {
//TODO 画面を縮小し、会議室に入場する処理
} else if (CHAT_UTIL.isAndroid()) {
meetingId = android.createContentView();
}
}
} else if (collaborationJoinFlg == "2") {
coview_api.JoinRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
}
Coview_moveToVideoShareArea(); Coview_moveToVideoShareArea();
break;
$(".coview_share_title_name").text("LIVE"); case "CreateRoomResponse":
}); if (json.resultCode == 200) {
var coviewInviteMessage;
// $("#coviewShareDoc").on("click", function(){ if (isDocument) {
// console.log("ON click coviewShareDoc"); coviewInviteMessage =
// alert("INTO a document share mode (only audio)"); "" +
// globalUserInfo.coWorkType = "audio"; messageSeperator +
// }); messageType.COMMUNICATIONSTART +
messageSeperator +
coview_api.addEventListener ("ready", function () { CHAT_UTIL.getCollaborationType(collaborationTypeKey.DOCUMENT) +
console.log("=============> READY : ready for coview api"); messageSeperator +
Coview_addLoginId(globalUserInfo.loginId); meetingId;
coview_api.Login(globalUserInfo.loginId); } else {
}); coviewInviteMessage =
"" +
coview_api.addEventListener ("start", function () { messageSeperator +
console.log("=============> START : share start"); messageType.COMMUNICATIONSTART +
$("#loadingIndicator").removeClass("full_active"); messageSeperator +
}); CHAT_UTIL.getCollaborationType(globalUserInfo.coWorkType);
}
coview_api.addEventListener ("allbye", function () { socket.emit(
console.log("=============> ALL BYE : share allbye"); "createMessage",
$("#loadingIndicator").removeClass("full_active"); {
}); text: coviewInviteMessage,
},
coview_api.addEventListener ("guestbye", function () { 0
console.log("=============> GUEST BYE : share guestbye"); );
$("#loadingIndicator").removeClass("full_active"); } else {
}); }
break;
coview_api.addEventListener ("hostbye", function () { case "JoinRoomInfoResponse":
console.log("=============> HOST BYE : share hostbye"); if (json.resultCode == 200) {
alert(getLocalizedString("inform_exit_host_collaboration")); } else {
Coview_exitCollaboration(); alert(
$("#loadingIndicator").removeClass("full_active"); "Not exist sharing call (" +
}); json.resultCode +
")\nPlease using share menu."
coview_api.addEventListener ("destroy", function () { );
console.log("=============> DESTROY : share destroy"); coview_api.LeaveRoom();
coview_api.LeaveRoom(); $(".coview_share_area").hide();
$(".coview_share_area").hide(); $("#loadingIndicator").removeClass("full_active");
$("#loadingIndicator").removeClass("full_active"); }
}); break;
var meetingId; case "JoinRoomResponse":
coview_api.addEventListener ("message", async function (event, json) { if (json.resultCode == 200) {
console.log("+++ addEventListener", json); for (let key in g_participants) {
console.log("processMessage api = ", json.api); loginIdList.push(key);
if (isLeaved) return; }
let loginIdList = new Array(); CHAT_UI.refreshJoinedCollaboration(loginIdList);
switch (json.api){ } else {
case "LoginResponse": }
console.log('------------------------------'); break;
console.log(globalUserInfo.coWorkType); case "RoomMemberJoinedEvent":
console.log(collaborationJoinFlg); for (let key in g_participants) {
if (globalUserInfo.coWorkType == collaborationTypeKey.DOCUMENT) { loginIdList.push(key);
isDocument = true; }
globalUserInfo.coWorkType = collaborationTypeKey.AUDIO; CHAT_UI.refreshJoinedCollaboration(loginIdList);
} break;
if (collaborationJoinFlg == '1') { case "RoomMemberLeavedEvent":
coview_api.JoinRoom(globalUserInfo.roomId, globalUserInfo.coWorkType); for (let key in g_participants) {
if (isDocument) { loginIdList.push(key);
if (CHAT_UTIL.isIOS()) { }
//TODO 画面を縮小し、会議室に入場する処理 CHAT_UI.refreshJoinedCollaboration(loginIdList);
} else if (CHAT_UTIL.isAndroid()) { break;
android.startContentView(meetingId); default:
} console.log("Unrecognized api", json);
} break;
} else if (collaborationJoinFlg == '0') { }
coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType); });
if (isDocument) {
if (CHAT_UTIL.isIOS()) {
//TODO 画面を縮小し、会議室に入場する処理
} else if (CHAT_UTIL.isAndroid()) {
meetingId = android.createContentView();
}
}
} else if (collaborationJoinFlg == '2') {
coview_api.JoinRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
}
Coview_moveToVideoShareArea();
break;
case "CreateRoomResponse":
if (json.resultCode == 200) {
var coviewInviteMessage;
if (isDocument) {
coviewInviteMessage = "" + messageSeperator + messageType.COMMUNICATIONSTART + messageSeperator + CHAT_UTIL.getCollaborationType(collaborationTypeKey.DOCUMENT) + messageSeperator + meetingId;
} else {
coviewInviteMessage = "" + messageSeperator + messageType.COMMUNICATIONSTART + messageSeperator + CHAT_UTIL.getCollaborationType(globalUserInfo.coWorkType);
}
socket.emit('createMessage', {
text: coviewInviteMessage
}, 0);
} else {
}
break;
case "JoinRoomInfoResponse":
if (json.resultCode == 200) {
} else {
alert("Not exist sharing call (" + json.resultCode + ")\nPlease using share menu.");
coview_api.LeaveRoom();
$(".coview_share_area").hide();
$("#loadingIndicator").removeClass("full_active");
}
break;
case "JoinRoomResponse":
if (json.resultCode == 200) {
for (let key in g_participants) {
loginIdList.push(key);
}
CHAT_UI.refreshJoinedCollaboration(loginIdList);
} else {
}
break;
case "RoomMemberJoinedEvent":
for (let key in g_participants) {
loginIdList.push(key);
}
CHAT_UI.refreshJoinedCollaboration(loginIdList);
break;
case "RoomMemberLeavedEvent":
for (let key in g_participants) {
loginIdList.push(key);
}
CHAT_UI.refreshJoinedCollaboration(loginIdList);
break;
default:
console.log('Unrecognized api', json);
break;
}
});
}); });
function Coview_shareDropdownHide() { function Coview_shareDropdownHide() {
$(".coview_share_dropdown_bar").slideUp(); $(".coview_share_dropdown_bar").slideUp();
$(".coview_share_photo_select_bubble").slideUp(); $(".coview_share_photo_select_bubble").slideUp();
} }
function Coview_moveToVideoShareArea() { function Coview_moveToVideoShareArea() {
$("#loadingIndicator").addClass("full_active"); $("#loadingIndicator").addClass("full_active");
$(".coview_share_area").show(); $(".coview_share_area").show();
$('#collabo_main').removeClass('none'); $("#collabo_main").removeClass("none");
} }
function Coview_exitCollaboration(isDocument = false) { function Coview_exitCollaboration(isDocument = false) {
if (isDocument) { if (isDocument) {
if (CHAT_UTIL.isIOS()) { if (CHAT_UTIL.isIOS()) {
//TODO IOS会議室退場処理 //TODO IOS会議室退場処理
} else if (CHAT_UTIL.isAndroid()) { } else if (CHAT_UTIL.isAndroid()) {
android.exitMeetingRoom(); android.exitMeetingRoom();
}
} }
coview_api.LeaveRoom(); }
isLeaved = true; coview_api.LeaveRoom();
if (collaborationJoinFlg != '2') { isLeaved = true;
CHAT_UI.joinRoom(CHAT.globalLoginParameter.roomId, CHAT.globalLoginParameter.name); if (collaborationJoinFlg != "2") {
CHAT_UI.joinRoom(
CHAT.globalLoginParameter.roomId,
CHAT.globalLoginParameter.name
);
} else {
if (typeof android != "undefined") {
android.openCommunicationHome();
} else { } else {
if (typeof(android) != "undefined") { webkit.messageHandlers.openCommunicationHome.postMessage({});
android.openCommunicationHome();
} else {
webkit.messageHandlers.openCommunicationHome.postMessage({});
}
} }
}
} }
function Coview_changeHost(userId) { function Coview_changeHost(userId) {
console.log("Change Host To " + userId); console.log("Change Host To " + userId);
changeOwnerSend(userId); changeOwnerSend(userId);
} }
function Coview_addLoginId(loginId) { function Coview_addLoginId(loginId) {
console.log("addUser loginId = " + loginId); console.log("addUser loginId = " + loginId);
coview_api.addUser(loginId); coview_api.addUser(loginId);
} }
function Coview_connect_audio_collaboration() { function Coview_connect_audio_collaboration() {
globalUserInfo.coWorkType = collaborationTypeKey.AUDIO; globalUserInfo.coWorkType = collaborationTypeKey.AUDIO;
coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType); coview_api.CreateRoom(globalUserInfo.roomId, globalUserInfo.coWorkType);
Coview_moveToVideoShareArea(); Coview_moveToVideoShareArea();
$(".coview_share_title_name").text("音声通話"); $(".coview_share_title_name").text("音声通話");
} }
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