Error: ' + 'Your message' +
@@ -2417,7 +2714,7 @@ var Chat = (function (my) {
{
if(subject)
subject = subject.trim();
- $('#subject').html(Replacement.linkify(Util.escapeHtml(subject)));
+ $('#subject').html(Replacement.linkify(UIUtil.escapeHtml(subject)));
if(subject === "")
{
$("#subject").css({display: "none"});
@@ -2480,7 +2777,9 @@ var Chat = (function (my) {
return my;
}(Chat || {}));
module.exports = Chat;
-},{"../../toolbars/ToolbarToggler":18,"../../util/NicknameHandler":21,"../SidePanelToggler":8,"./Commands":10,"./Replacement":11,"./smileys.json":12}],10:[function(require,module,exports){
+},{"../../toolbars/ToolbarToggler":19,"../../util/NicknameHandler":22,"../../util/UIUtil":23,"../SidePanelToggler":9,"./Commands":11,"./Replacement":12,"./smileys.json":13}],11:[function(require,module,exports){
+var UIUtil = require("../../util/UIUtil");
+
/**
* List with supported commands. The keys are the names of the commands and
* the value is the function that processes the message.
@@ -2514,7 +2813,7 @@ function getCommand(message)
*/
function processTopic(commandArguments)
{
- var topic = Util.escapeHtml(commandArguments);
+ var topic = UIUtil.escapeHtml(commandArguments);
xmpp.setSubject(topic);
}
@@ -2576,7 +2875,7 @@ CommandsProcessor.prototype.processCommand = function()
};
module.exports = CommandsProcessor;
-},{}],11:[function(require,module,exports){
+},{"../../util/UIUtil":23}],12:[function(require,module,exports){
var Smileys = require("./smileys.json");
/**
* Processes links and smileys in "body"
@@ -2640,7 +2939,7 @@ module.exports = {
linkify: linkify
};
-},{"./smileys.json":12}],12:[function(require,module,exports){
+},{"./smileys.json":13}],13:[function(require,module,exports){
module.exports={
"smileys": {
"smiley1": ":)",
@@ -2690,7 +2989,7 @@ module.exports={
}
}
-},{}],13:[function(require,module,exports){
+},{}],14:[function(require,module,exports){
var numberOfContacts = 0;
var notificationInterval;
@@ -2874,7 +3173,7 @@ var ContactList = {
};
module.exports = ContactList;
-},{}],14:[function(require,module,exports){
+},{}],15:[function(require,module,exports){
var email = '';
var displayName = '';
var userId;
@@ -2934,16 +3233,17 @@ var Settings =
module.exports = Settings;
-},{}],15:[function(require,module,exports){
+},{}],16:[function(require,module,exports){
var Avatar = require("../../avatar/Avatar");
var Settings = require("./Settings");
+var UIUtil = require("../../util/UIUtil");
var SettingsMenu = {
update: function() {
- var newDisplayName = Util.escapeHtml($('#setDisplayName').get(0).value);
- var newEmail = Util.escapeHtml($('#setEmail').get(0).value);
+ var newDisplayName = UIUtil.escapeHtml($('#setDisplayName').get(0).value);
+ var newEmail = UIUtil.escapeHtml($('#setEmail').get(0).value);
if(newDisplayName) {
var displayName = Settings.setDisplayName(newDisplayName);
@@ -2977,7 +3277,7 @@ var SettingsMenu = {
module.exports = SettingsMenu;
-},{"../../avatar/Avatar":5,"./Settings":14}],16:[function(require,module,exports){
+},{"../../avatar/Avatar":5,"../../util/UIUtil":23,"./Settings":15}],17:[function(require,module,exports){
var PanelToggler = require("../side_pannels/SidePanelToggler");
var buttonHandlers = {
@@ -3022,7 +3322,7 @@ var BottomToolbar = (function (my) {
module.exports = BottomToolbar;
-},{"../side_pannels/SidePanelToggler":8}],17:[function(require,module,exports){
+},{"../side_pannels/SidePanelToggler":9}],18:[function(require,module,exports){
/* global $, buttonClick, config, lockRoom,
setSharedKey, Util */
var messageHandler = require("../util/MessageHandler");
@@ -3127,7 +3427,7 @@ function toggleRecording() {
var token = document.getElementById('recordingToken');
if (token.value) {
- callback(Util.escapeHtml(token.value));
+ callback(UIUtil.escapeHtml(token.value));
}
}
},
@@ -3346,7 +3646,7 @@ var Toolbar = (function (my) {
var lockKey = document.getElementById('lockKey');
if (lockKey.value) {
- Toolbar.setSharedKey(Util.escapeHtml(lockKey.value));
+ Toolbar.setSharedKey(UIUtil.escapeHtml(lockKey.value));
lockRoom(true);
}
}
@@ -3541,7 +3841,7 @@ var Toolbar = (function (my) {
}(Toolbar || {}));
module.exports = Toolbar;
-},{"../authentication/Authentication":4,"../etherpad/Etherpad":6,"../prezi/Prezi":7,"../side_pannels/SidePanelToggler":8,"../util/MessageHandler":20,"../util/UIUtil":22,"./BottomToolbar":16}],18:[function(require,module,exports){
+},{"../authentication/Authentication":4,"../etherpad/Etherpad":6,"../prezi/Prezi":7,"../side_pannels/SidePanelToggler":9,"../util/MessageHandler":21,"../util/UIUtil":23,"./BottomToolbar":17}],19:[function(require,module,exports){
/* global $, interfaceConfig, Moderator, DesktopStreaming.showDesktopSharingButton */
var toolbarTimeoutObject,
@@ -3656,7 +3956,7 @@ var ToolbarToggler = {
};
module.exports = ToolbarToggler;
-},{}],19:[function(require,module,exports){
+},{}],20:[function(require,module,exports){
var JitsiPopover = (function () {
/**
* Constructs new JitsiPopover and attaches it to the element
@@ -3780,7 +4080,7 @@ var JitsiPopover = (function () {
})();
module.exports = JitsiPopover;
-},{}],20:[function(require,module,exports){
+},{}],21:[function(require,module,exports){
/* global $, jQuery */
var messageHandler = (function(my) {
@@ -3949,7 +4249,7 @@ module.exports = messageHandler;
-},{}],21:[function(require,module,exports){
+},{}],22:[function(require,module,exports){
var nickname = null;
var eventEmitter = null;
@@ -3978,7 +4278,7 @@ var NickanameHandler = {
};
module.exports = NickanameHandler;
-},{}],22:[function(require,module,exports){
+},{}],23:[function(require,module,exports){
/**
* Created by hristo on 12/22/14.
*/
@@ -3998,11 +4298,69 @@ module.exports = {
*/
buttonClick: function(id, classname) {
$(id).toggleClass(classname); // add the class to the clicked element
+ },
+ /**
+ * Returns the text width for the given element.
+ *
+ * @param el the element
+ */
+ getTextWidth: function (el) {
+ return (el.clientWidth + 1);
+ },
+
+ /**
+ * Returns the text height for the given element.
+ *
+ * @param el the element
+ */
+ getTextHeight: function (el) {
+ return (el.clientHeight + 1);
+ },
+
+ /**
+ * Plays the sound given by id.
+ *
+ * @param id the identifier of the audio element.
+ */
+ playSoundNotification: function (id) {
+ document.getElementById(id).play();
+ },
+
+ /**
+ * Escapes the given text.
+ */
+ escapeHtml: function (unsafeText) {
+ return $('
').text(unsafeText).html();
+ },
+
+ imageToGrayScale: function (canvas) {
+ var context = canvas.getContext('2d');
+ var imgData = context.getImageData(0, 0, canvas.width, canvas.height);
+ var pixels = imgData.data;
+
+ for (var i = 0, n = pixels.length; i < n; i += 4) {
+ var grayscale
+ = pixels[i] * .3 + pixels[i+1] * .59 + pixels[i+2] * .11;
+ pixels[i ] = grayscale; // red
+ pixels[i+1] = grayscale; // green
+ pixels[i+2] = grayscale; // blue
+ // pixels[i+3] is alpha
+ }
+ // redraw the image in black & white
+ context.putImageData(imgData, 0, 0);
+ },
+
+ setTooltip: function (element, tooltipText, position) {
+ element.setAttribute("data-content", tooltipText);
+ element.setAttribute("data-toggle", "popover");
+ element.setAttribute("data-placement", position);
+ element.setAttribute("data-html", true);
+ element.setAttribute("data-container", "body");
}
};
-},{"../side_pannels/SidePanelToggler":8}],23:[function(require,module,exports){
+},{"../side_pannels/SidePanelToggler":9}],24:[function(require,module,exports){
var JitsiPopover = require("../util/JitsiPopover");
/**
@@ -4413,7 +4771,7 @@ ConnectionIndicator.prototype.hideIndicator = function () {
};
module.exports = ConnectionIndicator;
-},{"../util/JitsiPopover":19}],24:[function(require,module,exports){
+},{"../util/JitsiPopover":20}],25:[function(require,module,exports){
var AudioLevels = require("../audio_levels/AudioLevels");
var Avatar = require("../avatar/Avatar");
var Chat = require("../side_pannels/chat/Chat");
@@ -4880,7 +5238,7 @@ function getDesktopVideoSize(videoWidth,
function createEditDisplayNameButton() {
var editButton = document.createElement('a');
editButton.className = 'displayname';
- Util.setTooltip(editButton,
+ UIUtil.setTooltip(editButton,
'Click to edit your
display name',
"top");
editButton.innerHTML = '
';
@@ -4899,7 +5257,7 @@ function createModeratorIndicatorElement(parentElement) {
moderatorIndicator.className = 'fa fa-star';
parentElement.appendChild(moderatorIndicator);
- Util.setTooltip(parentElement,
+ UIUtil.setTooltip(parentElement,
"The owner of
this conference",
"top");
}
@@ -5095,7 +5453,7 @@ var VideoLayout = (function (my) {
container.id = 'mixedstream';
container.className = 'videocontainer';
remotes.appendChild(container);
- Util.playSoundNotification('userJoined');
+ UIUtil.playSoundNotification('userJoined');
}
if (container) {
@@ -5617,7 +5975,7 @@ var VideoLayout = (function (my) {
// Remove whole container
container.remove();
- Util.playSoundNotification('userLeft');
+ UIUtil.playSoundNotification('userLeft');
VideoLayout.resizeThumbnails();
}
@@ -5822,7 +6180,7 @@ var VideoLayout = (function (my) {
var mutedIndicator = document.createElement('i');
mutedIndicator.className = 'icon-camera-disabled';
- Util.setTooltip(mutedIndicator,
+ UIUtil.setTooltip(mutedIndicator,
"Participant has
stopped the camera.",
"top");
videoMutedSpan.appendChild(mutedIndicator);
@@ -5865,7 +6223,7 @@ var VideoLayout = (function (my) {
if(audioMutedSpan.length == 0 ) {
audioMutedSpan = document.createElement('span');
audioMutedSpan.className = 'audioMuted';
- Util.setTooltip(audioMutedSpan,
+ UIUtil.setTooltip(audioMutedSpan,
"Participant is muted",
"top");
@@ -6610,7 +6968,7 @@ var VideoLayout = (function (my) {
}(VideoLayout || {}));
module.exports = VideoLayout;
-},{"../audio_levels/AudioLevels":2,"../avatar/Avatar":5,"../etherpad/Etherpad":6,"../prezi/Prezi":7,"../side_pannels/chat/Chat":9,"../side_pannels/contactlist/ContactList":13,"../util/NicknameHandler":21,"../util/UIUtil":22,"./ConnectionIndicator":23}],25:[function(require,module,exports){
+},{"../audio_levels/AudioLevels":2,"../avatar/Avatar":5,"../etherpad/Etherpad":6,"../prezi/Prezi":7,"../side_pannels/chat/Chat":10,"../side_pannels/contactlist/ContactList":14,"../util/NicknameHandler":22,"../util/UIUtil":23,"./ConnectionIndicator":24}],26:[function(require,module,exports){
//var nouns = [
//];
var pluralNouns = [
@@ -6791,7 +7149,7 @@ var RoomNameGenerator = {
module.exports = RoomNameGenerator;
-},{}],26:[function(require,module,exports){
+},{}],27:[function(require,module,exports){
var animateTimeout, updateTimeout;
var RoomNameGenerator = require("./RoomnameGenerator");
@@ -6895,7 +7253,7 @@ function setupWelcomePage()
}
module.exports = setupWelcomePage;
-},{"./RoomnameGenerator":25}],27:[function(require,module,exports){
+},{"./RoomnameGenerator":26}],28:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
diff --git a/libs/modules/xmpp.bundle.js b/libs/modules/xmpp.bundle.js
index c7ca1d1e4f..8b91a49068 100644
--- a/libs/modules/xmpp.bundle.js
+++ b/libs/modules/xmpp.bundle.js
@@ -2807,8 +2807,23 @@ module.exports = TraceablePeerConnection;
*/
var connection = null;
var focusUserJid;
-var getNextTimeout = Util.createExpBackoffTimer(1000);
-var getNextErrorTimeout = Util.createExpBackoffTimer(1000);
+function createExpBackoffTimer(step) {
+ var count = 1;
+ return function (reset) {
+ // Reset call
+ if (reset) {
+ count = 1;
+ return;
+ }
+ // Calculate next timeout
+ var timeout = Math.pow(2, count - 1);
+ count += 1;
+ return timeout * step;
+ };
+}
+
+var getNextTimeout = createExpBackoffTimer(1000);
+var getNextErrorTimeout = createExpBackoffTimer(1000);
// External authentication stuff
var externalAuthEnabled = false;
// Sip gateway can be enabled by configuring Jigasi host in config.js or
diff --git a/modules/UI/prezi/Prezi.js b/modules/UI/prezi/Prezi.js
index 7ceb70c2e6..aef8df62e0 100644
--- a/modules/UI/prezi/Prezi.js
+++ b/modules/UI/prezi/Prezi.js
@@ -2,6 +2,7 @@ var ToolbarToggler = require("../toolbars/ToolbarToggler");
var UIUtil = require("../util/UIUtil");
var VideoLayout = require("../videolayout/VideoLayout");
var messageHandler = require("../util/MessageHandler");
+var PreziPlayer = require("./PreziPlayer");
var preziPlayer = null;
@@ -73,7 +74,7 @@ var Prezi = {
if (preziUrl.value)
{
var urlValue
- = encodeURI(Util.escapeHtml(preziUrl.value));
+ = encodeURI(UIUtil.escapeHtml(preziUrl.value));
if (urlValue.indexOf('http://prezi.com/') != 0
&& urlValue.indexOf('https://prezi.com/') != 0)
diff --git a/modules/UI/prezi/PreziPlayer.js b/modules/UI/prezi/PreziPlayer.js
index ba34a18c3f..e454ad7a25 100644
--- a/modules/UI/prezi/PreziPlayer.js
+++ b/modules/UI/prezi/PreziPlayer.js
@@ -289,3 +289,5 @@
})();
})();
+
+module.exports = PreziPlayer;
diff --git a/modules/UI/side_pannels/chat/Chat.js b/modules/UI/side_pannels/chat/Chat.js
index 026769330f..d768d0df64 100644
--- a/modules/UI/side_pannels/chat/Chat.js
+++ b/modules/UI/side_pannels/chat/Chat.js
@@ -4,6 +4,7 @@ var CommandsProcessor = require("./Commands");
var ToolbarToggler = require("../../toolbars/ToolbarToggler");
var smileys = require("./smileys.json").smileys;
var NicknameHandler = require("../../util/NicknameHandler");
+var UIUtil = require("../../util/UIUtil");
var notificationInterval = false;
var unreadMessages = 0;
@@ -28,10 +29,10 @@ function setVisualNotification(show) {
var chatButtonElement
= document.getElementById('chatButton').parentNode;
- var leftIndent = (Util.getTextWidth(chatButtonElement) -
- Util.getTextWidth(unreadMsgElement)) / 2;
- var topIndent = (Util.getTextHeight(chatButtonElement) -
- Util.getTextHeight(unreadMsgElement)) / 2 - 3;
+ var leftIndent = (UIUtil.getTextWidth(chatButtonElement) -
+ UIUtil.getTextWidth(unreadMsgElement)) / 2;
+ var topIndent = (UIUtil.getTextHeight(chatButtonElement) -
+ UIUtil.getTextHeight(unreadMsgElement)) / 2 - 3;
unreadMsgElement.setAttribute(
'style',
@@ -179,7 +180,7 @@ var Chat = (function (my) {
$('#nickinput').keydown(function (event) {
if (event.keyCode === 13) {
event.preventDefault();
- var val = Util.escapeHtml(this.value);
+ var val = UIUtil.escapeHtml(this.value);
this.value = '';
if (!NicknameHandler.getNickname()) {
NicknameHandler.setNickname(val);
@@ -202,7 +203,7 @@ var Chat = (function (my) {
}
else
{
- var message = Util.escapeHtml(value);
+ var message = UIUtil.escapeHtml(value);
xmpp.sendChatMessage(message, NicknameHandler.getNickname());
}
}
@@ -237,7 +238,7 @@ var Chat = (function (my) {
if (!Chat.isVisible()) {
unreadMessages++;
- Util.playSoundNotification('chatNotification');
+ UIUtil.playSoundNotification('chatNotification');
setVisualNotification(true);
}
}
@@ -247,7 +248,7 @@ var Chat = (function (my) {
// so we escape here only tags to avoid double &
var escMessage = message.replace(//g, '>').replace(/\n/g, '
');
- var escDisplayName = Util.escapeHtml(displayName);
+ var escDisplayName = UIUtil.escapeHtml(displayName);
message = Replacement.processReplacements(escMessage);
var messageContainer =
@@ -270,8 +271,8 @@ var Chat = (function (my) {
*/
my.chatAddError = function(errorMessage, originalText)
{
- errorMessage = Util.escapeHtml(errorMessage);
- originalText = Util.escapeHtml(originalText);
+ errorMessage = UIUtil.escapeHtml(errorMessage);
+ originalText = UIUtil.escapeHtml(originalText);
$('#chatconversation').append(
'
Error: ' + 'Your message' +
@@ -290,7 +291,7 @@ var Chat = (function (my) {
{
if(subject)
subject = subject.trim();
- $('#subject').html(Replacement.linkify(Util.escapeHtml(subject)));
+ $('#subject').html(Replacement.linkify(UIUtil.escapeHtml(subject)));
if(subject === "")
{
$("#subject").css({display: "none"});
diff --git a/modules/UI/side_pannels/chat/Commands.js b/modules/UI/side_pannels/chat/Commands.js
index 6883268c31..56ed95110f 100644
--- a/modules/UI/side_pannels/chat/Commands.js
+++ b/modules/UI/side_pannels/chat/Commands.js
@@ -1,3 +1,5 @@
+var UIUtil = require("../../util/UIUtil");
+
/**
* List with supported commands. The keys are the names of the commands and
* the value is the function that processes the message.
@@ -31,7 +33,7 @@ function getCommand(message)
*/
function processTopic(commandArguments)
{
- var topic = Util.escapeHtml(commandArguments);
+ var topic = UIUtil.escapeHtml(commandArguments);
xmpp.setSubject(topic);
}
diff --git a/modules/UI/side_pannels/settings/SettingsMenu.js b/modules/UI/side_pannels/settings/SettingsMenu.js
index 25fca61457..d8f163c26d 100644
--- a/modules/UI/side_pannels/settings/SettingsMenu.js
+++ b/modules/UI/side_pannels/settings/SettingsMenu.js
@@ -1,12 +1,13 @@
var Avatar = require("../../avatar/Avatar");
var Settings = require("./Settings");
+var UIUtil = require("../../util/UIUtil");
var SettingsMenu = {
update: function() {
- var newDisplayName = Util.escapeHtml($('#setDisplayName').get(0).value);
- var newEmail = Util.escapeHtml($('#setEmail').get(0).value);
+ var newDisplayName = UIUtil.escapeHtml($('#setDisplayName').get(0).value);
+ var newEmail = UIUtil.escapeHtml($('#setEmail').get(0).value);
if(newDisplayName) {
var displayName = Settings.setDisplayName(newDisplayName);
diff --git a/modules/UI/toolbars/Toolbar.js b/modules/UI/toolbars/Toolbar.js
index 55ba8949f2..ab26427199 100644
--- a/modules/UI/toolbars/Toolbar.js
+++ b/modules/UI/toolbars/Toolbar.js
@@ -102,7 +102,7 @@ function toggleRecording() {
var token = document.getElementById('recordingToken');
if (token.value) {
- callback(Util.escapeHtml(token.value));
+ callback(UIUtil.escapeHtml(token.value));
}
}
},
@@ -321,7 +321,7 @@ var Toolbar = (function (my) {
var lockKey = document.getElementById('lockKey');
if (lockKey.value) {
- Toolbar.setSharedKey(Util.escapeHtml(lockKey.value));
+ Toolbar.setSharedKey(UIUtil.escapeHtml(lockKey.value));
lockRoom(true);
}
}
diff --git a/modules/UI/util/UIUtil.js b/modules/UI/util/UIUtil.js
index efb8a2b7b0..c0f99e86d5 100644
--- a/modules/UI/util/UIUtil.js
+++ b/modules/UI/util/UIUtil.js
@@ -17,6 +17,64 @@ module.exports = {
*/
buttonClick: function(id, classname) {
$(id).toggleClass(classname); // add the class to the clicked element
+ },
+ /**
+ * Returns the text width for the given element.
+ *
+ * @param el the element
+ */
+ getTextWidth: function (el) {
+ return (el.clientWidth + 1);
+ },
+
+ /**
+ * Returns the text height for the given element.
+ *
+ * @param el the element
+ */
+ getTextHeight: function (el) {
+ return (el.clientHeight + 1);
+ },
+
+ /**
+ * Plays the sound given by id.
+ *
+ * @param id the identifier of the audio element.
+ */
+ playSoundNotification: function (id) {
+ document.getElementById(id).play();
+ },
+
+ /**
+ * Escapes the given text.
+ */
+ escapeHtml: function (unsafeText) {
+ return $('
').text(unsafeText).html();
+ },
+
+ imageToGrayScale: function (canvas) {
+ var context = canvas.getContext('2d');
+ var imgData = context.getImageData(0, 0, canvas.width, canvas.height);
+ var pixels = imgData.data;
+
+ for (var i = 0, n = pixels.length; i < n; i += 4) {
+ var grayscale
+ = pixels[i] * .3 + pixels[i+1] * .59 + pixels[i+2] * .11;
+ pixels[i ] = grayscale; // red
+ pixels[i+1] = grayscale; // green
+ pixels[i+2] = grayscale; // blue
+ // pixels[i+3] is alpha
+ }
+ // redraw the image in black & white
+ context.putImageData(imgData, 0, 0);
+ },
+
+ setTooltip: function (element, tooltipText, position) {
+ element.setAttribute("data-content", tooltipText);
+ element.setAttribute("data-toggle", "popover");
+ element.setAttribute("data-placement", position);
+ element.setAttribute("data-html", true);
+ element.setAttribute("data-container", "body");
}
diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js
index 67114be4fa..a24c485d9e 100644
--- a/modules/UI/videolayout/VideoLayout.js
+++ b/modules/UI/videolayout/VideoLayout.js
@@ -464,7 +464,7 @@ function getDesktopVideoSize(videoWidth,
function createEditDisplayNameButton() {
var editButton = document.createElement('a');
editButton.className = 'displayname';
- Util.setTooltip(editButton,
+ UIUtil.setTooltip(editButton,
'Click to edit your
display name',
"top");
editButton.innerHTML = '
';
@@ -483,7 +483,7 @@ function createModeratorIndicatorElement(parentElement) {
moderatorIndicator.className = 'fa fa-star';
parentElement.appendChild(moderatorIndicator);
- Util.setTooltip(parentElement,
+ UIUtil.setTooltip(parentElement,
"The owner of
this conference",
"top");
}
@@ -679,7 +679,7 @@ var VideoLayout = (function (my) {
container.id = 'mixedstream';
container.className = 'videocontainer';
remotes.appendChild(container);
- Util.playSoundNotification('userJoined');
+ UIUtil.playSoundNotification('userJoined');
}
if (container) {
@@ -1201,7 +1201,7 @@ var VideoLayout = (function (my) {
// Remove whole container
container.remove();
- Util.playSoundNotification('userLeft');
+ UIUtil.playSoundNotification('userLeft');
VideoLayout.resizeThumbnails();
}
@@ -1406,7 +1406,7 @@ var VideoLayout = (function (my) {
var mutedIndicator = document.createElement('i');
mutedIndicator.className = 'icon-camera-disabled';
- Util.setTooltip(mutedIndicator,
+ UIUtil.setTooltip(mutedIndicator,
"Participant has
stopped the camera.",
"top");
videoMutedSpan.appendChild(mutedIndicator);
@@ -1449,7 +1449,7 @@ var VideoLayout = (function (my) {
if(audioMutedSpan.length == 0 ) {
audioMutedSpan = document.createElement('span');
audioMutedSpan.className = 'audioMuted';
- Util.setTooltip(audioMutedSpan,
+ UIUtil.setTooltip(audioMutedSpan,
"Participant is muted",
"top");
diff --git a/modules/xmpp/moderator.js b/modules/xmpp/moderator.js
index 7803703505..4d589a6aea 100644
--- a/modules/xmpp/moderator.js
+++ b/modules/xmpp/moderator.js
@@ -6,8 +6,23 @@
*/
var connection = null;
var focusUserJid;
-var getNextTimeout = Util.createExpBackoffTimer(1000);
-var getNextErrorTimeout = Util.createExpBackoffTimer(1000);
+function createExpBackoffTimer(step) {
+ var count = 1;
+ return function (reset) {
+ // Reset call
+ if (reset) {
+ count = 1;
+ return;
+ }
+ // Calculate next timeout
+ var timeout = Math.pow(2, count - 1);
+ count += 1;
+ return timeout * step;
+ };
+}
+
+var getNextTimeout = createExpBackoffTimer(1000);
+var getNextErrorTimeout = createExpBackoffTimer(1000);
// External authentication stuff
var externalAuthEnabled = false;
// Sip gateway can be enabled by configuring Jigasi host in config.js or
diff --git a/util.js b/util.js
deleted file mode 100644
index 0199c67691..0000000000
--- a/util.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/* global $ */
-/**
- * Utility functions.
- */
-var Util = (function (my) {
-
- /**
- * Returns the text width for the given element.
- *
- * @param el the element
- */
- my.getTextWidth = function (el) {
- return (el.clientWidth + 1);
- };
-
- /**
- * Returns the text height for the given element.
- *
- * @param el the element
- */
- my.getTextHeight = function (el) {
- return (el.clientHeight + 1);
- };
-
- /**
- * Casts the given number to integer.
- *
- * @param number the number to cast
- */
- my.toInteger = function (number) {
- return Math.round(Number(number));
- };
-
- /**
- * Plays the sound given by id.
- *
- * @param id the identifier of the audio element.
- */
- my.playSoundNotification = function (id) {
- document.getElementById(id).play();
- };
-
- /**
- * Escapes the given text.
- */
- my.escapeHtml = function (unsafeText) {
- return $('
').text(unsafeText).html();
- };
-
- my.imageToGrayScale = function (canvas) {
- var context = canvas.getContext('2d');
- var imgData = context.getImageData(0, 0, canvas.width, canvas.height);
- var pixels = imgData.data;
-
- for (var i = 0, n = pixels.length; i < n; i += 4) {
- var grayscale
- = pixels[i] * .3 + pixels[i+1] * .59 + pixels[i+2] * .11;
- pixels[i ] = grayscale; // red
- pixels[i+1] = grayscale; // green
- pixels[i+2] = grayscale; // blue
- // pixels[i+3] is alpha
- }
- // redraw the image in black & white
- context.putImageData(imgData, 0, 0);
- };
-
- my.setTooltip = function (element, tooltipText, position) {
- element.setAttribute("data-content", tooltipText);
- element.setAttribute("data-toggle", "popover");
- element.setAttribute("data-placement", position);
- element.setAttribute("data-html", true);
- element.setAttribute("data-container", "body");
- };
-
- my.createExpBackoffTimer = function (step) {
- var count = 1;
- return function (reset) {
- // Reset call
- if (reset) {
- count = 1;
- return;
- }
- // Calculate next timeout
- var timeout = Math.pow(2, count - 1);
- count += 1;
- return timeout * step;
- };
- };
-
- return my;
-}(Util || {}));