diff --git a/app.js b/app.js
index 16d5c63fc..c4961b4b8 100644
--- a/app.js
+++ b/app.js
@@ -415,6 +415,12 @@ function initConference(localTracks, connection) {
// }, APP.UI.updateRecordingState);
});
+ APP.UI.addListener(UIEvents.TOPIC_CHANGED, function (topic) {
+ // FIXME handle topic change
+ // APP.xmpp.setSubject(topic);
+ // on SUBJECT_CHANGED UI.setSubject(topic);
+ });
+
room.on(ConferenceEvents.DTMF_SUPPORT_CHANGED, function (isDTMFSupported) {
APP.UI.updateDTMFSupport(isDTMFSupported);
});
diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index 990e93370..96e3b96b7 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -2,11 +2,11 @@
/* jshint -W101 */
var UI = {};
-var VideoLayout = require("./videolayout/VideoLayout.js");
-var AudioLevels = require("./audio_levels/AudioLevels.js");
-var Prezi = require("./prezi/Prezi.js");
-var Etherpad = require("./etherpad/Etherpad.js");
-var Chat = require("./side_pannels/chat/Chat.js");
+var VideoLayout = require("./videolayout/VideoLayout");
+var AudioLevels = require("./audio_levels/AudioLevels");
+var Prezi = require("./prezi/Prezi");
+var Etherpad = require("./etherpad/Etherpad");
+var Chat = require("./side_pannels/chat/Chat");
var Toolbar = require("./toolbars/Toolbar");
var ToolbarToggler = require("./toolbars/ToolbarToggler");
var BottomToolbar = require("./toolbars/BottomToolbar");
@@ -219,7 +219,7 @@ function registerListeners() {
function bindEvents() {
function onResize() {
- Chat.resizeChat();
+ PanelToggler.resizeChat();
VideoLayout.resizeLargeVideoContainer();
}
@@ -344,9 +344,9 @@ function chatAddError(errorMessage, originalText) {
return Chat.chatAddError(errorMessage, originalText);
}
-function chatSetSubject(text) {
- return Chat.chatSetSubject(text);
-}
+UI.setSubject = function (subject) {
+ Chat.setSubject(subject);
+};
function initEtherpad(name) {
Etherpad.init(name);
diff --git a/modules/UI/side_pannels/SidePanelToggler.js b/modules/UI/side_pannels/SidePanelToggler.js
index ec81cce58..07a39e561 100644
--- a/modules/UI/side_pannels/SidePanelToggler.js
+++ b/modules/UI/side_pannels/SidePanelToggler.js
@@ -1,102 +1,101 @@
/* global require, $ */
-var Chat = require("./chat/Chat");
-var ContactList = require("./contactlist/ContactList");
-var Settings = require("./../../settings/Settings");
-var SettingsMenu = require("./settings/SettingsMenu");
-var VideoLayout = require("../videolayout/VideoLayout");
-var ToolbarToggler = require("../toolbars/ToolbarToggler");
-var UIUtil = require("../util/UIUtil");
-var LargeVideo = require("../videolayout/LargeVideo");
+import Chat from "./chat/Chat";
+import ContactList from "./contactlist/ContactList";
+import Settings from "./../../settings/Settings";
+import SettingsMenu from "./settings/SettingsMenu";
+import VideoLayout from "../videolayout/VideoLayout";
+import ToolbarToggler from "../toolbars/ToolbarToggler";
+import UIUtil from "../util/UIUtil";
+import LargeVideo from "../videolayout/LargeVideo";
+
+const buttons = {
+ '#chatspace': '#chatBottomButton',
+ '#contactlist': '#contactListButton',
+ '#settingsmenu': '#toolbar_button_settings'
+};
+
+var currentlyOpen = null;
+
+/**
+ * Toggles the windows in the side panel
+ * @param object the window that should be shown
+ * @param selector the selector for the element containing the panel
+ * @param onOpenComplete function to be called when the panel is opened
+ * @param onOpen function to be called if the window is going to be opened
+ * @param onClose function to be called if the window is going to be closed
+ */
+function toggle (object, selector, onOpenComplete, onOpen, onClose) {
+ UIUtil.buttonClick(buttons[selector], "active");
+
+ if (object.isVisible()) {
+ $("#toast-container").animate({
+ right: 5
+ }, {
+ queue: false,
+ duration: 500
+ });
+ $(selector).hide("slide", {
+ direction: "right",
+ queue: false,
+ duration: 500
+ });
+ if(typeof onClose === "function") {
+ onClose();
+ }
+
+ currentlyOpen = null;
+ } else {
+ // Undock the toolbar when the chat is shown and if we're in a
+ // video mode.
+ if (LargeVideo.isLargeVideoVisible()) {
+ ToolbarToggler.dockToolbar(false);
+ }
+
+ if (currentlyOpen) {
+ var current = $(currentlyOpen);
+ UIUtil.buttonClick(buttons[currentlyOpen], "active");
+ current.css('z-index', 4);
+ setTimeout(function () {
+ current.css('display', 'none');
+ current.css('z-index', 5);
+ }, 500);
+ }
+
+ $("#toast-container").animate({
+ right: (PanelToggler.getPanelSize()[0] + 5)
+ }, {
+ queue: false,
+ duration: 500
+ });
+ $(selector).show("slide", {
+ direction: "right",
+ queue: false,
+ duration: 500,
+ complete: onOpenComplete
+ });
+ if(typeof onOpen === "function") {
+ onOpen();
+ }
+
+ currentlyOpen = selector;
+ }
+}
/**
* Toggler for the chat, contact list, settings menu, etc..
*/
-var PanelToggler = (function(my) {
-
- var currentlyOpen = null;
- var buttons = {
- '#chatspace': '#chatBottomButton',
- '#contactlist': '#contactListButton',
- '#settingsmenu': '#toolbar_button_settings'
- };
-
- /**
- * Toggles the windows in the side panel
- * @param object the window that should be shown
- * @param selector the selector for the element containing the panel
- * @param onOpenComplete function to be called when the panel is opened
- * @param onOpen function to be called if the window is going to be opened
- * @param onClose function to be called if the window is going to be closed
- */
- var toggle = function(object, selector, onOpenComplete, onOpen, onClose) {
- UIUtil.buttonClick(buttons[selector], "active");
-
- if (object.isVisible()) {
- $("#toast-container").animate({
- right: '5px'
- },
- {
- queue: false,
- duration: 500
- });
- $(selector).hide("slide", {
- direction: "right",
- queue: false,
- duration: 500
- });
- if(typeof onClose === "function") {
- onClose();
- }
-
- currentlyOpen = null;
- }
- else {
- // Undock the toolbar when the chat is shown and if we're in a
- // video mode.
- if (LargeVideo.isLargeVideoVisible()) {
- ToolbarToggler.dockToolbar(false);
- }
-
- if(currentlyOpen) {
- var current = $(currentlyOpen);
- UIUtil.buttonClick(buttons[currentlyOpen], "active");
- current.css('z-index', 4);
- setTimeout(function () {
- current.css('display', 'none');
- current.css('z-index', 5);
- }, 500);
- }
-
- $("#toast-container").animate({
- right: (PanelToggler.getPanelSize()[0] + 5) + 'px'
- },
- {
- queue: false,
- duration: 500
- });
- $(selector).show("slide", {
- direction: "right",
- queue: false,
- duration: 500,
- complete: onOpenComplete
- });
- if(typeof onOpen === "function") {
- onOpen();
- }
-
- currentlyOpen = selector;
- }
- };
+var PanelToggler = {
/**
* Opens / closes the chat area.
*/
- my.toggleChat = function() {
- var chatCompleteFunction = Chat.isVisible() ?
- function() {} : function () {
- Chat.scrollChatToBottom();
- $('#chatspace').trigger('shown');
- };
+ toggleChat () {
+ var chatCompleteFunction = Chat.isVisible()
+ ? function () {}
+ : function () {
+ Chat.scrollChatToBottom();
+ $('#chatspace').trigger('shown');
+ };
VideoLayout.resizeVideoArea(!Chat.isVisible(), chatCompleteFunction);
@@ -112,16 +111,24 @@ var PanelToggler = (function(my) {
}
},
null,
- Chat.resizeChat,
+ () => this.resizeChat(),
null);
- };
+ },
+
+ resizeChat () {
+ let [width, height] = this.getPanelSize();
+ Chat.resizeChat(width, height);
+ },
/**
* Opens / closes the contact list area.
*/
- my.toggleContactList = function () {
- var completeFunction = ContactList.isVisible() ?
- function() {} : function () { $('#contactlist').trigger('shown');};
+ toggleContactList () {
+ var completeFunction = ContactList.isVisible()
+ ? function () {}
+ : function () {
+ $('#contactlist').trigger('shown');
+ };
VideoLayout.resizeVideoArea(!ContactList.isVisible(), completeFunction);
toggle(ContactList,
@@ -131,12 +138,12 @@ var PanelToggler = (function(my) {
ContactList.setVisualNotification(false);
},
null);
- };
+ },
/**
* Opens / closes the settings menu
*/
- my.toggleSettingsMenu = function() {
+ toggleSettingsMenu () {
VideoLayout.resizeVideoArea(!SettingsMenu.isVisible(), function (){});
toggle(SettingsMenu,
'#settingsmenu',
@@ -147,12 +154,12 @@ var PanelToggler = (function(my) {
$('#setEmail').get(0).value = settings.email;
},
null);
- };
+ },
/**
* Returns the size of the side panel.
*/
- my.getPanelSize = function () {
+ getPanelSize () {
var availableHeight = window.innerHeight;
var availableWidth = window.innerWidth;
@@ -162,16 +169,13 @@ var PanelToggler = (function(my) {
}
return [panelWidth, availableHeight];
- };
+ },
- my.isVisible = function() {
+ isVisible () {
return (Chat.isVisible() ||
ContactList.isVisible() ||
SettingsMenu.isVisible());
- };
+ }
+};
- return my;
-
-}(PanelToggler || {}));
-
-module.exports = PanelToggler;
\ No newline at end of file
+export default PanelToggler;
diff --git a/modules/UI/side_pannels/chat/Chat.js b/modules/UI/side_pannels/chat/Chat.js
index f5a82cc51..0bcbb09a9 100644
--- a/modules/UI/side_pannels/chat/Chat.js
+++ b/modules/UI/side_pannels/chat/Chat.js
@@ -1,10 +1,13 @@
/* global APP, $ */
-var Replacement = require("./Replacement");
-var CommandsProcessor = require("./Commands");
-var ToolbarToggler = require("../../toolbars/ToolbarToggler");
+
+import {processReplacements, linkify} from './Replacement';
+import CommandsProcessor from './Commands';
+import ToolbarToggler from '../../toolbars/ToolbarToggler';
+
+import UIUtil from '../../util/UIUtil';
+import UIEvents from '../../../../service/UI/UIEvents';
+
var smileys = require("./smileys.json").smileys;
-var UIUtil = require("../../util/UIUtil");
-var UIEvents = require("../../../../service/UI/UIEvents");
var notificationInterval = false;
var unreadMessages = 0;
@@ -164,11 +167,11 @@ function resizeChatConversation() {
/**
* Chat related user interface.
*/
-var Chat = (function (my) {
+var Chat = {
/**
* Initializes chat related interface.
*/
- my.init = function (eventEmitter) {
+ init (eventEmitter) {
if (APP.settings.getDisplayName()) {
Chat.setChatConversationMode(true);
}
@@ -192,11 +195,10 @@ var Chat = (function (my) {
var value = this.value;
usermsg.val('').trigger('autosize.resize');
this.focus();
- var command = new CommandsProcessor(value);
- if(command.isCommand()) {
+ var command = new CommandsProcessor(value, eventEmitter);
+ if (command.isCommand()) {
command.processCommand();
- }
- else {
+ } else {
var message = UIUtil.escapeHtml(value);
eventEmitter.emit(UIEvents.MESSAGE_CREATED, message);
}
@@ -216,19 +218,17 @@ var Chat = (function (my) {
});
addSmileys();
- };
+ },
/**
* Appends the given message to the chat conversation.
*/
- my.updateChatConversation =
- function (from, displayName, message, stamp) {
+ updateChatConversation (id, displayName, message, stamp) {
var divClassName = '';
- if (APP.xmpp.myJid() === from) {
+ if (APP.conference.isLocalId(id)) {
divClassName = "localuser";
- }
- else {
+ } else {
divClassName = "remoteuser";
if (!Chat.isVisible()) {
@@ -244,7 +244,7 @@ var Chat = (function (my) {
var escMessage = message.replace(//g, '>').replace(/\n/g, '
');
var escDisplayName = UIUtil.escapeHtml(displayName);
- message = Replacement.processReplacements(escMessage);
+ message = processReplacements(escMessage);
var messageContainer =
'