ComunicWeb/assets/js/pages/conversations/main.js

60 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-05-13 12:06:32 +00:00
/**
* Conversation page main script file
*
* @author Pierre HUBERT
*/
ComunicWeb.pages.conversations.main = {
2018-05-13 12:06:32 +00:00
/**
* Open settings page
*
* @param {object} args Optionnal arguments
* @param {HTMLElement} target The target for the page
*/
open: function(args, target){
2020-04-09 09:36:32 +00:00
//Create a container
const container = createElem2({
2018-05-13 12:06:32 +00:00
appendTo: target,
type: "div",
2020-04-09 09:36:32 +00:00
class: "conversations-page-container"
2018-05-13 12:06:32 +00:00
});
//Check if a conversation has to be opened
if(args.subfolder){
2020-04-13 09:18:04 +00:00
// Add a target for video calls
createElem2({
appendTo: container,
type: "div",
id: "target-for-video-call-"+this.getCurrentConversationID()
})
2020-04-09 09:36:32 +00:00
ComunicWeb.pages.conversations.conversation.open(this.getCurrentConversationID(), container);
}
2018-05-16 04:47:41 +00:00
2020-04-09 09:36:32 +00:00
// Otherwise display the list of conversations
else {
2021-03-05 14:41:31 +00:00
ConversationsPageListPane.display(container);
2020-04-09 09:36:32 +00:00
}
},
/**
* Determine the current conversation ID
*
* @return {Number} The ID of the current conversation (0 if none found)
*/
getCurrentConversationID: function(){
var id = location.toString().split("/conversations/");
id = id[id.length - 1];
//Check if no ID is specified
if(id.length < 1)
return 0;
else
return Number(id);
2018-05-13 12:06:32 +00:00
}
}