- If using monkeyChat it is not necessary to use monkeyUI. Paste the following code into the section of your site's HTML:
<script type="text/javascript" src="https://cdn.criptext.com/v1.1.0/monkeyChat.js"></script>
To start setup chat.
var monkeyChatView = {
screen: {
type: 'classic',
data: {
width: '380px',
height: '500px'
},
}
};
var form = '<div id="my-login">'+
'<input type="text" id="user_name">'+
'<input type="button" value="Login" id="submit_login">'+
'</div>';
monkeyChat.init(appID, appKey, conversationID, monkeyChatView, form);
Paste the following code into the section of your site's HTML:
<script type="text/javascript" src="https://cdn.criptext.com/v1.1.0/monkeyUI.js"></script>
Setup view to draw
var view = {
screen: {
type: 'classic',
data: {
width: '380px',
height: '500px'
},
}
};
monkeyUI.setChat(view);
To confirm that your chat needs to add your own form session.
monkeyUI.form = true;
Call to draw screen chat.
monkeyUI.drawScene();
To add your own form session.
var form = '<div id="my-login">'+
'<input type="text" id="user_name">'+
'<input type="button" value="Login" id="submit_login">'+
'</div>';
monkeyUI.addLoginForm(form);
Quick start chat without form, when opening the tab.
$(monkeyUI).on('quickStart', function(event, file){
});
Call the loading effect to appear on screen.
monkeyUI.startLoading();
Call the loading effect to disappear from the screen.
monkeyUI.stopLoading();
To load data about user login.
var myUser = new MUIUser(userId, monkeyId, userName, 0, userUrlAvatar);
monkeyUI.loadDataScreen(myUser);
To draw conversation: conversationItem and conversationWindow
monkeyUI.drawConversation(conversation, value);
To update any data about conversation
monkeyUI.updateDrawConversation(conversation);
To draw text message bubble.
monkeyUI.drawTextMessageBubble(message, conversationId, isGroupChat, status);
To draw audio message bubble.
monkeyUI.drawAudioMessageBubble(message, conversationId, isGroupChat, status);
To draw image message bubble.
monkeyUI.drawImageMessageBubble(message, conversationId, isGroupChat, status);
To draw file message bubble.
monkeyUI.drawFileMessageBubble(message, conversationId, isGroupChat, status);
To update the src data of media message.
monkeyUI.updateDataMessageBubble(messageId, dataBase64);
Receive the text message that input generates.
$(monkeyUI).on('textMessage', function(event, text){
});
Receive the image message that input generates.
$(monkeyUI).on('imageMessage', function(event, file){
});
Receive the audio message that input generates.
$(monkeyUI).on('audioMessage', function(event, audio, messageOldId){
});
Receive the file message that input generates.
$(monkeyUI).on('fileMessage', function(event, file){
});
To show chat input.
monkeyUI.showChatInput();
To update online status conversation.
monkeyUI.updateOnlineStatus(lastOpenApp, state);
To update typing status conversation.
monkeyUI.updateTypingState(conversationId, state);
To update read status of outgoing message, when the recipient opens the sender conversation.
monkeyUI.updateStatusReadMessageBubble(conversationId);
To update read/send status of outgoing message.
monkeyUI.updateStatusMessageBubble(messageOldId, messageNewId, status);
To close preview viewer
monkeyUI.exitViewer();
The following options are supported in view: type: 'classic' | 'fullscreen' If use 'classic' add the data: data: {width: '380px',height: '500px'}