Bläddra i källkod

Removes util.js. Fixes prezi.

master
hristoterezov 10 år sedan
förälder
incheckning
29b3ea07e0

+ 0
- 1
index.html Visa fil

31
     <script src="libs/modules/statistics.bundle.js?v=4"></script>
31
     <script src="libs/modules/statistics.bundle.js?v=4"></script>
32
     <script src="libs/modules/RTC.bundle.js?v=6"></script>
32
     <script src="libs/modules/RTC.bundle.js?v=6"></script>
33
     <script src="libs/modules/desktopsharing.bundle.js?v=3"></script><!-- desktop sharing -->
33
     <script src="libs/modules/desktopsharing.bundle.js?v=3"></script><!-- desktop sharing -->
34
-    <script src="util.js?v=7"></script><!-- utility functions -->
35
     <script src="libs/modules/xmpp.bundle.js?v=5"></script>
34
     <script src="libs/modules/xmpp.bundle.js?v=5"></script>
36
     <script src="libs/modules/keyboardshortcut.bundle.js?v=1"></script>
35
     <script src="libs/modules/keyboardshortcut.bundle.js?v=1"></script>
37
     <script src="app.js?v=30"></script><!-- application logic -->
36
     <script src="app.js?v=30"></script><!-- application logic -->

+ 404
- 46
libs/modules/UI.bundle.js Visa fil

702
 module.exports = UI;
702
 module.exports = UI;
703
 
703
 
704
 
704
 
705
-},{"./audio_levels/AudioLevels.js":2,"./authentication/Authentication":4,"./avatar/Avatar":5,"./etherpad/Etherpad.js":6,"./prezi/Prezi.js":7,"./side_pannels/SidePanelToggler":8,"./side_pannels/chat/Chat.js":9,"./side_pannels/contactlist/ContactList":13,"./side_pannels/settings/Settings":14,"./side_pannels/settings/SettingsMenu":15,"./toolbars/BottomToolbar":16,"./toolbars/Toolbar":17,"./toolbars/ToolbarToggler":18,"./util/MessageHandler":20,"./util/NicknameHandler":21,"./util/UIUtil":22,"./videolayout/VideoLayout.js":24,"./welcome_page/RoomnameGenerator":25,"./welcome_page/WelcomePage":26,"events":27}],2:[function(require,module,exports){
705
+},{"./audio_levels/AudioLevels.js":2,"./authentication/Authentication":4,"./avatar/Avatar":5,"./etherpad/Etherpad.js":6,"./prezi/Prezi.js":7,"./side_pannels/SidePanelToggler":9,"./side_pannels/chat/Chat.js":10,"./side_pannels/contactlist/ContactList":14,"./side_pannels/settings/Settings":15,"./side_pannels/settings/SettingsMenu":16,"./toolbars/BottomToolbar":17,"./toolbars/Toolbar":18,"./toolbars/ToolbarToggler":19,"./util/MessageHandler":21,"./util/NicknameHandler":22,"./util/UIUtil":23,"./videolayout/VideoLayout.js":25,"./welcome_page/RoomnameGenerator":26,"./welcome_page/WelcomePage":27,"events":28}],2:[function(require,module,exports){
706
 var CanvasUtil = require("./CanvasUtils");
706
 var CanvasUtil = require("./CanvasUtils");
707
 
707
 
708
 /**
708
 /**
1319
 
1319
 
1320
 
1320
 
1321
 module.exports = Avatar;
1321
 module.exports = Avatar;
1322
-},{"../side_pannels/settings/Settings":14,"../videolayout/VideoLayout":24}],6:[function(require,module,exports){
1322
+},{"../side_pannels/settings/Settings":15,"../videolayout/VideoLayout":25}],6:[function(require,module,exports){
1323
 /* global $, config, dockToolbar,
1323
 /* global $, config, dockToolbar,
1324
    setLargeVideoVisible, Util */
1324
    setLargeVideoVisible, Util */
1325
 
1325
 
1515
 
1515
 
1516
 module.exports = Etherpad;
1516
 module.exports = Etherpad;
1517
 
1517
 
1518
-},{"../prezi/Prezi":7,"../util/UIUtil":22,"../videolayout/VideoLayout":24}],7:[function(require,module,exports){
1518
+},{"../prezi/Prezi":7,"../util/UIUtil":23,"../videolayout/VideoLayout":25}],7:[function(require,module,exports){
1519
 var ToolbarToggler = require("../toolbars/ToolbarToggler");
1519
 var ToolbarToggler = require("../toolbars/ToolbarToggler");
1520
 var UIUtil = require("../util/UIUtil");
1520
 var UIUtil = require("../util/UIUtil");
1521
 var VideoLayout = require("../videolayout/VideoLayout");
1521
 var VideoLayout = require("../videolayout/VideoLayout");
1522
 var messageHandler = require("../util/MessageHandler");
1522
 var messageHandler = require("../util/MessageHandler");
1523
+var PreziPlayer = require("./PreziPlayer");
1523
 
1524
 
1524
 var preziPlayer = null;
1525
 var preziPlayer = null;
1525
 
1526
 
1591
                             if (preziUrl.value)
1592
                             if (preziUrl.value)
1592
                             {
1593
                             {
1593
                                 var urlValue
1594
                                 var urlValue
1594
-                                    = encodeURI(Util.escapeHtml(preziUrl.value));
1595
+                                    = encodeURI(UIUtil.escapeHtml(preziUrl.value));
1595
 
1596
 
1596
                                 if (urlValue.indexOf('http://prezi.com/') != 0
1597
                                 if (urlValue.indexOf('http://prezi.com/') != 0
1597
                                     && urlValue.indexOf('https://prezi.com/') != 0)
1598
                                     && urlValue.indexOf('https://prezi.com/') != 0)
1867
 
1868
 
1868
 module.exports = Prezi;
1869
 module.exports = Prezi;
1869
 
1870
 
1870
-},{"../toolbars/ToolbarToggler":18,"../util/MessageHandler":20,"../util/UIUtil":22,"../videolayout/VideoLayout":24}],8:[function(require,module,exports){
1871
+},{"../toolbars/ToolbarToggler":19,"../util/MessageHandler":21,"../util/UIUtil":23,"../videolayout/VideoLayout":25,"./PreziPlayer":8}],8:[function(require,module,exports){
1872
+(function() {
1873
+    "use strict";
1874
+    var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
1875
+
1876
+    window.PreziPlayer = (function() {
1877
+
1878
+        PreziPlayer.API_VERSION = 1;
1879
+        PreziPlayer.CURRENT_STEP = 'currentStep';
1880
+        PreziPlayer.CURRENT_ANIMATION_STEP = 'currentAnimationStep';
1881
+        PreziPlayer.CURRENT_OBJECT = 'currentObject';
1882
+        PreziPlayer.STATUS_LOADING = 'loading';
1883
+        PreziPlayer.STATUS_READY = 'ready';
1884
+        PreziPlayer.STATUS_CONTENT_READY = 'contentready';
1885
+        PreziPlayer.EVENT_CURRENT_STEP = "currentStepChange";
1886
+        PreziPlayer.EVENT_CURRENT_ANIMATION_STEP = "currentAnimationStepChange";
1887
+        PreziPlayer.EVENT_CURRENT_OBJECT = "currentObjectChange";
1888
+        PreziPlayer.EVENT_STATUS = "statusChange";
1889
+        PreziPlayer.EVENT_PLAYING = "isAutoPlayingChange";
1890
+        PreziPlayer.EVENT_IS_MOVING = "isMovingChange";
1891
+        PreziPlayer.domain = "https://prezi.com";
1892
+        PreziPlayer.path = "/player/";
1893
+        PreziPlayer.players = {};
1894
+        PreziPlayer.binded_methods = ['changesHandler'];
1895
+
1896
+        PreziPlayer.createMultiplePlayers = function(optionArray){
1897
+            for(var i=0; i<optionArray.length; i++) {
1898
+                var optionSet = optionArray[i];
1899
+                new PreziPlayer(optionSet.id, optionSet);
1900
+            };
1901
+        };
1902
+
1903
+        PreziPlayer.messageReceived = function(event){
1904
+            var message, item, player;
1905
+            try {
1906
+                message = JSON.parse(event.data);
1907
+            } catch (e) {}
1908
+            if (message.id && (player = PreziPlayer.players[message.id])){
1909
+                if (player.options.debug === true) {
1910
+                    if (console && console.log) console.log('received', message);
1911
+                }
1912
+                if (message.type === "changes"){
1913
+                    player.changesHandler(message);
1914
+                }
1915
+                for (var i=0; i<player.callbacks.length; i++) {
1916
+                    item = player.callbacks[i];
1917
+                    if (item && message.type === item.event){
1918
+                        item.callback(message);
1919
+                    }
1920
+                }
1921
+            }
1922
+        };
1923
+
1924
+        function PreziPlayer(id, options) {
1925
+            var params, paramString = "", _this = this;
1926
+            if (PreziPlayer.players[id]){
1927
+                PreziPlayer.players[id].destroy();
1928
+            }
1929
+            for(var i=0; i<PreziPlayer.binded_methods.length; i++) {
1930
+                var method_name = PreziPlayer.binded_methods[i];
1931
+                _this[method_name] = __bind(_this[method_name], _this);
1932
+            };
1933
+            options = options || {};
1934
+            this.options = options;
1935
+            this.values = {'status': PreziPlayer.STATUS_LOADING};
1936
+            this.values[PreziPlayer.CURRENT_STEP] = 0;
1937
+            this.values[PreziPlayer.CURRENT_ANIMATION_STEP] = 0;
1938
+            this.values[PreziPlayer.CURRENT_OBJECT] = null;
1939
+            this.callbacks = [];
1940
+            this.id = id;
1941
+            this.embedTo = document.getElementById(id);
1942
+            if (!this.embedTo) {
1943
+                throw "The element id is not available.";
1944
+            }
1945
+            this.iframe = document.createElement('iframe');
1946
+            params = [
1947
+                { name: 'oid', value: options.preziId },
1948
+                { name: 'explorable', value: options.explorable ? 1 : 0 },
1949
+                { name: 'controls', value: options.controls ? 1 : 0 }
1950
+            ];
1951
+            for(var i=0; i<params.length; i++) {
1952
+                var param = params[i];
1953
+                paramString += (i===0 ? "?" : "&") + param.name + "=" + param.value;
1954
+            };
1955
+            this.iframe.src = PreziPlayer.domain + PreziPlayer.path + paramString;
1956
+            this.iframe.frameBorder = 0;
1957
+            this.iframe.scrolling = "no";
1958
+            this.iframe.width = options.width || 640;
1959
+            this.iframe.height = options.height || 480;
1960
+            this.embedTo.innerHTML = '';
1961
+            // JITSI: IN CASE SOMETHING GOES WRONG.
1962
+            try {
1963
+                this.embedTo.appendChild(this.iframe);
1964
+            }
1965
+            catch (err) {
1966
+                console.log("CATCH ERROR");
1967
+            }
1968
+
1969
+            // JITSI: Increase interval from 200 to 500, which fixes prezi
1970
+            // crashes for us.
1971
+            this.initPollInterval = setInterval(function(){
1972
+                _this.sendMessage({'action': 'init'});
1973
+            }, 500);
1974
+            PreziPlayer.players[id] = this;
1975
+        }
1976
+
1977
+        PreziPlayer.prototype.changesHandler = function(message) {
1978
+            var key, value, j, item;
1979
+            if (this.initPollInterval) {
1980
+                clearInterval(this.initPollInterval);
1981
+                this.initPollInterval = false;
1982
+            }
1983
+            for (key in message.data) {
1984
+                if (message.data.hasOwnProperty(key)){
1985
+                    value = message.data[key];
1986
+                    this.values[key] = value;
1987
+                    for (j=0; j<this.callbacks.length; j++) {
1988
+                        item = this.callbacks[j];
1989
+                        if (item && item.event === key + "Change"){
1990
+                            item.callback({type: item.event, value: value});
1991
+                        }
1992
+                    }
1993
+                }
1994
+            }
1995
+        };
1996
+
1997
+        PreziPlayer.prototype.destroy = function() {
1998
+            if (this.initPollInterval) {
1999
+                clearInterval(this.initPollInterval);
2000
+                this.initPollInterval = false;
2001
+            }
2002
+            this.embedTo.innerHTML = '';
2003
+        };
2004
+
2005
+        PreziPlayer.prototype.sendMessage = function(message) {
2006
+            if (this.options.debug === true) {
2007
+                if (console && console.log) console.log('sent', message);
2008
+            }
2009
+            message.version = PreziPlayer.API_VERSION;
2010
+            message.id = this.id;
2011
+            return this.iframe.contentWindow.postMessage(JSON.stringify(message), '*');
2012
+        };
2013
+
2014
+        PreziPlayer.prototype.nextStep = /* nextStep is DEPRECATED */
2015
+        PreziPlayer.prototype.flyToNextStep = function() {
2016
+            return this.sendMessage({
2017
+                'action': 'present',
2018
+                'data': ['moveToNextStep']
2019
+            });
2020
+        };
2021
+
2022
+        PreziPlayer.prototype.previousStep = /* previousStep is DEPRECATED */
2023
+        PreziPlayer.prototype.flyToPreviousStep = function() {
2024
+            return this.sendMessage({
2025
+                'action': 'present',
2026
+                'data': ['moveToPrevStep']
2027
+            });
2028
+        };
2029
+
2030
+        PreziPlayer.prototype.toStep = /* toStep is DEPRECATED */
2031
+        PreziPlayer.prototype.flyToStep = function(step, animation_step) {
2032
+            var obj = this;
2033
+            // check animation_step
2034
+            if (animation_step > 0 &&
2035
+                obj.values.animationCountOnSteps &&
2036
+                obj.values.animationCountOnSteps[step] <= animation_step) {
2037
+                animation_step = obj.values.animationCountOnSteps[step];
2038
+            }
2039
+            // jump to animation steps by calling flyToNextStep()
2040
+            function doAnimationSteps() {
2041
+                if (obj.values.isMoving == true) {
2042
+                    setTimeout(doAnimationSteps, 100); // wait until the flight ends
2043
+                    return;
2044
+                }
2045
+                while (animation_step-- > 0) {
2046
+                    obj.flyToNextStep(); // do the animation steps
2047
+                }
2048
+            }
2049
+            setTimeout(doAnimationSteps, 200); // 200ms is the internal "reporting" time
2050
+            // jump to the step
2051
+            return this.sendMessage({
2052
+                'action': 'present',
2053
+                'data': ['moveToStep', step]
2054
+            });
2055
+        };
2056
+
2057
+        PreziPlayer.prototype.toObject = /* toObject is DEPRECATED */
2058
+        PreziPlayer.prototype.flyToObject = function(objectId) {
2059
+            return this.sendMessage({
2060
+                'action': 'present',
2061
+                'data': ['moveToObject', objectId]
2062
+            });
2063
+        };
2064
+
2065
+        PreziPlayer.prototype.play = function(defaultDelay) {
2066
+            return this.sendMessage({
2067
+                'action': 'present',
2068
+                'data': ['startAutoPlay', defaultDelay]
2069
+            });
2070
+        };
2071
+
2072
+        PreziPlayer.prototype.stop = function() {
2073
+            return this.sendMessage({
2074
+                'action': 'present',
2075
+                'data': ['stopAutoPlay']
2076
+            });
2077
+        };
2078
+
2079
+        PreziPlayer.prototype.pause = function(defaultDelay) {
2080
+            return this.sendMessage({
2081
+                'action': 'present',
2082
+                'data': ['pauseAutoPlay', defaultDelay]
2083
+            });
2084
+        };
2085
+
2086
+        PreziPlayer.prototype.getCurrentStep = function() {
2087
+            return this.values.currentStep;
2088
+        };
2089
+
2090
+        PreziPlayer.prototype.getCurrentAnimationStep = function() {
2091
+            return this.values.currentAnimationStep;
2092
+        };
2093
+
2094
+        PreziPlayer.prototype.getCurrentObject = function() {
2095
+            return this.values.currentObject;
2096
+        };
2097
+
2098
+        PreziPlayer.prototype.getStatus = function() {
2099
+            return this.values.status;
2100
+        };
2101
+
2102
+        PreziPlayer.prototype.isPlaying = function() {
2103
+            return this.values.isAutoPlaying;
2104
+        };
2105
+
2106
+        PreziPlayer.prototype.getStepCount = function() {
2107
+            return this.values.stepCount;
2108
+        };
2109
+
2110
+        PreziPlayer.prototype.getAnimationCountOnSteps = function() {
2111
+            return this.values.animationCountOnSteps;
2112
+        };
2113
+
2114
+        PreziPlayer.prototype.getTitle = function() {
2115
+            return this.values.title;
2116
+        };
2117
+
2118
+        PreziPlayer.prototype.setDimensions = function(dims) {
2119
+            for (var parameter in dims) {
2120
+                this.iframe[parameter] = dims[parameter];
2121
+            }
2122
+        }
2123
+
2124
+        PreziPlayer.prototype.getDimensions = function() {
2125
+            return {
2126
+                width: parseInt(this.iframe.width, 10),
2127
+                height: parseInt(this.iframe.height, 10)
2128
+            }
2129
+        }
2130
+
2131
+        PreziPlayer.prototype.on = function(event, callback) {
2132
+            this.callbacks.push({
2133
+                event: event,
2134
+                callback: callback
2135
+            });
2136
+        };
2137
+
2138
+        PreziPlayer.prototype.off = function(event, callback) {
2139
+            var j, item;
2140
+            if (event === undefined) {
2141
+                this.callbacks = [];
2142
+            }
2143
+            j = this.callbacks.length;
2144
+            while (j--) {
2145
+                item = this.callbacks[j];
2146
+                if (item && item.event === event && (callback === undefined || item.callback === callback)){
2147
+                    this.callbacks.splice(j, 1);
2148
+                }
2149
+            }
2150
+        };
2151
+
2152
+        if (window.addEventListener) {
2153
+            window.addEventListener('message', PreziPlayer.messageReceived, false);
2154
+        } else {
2155
+            window.attachEvent('onmessage', PreziPlayer.messageReceived);
2156
+        }
2157
+
2158
+        return PreziPlayer;
2159
+
2160
+    })();
2161
+
2162
+})();
2163
+
2164
+module.exports = PreziPlayer;
2165
+
2166
+},{}],9:[function(require,module,exports){
1871
 var Chat = require("./chat/Chat");
2167
 var Chat = require("./chat/Chat");
1872
 var ContactList = require("./contactlist/ContactList");
2168
 var ContactList = require("./contactlist/ContactList");
1873
 var Settings = require("./settings/Settings");
2169
 var Settings = require("./settings/Settings");
2124
 }(PanelToggler || {}));
2420
 }(PanelToggler || {}));
2125
 
2421
 
2126
 module.exports = PanelToggler;
2422
 module.exports = PanelToggler;
2127
-},{"../toolbars/ToolbarToggler":18,"../util/UIUtil":22,"../videolayout/VideoLayout":24,"./chat/Chat":9,"./contactlist/ContactList":13,"./settings/Settings":14,"./settings/SettingsMenu":15}],9:[function(require,module,exports){
2423
+},{"../toolbars/ToolbarToggler":19,"../util/UIUtil":23,"../videolayout/VideoLayout":25,"./chat/Chat":10,"./contactlist/ContactList":14,"./settings/Settings":15,"./settings/SettingsMenu":16}],10:[function(require,module,exports){
2128
 /* global $, Util, nickname:true, showToolbar */
2424
 /* global $, Util, nickname:true, showToolbar */
2129
 var Replacement = require("./Replacement");
2425
 var Replacement = require("./Replacement");
2130
 var CommandsProcessor = require("./Commands");
2426
 var CommandsProcessor = require("./Commands");
2131
 var ToolbarToggler = require("../../toolbars/ToolbarToggler");
2427
 var ToolbarToggler = require("../../toolbars/ToolbarToggler");
2132
 var smileys = require("./smileys.json").smileys;
2428
 var smileys = require("./smileys.json").smileys;
2133
 var NicknameHandler = require("../../util/NicknameHandler");
2429
 var NicknameHandler = require("../../util/NicknameHandler");
2430
+var UIUtil = require("../../util/UIUtil");
2134
 
2431
 
2135
 var notificationInterval = false;
2432
 var notificationInterval = false;
2136
 var unreadMessages = 0;
2433
 var unreadMessages = 0;
2155
 
2452
 
2156
         var chatButtonElement
2453
         var chatButtonElement
2157
             = document.getElementById('chatButton').parentNode;
2454
             = document.getElementById('chatButton').parentNode;
2158
-        var leftIndent = (Util.getTextWidth(chatButtonElement) -
2159
-            Util.getTextWidth(unreadMsgElement)) / 2;
2160
-        var topIndent = (Util.getTextHeight(chatButtonElement) -
2161
-            Util.getTextHeight(unreadMsgElement)) / 2 - 3;
2455
+        var leftIndent = (UIUtil.getTextWidth(chatButtonElement) -
2456
+            UIUtil.getTextWidth(unreadMsgElement)) / 2;
2457
+        var topIndent = (UIUtil.getTextHeight(chatButtonElement) -
2458
+            UIUtil.getTextHeight(unreadMsgElement)) / 2 - 3;
2162
 
2459
 
2163
         unreadMsgElement.setAttribute(
2460
         unreadMsgElement.setAttribute(
2164
             'style',
2461
             'style',
2306
         $('#nickinput').keydown(function (event) {
2603
         $('#nickinput').keydown(function (event) {
2307
             if (event.keyCode === 13) {
2604
             if (event.keyCode === 13) {
2308
                 event.preventDefault();
2605
                 event.preventDefault();
2309
-                var val = Util.escapeHtml(this.value);
2606
+                var val = UIUtil.escapeHtml(this.value);
2310
                 this.value = '';
2607
                 this.value = '';
2311
                 if (!NicknameHandler.getNickname()) {
2608
                 if (!NicknameHandler.getNickname()) {
2312
                     NicknameHandler.setNickname(val);
2609
                     NicknameHandler.setNickname(val);
2329
                 }
2626
                 }
2330
                 else
2627
                 else
2331
                 {
2628
                 {
2332
-                    var message = Util.escapeHtml(value);
2629
+                    var message = UIUtil.escapeHtml(value);
2333
                     xmpp.sendChatMessage(message, NicknameHandler.getNickname());
2630
                     xmpp.sendChatMessage(message, NicknameHandler.getNickname());
2334
                 }
2631
                 }
2335
             }
2632
             }
2364
 
2661
 
2365
             if (!Chat.isVisible()) {
2662
             if (!Chat.isVisible()) {
2366
                 unreadMessages++;
2663
                 unreadMessages++;
2367
-                Util.playSoundNotification('chatNotification');
2664
+                UIUtil.playSoundNotification('chatNotification');
2368
                 setVisualNotification(true);
2665
                 setVisualNotification(true);
2369
             }
2666
             }
2370
         }
2667
         }
2374
         // so we escape here only tags to avoid double &amp;
2671
         // so we escape here only tags to avoid double &amp;
2375
         var escMessage = message.replace(/</g, '&lt;').
2672
         var escMessage = message.replace(/</g, '&lt;').
2376
             replace(/>/g, '&gt;').replace(/\n/g, '<br/>');
2673
             replace(/>/g, '&gt;').replace(/\n/g, '<br/>');
2377
-        var escDisplayName = Util.escapeHtml(displayName);
2674
+        var escDisplayName = UIUtil.escapeHtml(displayName);
2378
         message = Replacement.processReplacements(escMessage);
2675
         message = Replacement.processReplacements(escMessage);
2379
 
2676
 
2380
         var messageContainer =
2677
         var messageContainer =
2397
      */
2694
      */
2398
     my.chatAddError = function(errorMessage, originalText)
2695
     my.chatAddError = function(errorMessage, originalText)
2399
     {
2696
     {
2400
-        errorMessage = Util.escapeHtml(errorMessage);
2401
-        originalText = Util.escapeHtml(originalText);
2697
+        errorMessage = UIUtil.escapeHtml(errorMessage);
2698
+        originalText = UIUtil.escapeHtml(originalText);
2402
 
2699
 
2403
         $('#chatconversation').append(
2700
         $('#chatconversation').append(
2404
             '<div class="errorMessage"><b>Error: </b>' + 'Your message' +
2701
             '<div class="errorMessage"><b>Error: </b>' + 'Your message' +
2417
     {
2714
     {
2418
         if(subject)
2715
         if(subject)
2419
             subject = subject.trim();
2716
             subject = subject.trim();
2420
-        $('#subject').html(Replacement.linkify(Util.escapeHtml(subject)));
2717
+        $('#subject').html(Replacement.linkify(UIUtil.escapeHtml(subject)));
2421
         if(subject === "")
2718
         if(subject === "")
2422
         {
2719
         {
2423
             $("#subject").css({display: "none"});
2720
             $("#subject").css({display: "none"});
2480
     return my;
2777
     return my;
2481
 }(Chat || {}));
2778
 }(Chat || {}));
2482
 module.exports = Chat;
2779
 module.exports = Chat;
2483
-},{"../../toolbars/ToolbarToggler":18,"../../util/NicknameHandler":21,"../SidePanelToggler":8,"./Commands":10,"./Replacement":11,"./smileys.json":12}],10:[function(require,module,exports){
2780
+},{"../../toolbars/ToolbarToggler":19,"../../util/NicknameHandler":22,"../../util/UIUtil":23,"../SidePanelToggler":9,"./Commands":11,"./Replacement":12,"./smileys.json":13}],11:[function(require,module,exports){
2781
+var UIUtil = require("../../util/UIUtil");
2782
+
2484
 /**
2783
 /**
2485
  * List with supported commands. The keys are the names of the commands and
2784
  * List with supported commands. The keys are the names of the commands and
2486
  * the value is the function that processes the message.
2785
  * the value is the function that processes the message.
2514
  */
2813
  */
2515
 function processTopic(commandArguments)
2814
 function processTopic(commandArguments)
2516
 {
2815
 {
2517
-    var topic = Util.escapeHtml(commandArguments);
2816
+    var topic = UIUtil.escapeHtml(commandArguments);
2518
     xmpp.setSubject(topic);
2817
     xmpp.setSubject(topic);
2519
 }
2818
 }
2520
 
2819
 
2576
 };
2875
 };
2577
 
2876
 
2578
 module.exports = CommandsProcessor;
2877
 module.exports = CommandsProcessor;
2579
-},{}],11:[function(require,module,exports){
2878
+},{"../../util/UIUtil":23}],12:[function(require,module,exports){
2580
 var Smileys = require("./smileys.json");
2879
 var Smileys = require("./smileys.json");
2581
 /**
2880
 /**
2582
  * Processes links and smileys in "body"
2881
  * Processes links and smileys in "body"
2640
     linkify: linkify
2939
     linkify: linkify
2641
 };
2940
 };
2642
 
2941
 
2643
-},{"./smileys.json":12}],12:[function(require,module,exports){
2942
+},{"./smileys.json":13}],13:[function(require,module,exports){
2644
 module.exports={
2943
 module.exports={
2645
     "smileys": {
2944
     "smileys": {
2646
         "smiley1": ":)",
2945
         "smiley1": ":)",
2690
     }
2989
     }
2691
 }
2990
 }
2692
 
2991
 
2693
-},{}],13:[function(require,module,exports){
2992
+},{}],14:[function(require,module,exports){
2694
 
2993
 
2695
 var numberOfContacts = 0;
2994
 var numberOfContacts = 0;
2696
 var notificationInterval;
2995
 var notificationInterval;
2874
 };
3173
 };
2875
 
3174
 
2876
 module.exports = ContactList;
3175
 module.exports = ContactList;
2877
-},{}],14:[function(require,module,exports){
3176
+},{}],15:[function(require,module,exports){
2878
 var email = '';
3177
 var email = '';
2879
 var displayName = '';
3178
 var displayName = '';
2880
 var userId;
3179
 var userId;
2934
 
3233
 
2935
 module.exports = Settings;
3234
 module.exports = Settings;
2936
 
3235
 
2937
-},{}],15:[function(require,module,exports){
3236
+},{}],16:[function(require,module,exports){
2938
 var Avatar = require("../../avatar/Avatar");
3237
 var Avatar = require("../../avatar/Avatar");
2939
 var Settings = require("./Settings");
3238
 var Settings = require("./Settings");
3239
+var UIUtil = require("../../util/UIUtil");
2940
 
3240
 
2941
 
3241
 
2942
 var SettingsMenu = {
3242
 var SettingsMenu = {
2943
 
3243
 
2944
     update: function() {
3244
     update: function() {
2945
-        var newDisplayName = Util.escapeHtml($('#setDisplayName').get(0).value);
2946
-        var newEmail = Util.escapeHtml($('#setEmail').get(0).value);
3245
+        var newDisplayName = UIUtil.escapeHtml($('#setDisplayName').get(0).value);
3246
+        var newEmail = UIUtil.escapeHtml($('#setEmail').get(0).value);
2947
 
3247
 
2948
         if(newDisplayName) {
3248
         if(newDisplayName) {
2949
             var displayName = Settings.setDisplayName(newDisplayName);
3249
             var displayName = Settings.setDisplayName(newDisplayName);
2977
 
3277
 
2978
 
3278
 
2979
 module.exports = SettingsMenu;
3279
 module.exports = SettingsMenu;
2980
-},{"../../avatar/Avatar":5,"./Settings":14}],16:[function(require,module,exports){
3280
+},{"../../avatar/Avatar":5,"../../util/UIUtil":23,"./Settings":15}],17:[function(require,module,exports){
2981
 var PanelToggler = require("../side_pannels/SidePanelToggler");
3281
 var PanelToggler = require("../side_pannels/SidePanelToggler");
2982
 
3282
 
2983
 var buttonHandlers = {
3283
 var buttonHandlers = {
3022
 
3322
 
3023
 module.exports = BottomToolbar;
3323
 module.exports = BottomToolbar;
3024
 
3324
 
3025
-},{"../side_pannels/SidePanelToggler":8}],17:[function(require,module,exports){
3325
+},{"../side_pannels/SidePanelToggler":9}],18:[function(require,module,exports){
3026
 /* global $, buttonClick, config, lockRoom,
3326
 /* global $, buttonClick, config, lockRoom,
3027
    setSharedKey, Util */
3327
    setSharedKey, Util */
3028
 var messageHandler = require("../util/MessageHandler");
3328
 var messageHandler = require("../util/MessageHandler");
3127
                     var token = document.getElementById('recordingToken');
3427
                     var token = document.getElementById('recordingToken');
3128
 
3428
 
3129
                     if (token.value) {
3429
                     if (token.value) {
3130
-                        callback(Util.escapeHtml(token.value));
3430
+                        callback(UIUtil.escapeHtml(token.value));
3131
                     }
3431
                     }
3132
                 }
3432
                 }
3133
             },
3433
             },
3346
                             var lockKey = document.getElementById('lockKey');
3646
                             var lockKey = document.getElementById('lockKey');
3347
 
3647
 
3348
                             if (lockKey.value) {
3648
                             if (lockKey.value) {
3349
-                                Toolbar.setSharedKey(Util.escapeHtml(lockKey.value));
3649
+                                Toolbar.setSharedKey(UIUtil.escapeHtml(lockKey.value));
3350
                                 lockRoom(true);
3650
                                 lockRoom(true);
3351
                             }
3651
                             }
3352
                         }
3652
                         }
3541
 }(Toolbar || {}));
3841
 }(Toolbar || {}));
3542
 
3842
 
3543
 module.exports = Toolbar;
3843
 module.exports = Toolbar;
3544
-},{"../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){
3844
+},{"../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){
3545
 /* global $, interfaceConfig, Moderator, DesktopStreaming.showDesktopSharingButton */
3845
 /* global $, interfaceConfig, Moderator, DesktopStreaming.showDesktopSharingButton */
3546
 
3846
 
3547
 var toolbarTimeoutObject,
3847
 var toolbarTimeoutObject,
3656
 };
3956
 };
3657
 
3957
 
3658
 module.exports = ToolbarToggler;
3958
 module.exports = ToolbarToggler;
3659
-},{}],19:[function(require,module,exports){
3959
+},{}],20:[function(require,module,exports){
3660
 var JitsiPopover = (function () {
3960
 var JitsiPopover = (function () {
3661
     /**
3961
     /**
3662
      * Constructs new JitsiPopover and attaches it to the element
3962
      * Constructs new JitsiPopover and attaches it to the element
3780
 })();
4080
 })();
3781
 
4081
 
3782
 module.exports = JitsiPopover;
4082
 module.exports = JitsiPopover;
3783
-},{}],20:[function(require,module,exports){
4083
+},{}],21:[function(require,module,exports){
3784
 /* global $, jQuery */
4084
 /* global $, jQuery */
3785
 var messageHandler = (function(my) {
4085
 var messageHandler = (function(my) {
3786
 
4086
 
3949
 
4249
 
3950
 
4250
 
3951
 
4251
 
3952
-},{}],21:[function(require,module,exports){
4252
+},{}],22:[function(require,module,exports){
3953
 var nickname = null;
4253
 var nickname = null;
3954
 var eventEmitter = null;
4254
 var eventEmitter = null;
3955
 
4255
 
3978
 };
4278
 };
3979
 
4279
 
3980
 module.exports = NickanameHandler;
4280
 module.exports = NickanameHandler;
3981
-},{}],22:[function(require,module,exports){
4281
+},{}],23:[function(require,module,exports){
3982
 /**
4282
 /**
3983
  * Created by hristo on 12/22/14.
4283
  * Created by hristo on 12/22/14.
3984
  */
4284
  */
3998
      */
4298
      */
3999
     buttonClick: function(id, classname) {
4299
     buttonClick: function(id, classname) {
4000
         $(id).toggleClass(classname); // add the class to the clicked element
4300
         $(id).toggleClass(classname); // add the class to the clicked element
4301
+    },
4302
+    /**
4303
+     * Returns the text width for the given element.
4304
+     *
4305
+     * @param el the element
4306
+     */
4307
+    getTextWidth: function (el) {
4308
+        return (el.clientWidth + 1);
4309
+    },
4310
+
4311
+    /**
4312
+     * Returns the text height for the given element.
4313
+     *
4314
+     * @param el the element
4315
+     */
4316
+    getTextHeight: function (el) {
4317
+        return (el.clientHeight + 1);
4318
+    },
4319
+
4320
+    /**
4321
+     * Plays the sound given by id.
4322
+     *
4323
+     * @param id the identifier of the audio element.
4324
+     */
4325
+    playSoundNotification: function (id) {
4326
+        document.getElementById(id).play();
4327
+    },
4328
+
4329
+    /**
4330
+     * Escapes the given text.
4331
+     */
4332
+    escapeHtml: function (unsafeText) {
4333
+        return $('<div/>').text(unsafeText).html();
4334
+    },
4335
+
4336
+    imageToGrayScale: function (canvas) {
4337
+        var context = canvas.getContext('2d');
4338
+        var imgData = context.getImageData(0, 0, canvas.width, canvas.height);
4339
+        var pixels  = imgData.data;
4340
+
4341
+        for (var i = 0, n = pixels.length; i < n; i += 4) {
4342
+            var grayscale
4343
+                = pixels[i] * .3 + pixels[i+1] * .59 + pixels[i+2] * .11;
4344
+            pixels[i  ] = grayscale;        // red
4345
+            pixels[i+1] = grayscale;        // green
4346
+            pixels[i+2] = grayscale;        // blue
4347
+            // pixels[i+3]              is alpha
4348
+        }
4349
+        // redraw the image in black & white
4350
+        context.putImageData(imgData, 0, 0);
4351
+    },
4352
+
4353
+    setTooltip: function (element, tooltipText, position) {
4354
+        element.setAttribute("data-content", tooltipText);
4355
+        element.setAttribute("data-toggle", "popover");
4356
+        element.setAttribute("data-placement", position);
4357
+        element.setAttribute("data-html", true);
4358
+        element.setAttribute("data-container", "body");
4001
     }
4359
     }
4002
 
4360
 
4003
 
4361
 
4004
 };
4362
 };
4005
-},{"../side_pannels/SidePanelToggler":8}],23:[function(require,module,exports){
4363
+},{"../side_pannels/SidePanelToggler":9}],24:[function(require,module,exports){
4006
 var JitsiPopover = require("../util/JitsiPopover");
4364
 var JitsiPopover = require("../util/JitsiPopover");
4007
 
4365
 
4008
 /**
4366
 /**
4413
 };
4771
 };
4414
 
4772
 
4415
 module.exports = ConnectionIndicator;
4773
 module.exports = ConnectionIndicator;
4416
-},{"../util/JitsiPopover":19}],24:[function(require,module,exports){
4774
+},{"../util/JitsiPopover":20}],25:[function(require,module,exports){
4417
 var AudioLevels = require("../audio_levels/AudioLevels");
4775
 var AudioLevels = require("../audio_levels/AudioLevels");
4418
 var Avatar = require("../avatar/Avatar");
4776
 var Avatar = require("../avatar/Avatar");
4419
 var Chat = require("../side_pannels/chat/Chat");
4777
 var Chat = require("../side_pannels/chat/Chat");
4880
 function createEditDisplayNameButton() {
5238
 function createEditDisplayNameButton() {
4881
     var editButton = document.createElement('a');
5239
     var editButton = document.createElement('a');
4882
     editButton.className = 'displayname';
5240
     editButton.className = 'displayname';
4883
-    Util.setTooltip(editButton,
5241
+    UIUtil.setTooltip(editButton,
4884
         'Click to edit your<br/>display name',
5242
         'Click to edit your<br/>display name',
4885
         "top");
5243
         "top");
4886
     editButton.innerHTML = '<i class="fa fa-pencil"></i>';
5244
     editButton.innerHTML = '<i class="fa fa-pencil"></i>';
4899
     moderatorIndicator.className = 'fa fa-star';
5257
     moderatorIndicator.className = 'fa fa-star';
4900
     parentElement.appendChild(moderatorIndicator);
5258
     parentElement.appendChild(moderatorIndicator);
4901
 
5259
 
4902
-    Util.setTooltip(parentElement,
5260
+    UIUtil.setTooltip(parentElement,
4903
         "The owner of<br/>this conference",
5261
         "The owner of<br/>this conference",
4904
         "top");
5262
         "top");
4905
 }
5263
 }
5095
             container.id = 'mixedstream';
5453
             container.id = 'mixedstream';
5096
             container.className = 'videocontainer';
5454
             container.className = 'videocontainer';
5097
             remotes.appendChild(container);
5455
             remotes.appendChild(container);
5098
-            Util.playSoundNotification('userJoined');
5456
+            UIUtil.playSoundNotification('userJoined');
5099
         }
5457
         }
5100
 
5458
 
5101
         if (container) {
5459
         if (container) {
5617
             // Remove whole container
5975
             // Remove whole container
5618
             container.remove();
5976
             container.remove();
5619
 
5977
 
5620
-            Util.playSoundNotification('userLeft');
5978
+            UIUtil.playSoundNotification('userLeft');
5621
             VideoLayout.resizeThumbnails();
5979
             VideoLayout.resizeThumbnails();
5622
         }
5980
         }
5623
 
5981
 
5822
 
6180
 
5823
                 var mutedIndicator = document.createElement('i');
6181
                 var mutedIndicator = document.createElement('i');
5824
                 mutedIndicator.className = 'icon-camera-disabled';
6182
                 mutedIndicator.className = 'icon-camera-disabled';
5825
-                Util.setTooltip(mutedIndicator,
6183
+                UIUtil.setTooltip(mutedIndicator,
5826
                     "Participant has<br/>stopped the camera.",
6184
                     "Participant has<br/>stopped the camera.",
5827
                     "top");
6185
                     "top");
5828
                 videoMutedSpan.appendChild(mutedIndicator);
6186
                 videoMutedSpan.appendChild(mutedIndicator);
5865
             if(audioMutedSpan.length == 0 ) {
6223
             if(audioMutedSpan.length == 0 ) {
5866
                 audioMutedSpan = document.createElement('span');
6224
                 audioMutedSpan = document.createElement('span');
5867
                 audioMutedSpan.className = 'audioMuted';
6225
                 audioMutedSpan.className = 'audioMuted';
5868
-                Util.setTooltip(audioMutedSpan,
6226
+                UIUtil.setTooltip(audioMutedSpan,
5869
                     "Participant is muted",
6227
                     "Participant is muted",
5870
                     "top");
6228
                     "top");
5871
 
6229
 
6610
 }(VideoLayout || {}));
6968
 }(VideoLayout || {}));
6611
 
6969
 
6612
 module.exports = VideoLayout;
6970
 module.exports = VideoLayout;
6613
-},{"../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){
6971
+},{"../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){
6614
 //var nouns = [
6972
 //var nouns = [
6615
 //];
6973
 //];
6616
 var pluralNouns = [
6974
 var pluralNouns = [
6791
 
7149
 
6792
 module.exports = RoomNameGenerator;
7150
 module.exports = RoomNameGenerator;
6793
 
7151
 
6794
-},{}],26:[function(require,module,exports){
7152
+},{}],27:[function(require,module,exports){
6795
 var animateTimeout, updateTimeout;
7153
 var animateTimeout, updateTimeout;
6796
 
7154
 
6797
 var RoomNameGenerator = require("./RoomnameGenerator");
7155
 var RoomNameGenerator = require("./RoomnameGenerator");
6895
 }
7253
 }
6896
 
7254
 
6897
 module.exports = setupWelcomePage;
7255
 module.exports = setupWelcomePage;
6898
-},{"./RoomnameGenerator":25}],27:[function(require,module,exports){
7256
+},{"./RoomnameGenerator":26}],28:[function(require,module,exports){
6899
 // Copyright Joyent, Inc. and other Node contributors.
7257
 // Copyright Joyent, Inc. and other Node contributors.
6900
 //
7258
 //
6901
 // Permission is hereby granted, free of charge, to any person obtaining a
7259
 // Permission is hereby granted, free of charge, to any person obtaining a

+ 17
- 2
libs/modules/xmpp.bundle.js Visa fil

2807
  */
2807
  */
2808
 var connection = null;
2808
 var connection = null;
2809
 var focusUserJid;
2809
 var focusUserJid;
2810
-var getNextTimeout = Util.createExpBackoffTimer(1000);
2811
-var getNextErrorTimeout = Util.createExpBackoffTimer(1000);
2810
+function createExpBackoffTimer(step) {
2811
+    var count = 1;
2812
+    return function (reset) {
2813
+        // Reset call
2814
+        if (reset) {
2815
+            count = 1;
2816
+            return;
2817
+        }
2818
+        // Calculate next timeout
2819
+        var timeout = Math.pow(2, count - 1);
2820
+        count += 1;
2821
+        return timeout * step;
2822
+    };
2823
+}
2824
+
2825
+var getNextTimeout = createExpBackoffTimer(1000);
2826
+var getNextErrorTimeout = createExpBackoffTimer(1000);
2812
 // External authentication stuff
2827
 // External authentication stuff
2813
 var externalAuthEnabled = false;
2828
 var externalAuthEnabled = false;
2814
 // Sip gateway can be enabled by configuring Jigasi host in config.js or
2829
 // Sip gateway can be enabled by configuring Jigasi host in config.js or

+ 2
- 1
modules/UI/prezi/Prezi.js Visa fil

2
 var UIUtil = require("../util/UIUtil");
2
 var UIUtil = require("../util/UIUtil");
3
 var VideoLayout = require("../videolayout/VideoLayout");
3
 var VideoLayout = require("../videolayout/VideoLayout");
4
 var messageHandler = require("../util/MessageHandler");
4
 var messageHandler = require("../util/MessageHandler");
5
+var PreziPlayer = require("./PreziPlayer");
5
 
6
 
6
 var preziPlayer = null;
7
 var preziPlayer = null;
7
 
8
 
73
                             if (preziUrl.value)
74
                             if (preziUrl.value)
74
                             {
75
                             {
75
                                 var urlValue
76
                                 var urlValue
76
-                                    = encodeURI(Util.escapeHtml(preziUrl.value));
77
+                                    = encodeURI(UIUtil.escapeHtml(preziUrl.value));
77
 
78
 
78
                                 if (urlValue.indexOf('http://prezi.com/') != 0
79
                                 if (urlValue.indexOf('http://prezi.com/') != 0
79
                                     && urlValue.indexOf('https://prezi.com/') != 0)
80
                                     && urlValue.indexOf('https://prezi.com/') != 0)

+ 2
- 0
modules/UI/prezi/PreziPlayer.js Visa fil

289
     })();
289
     })();
290
 
290
 
291
 })();
291
 })();
292
+
293
+module.exports = PreziPlayer;

+ 12
- 11
modules/UI/side_pannels/chat/Chat.js Visa fil

4
 var ToolbarToggler = require("../../toolbars/ToolbarToggler");
4
 var ToolbarToggler = require("../../toolbars/ToolbarToggler");
5
 var smileys = require("./smileys.json").smileys;
5
 var smileys = require("./smileys.json").smileys;
6
 var NicknameHandler = require("../../util/NicknameHandler");
6
 var NicknameHandler = require("../../util/NicknameHandler");
7
+var UIUtil = require("../../util/UIUtil");
7
 
8
 
8
 var notificationInterval = false;
9
 var notificationInterval = false;
9
 var unreadMessages = 0;
10
 var unreadMessages = 0;
28
 
29
 
29
         var chatButtonElement
30
         var chatButtonElement
30
             = document.getElementById('chatButton').parentNode;
31
             = document.getElementById('chatButton').parentNode;
31
-        var leftIndent = (Util.getTextWidth(chatButtonElement) -
32
-            Util.getTextWidth(unreadMsgElement)) / 2;
33
-        var topIndent = (Util.getTextHeight(chatButtonElement) -
34
-            Util.getTextHeight(unreadMsgElement)) / 2 - 3;
32
+        var leftIndent = (UIUtil.getTextWidth(chatButtonElement) -
33
+            UIUtil.getTextWidth(unreadMsgElement)) / 2;
34
+        var topIndent = (UIUtil.getTextHeight(chatButtonElement) -
35
+            UIUtil.getTextHeight(unreadMsgElement)) / 2 - 3;
35
 
36
 
36
         unreadMsgElement.setAttribute(
37
         unreadMsgElement.setAttribute(
37
             'style',
38
             'style',
179
         $('#nickinput').keydown(function (event) {
180
         $('#nickinput').keydown(function (event) {
180
             if (event.keyCode === 13) {
181
             if (event.keyCode === 13) {
181
                 event.preventDefault();
182
                 event.preventDefault();
182
-                var val = Util.escapeHtml(this.value);
183
+                var val = UIUtil.escapeHtml(this.value);
183
                 this.value = '';
184
                 this.value = '';
184
                 if (!NicknameHandler.getNickname()) {
185
                 if (!NicknameHandler.getNickname()) {
185
                     NicknameHandler.setNickname(val);
186
                     NicknameHandler.setNickname(val);
202
                 }
203
                 }
203
                 else
204
                 else
204
                 {
205
                 {
205
-                    var message = Util.escapeHtml(value);
206
+                    var message = UIUtil.escapeHtml(value);
206
                     xmpp.sendChatMessage(message, NicknameHandler.getNickname());
207
                     xmpp.sendChatMessage(message, NicknameHandler.getNickname());
207
                 }
208
                 }
208
             }
209
             }
237
 
238
 
238
             if (!Chat.isVisible()) {
239
             if (!Chat.isVisible()) {
239
                 unreadMessages++;
240
                 unreadMessages++;
240
-                Util.playSoundNotification('chatNotification');
241
+                UIUtil.playSoundNotification('chatNotification');
241
                 setVisualNotification(true);
242
                 setVisualNotification(true);
242
             }
243
             }
243
         }
244
         }
247
         // so we escape here only tags to avoid double &amp;
248
         // so we escape here only tags to avoid double &amp;
248
         var escMessage = message.replace(/</g, '&lt;').
249
         var escMessage = message.replace(/</g, '&lt;').
249
             replace(/>/g, '&gt;').replace(/\n/g, '<br/>');
250
             replace(/>/g, '&gt;').replace(/\n/g, '<br/>');
250
-        var escDisplayName = Util.escapeHtml(displayName);
251
+        var escDisplayName = UIUtil.escapeHtml(displayName);
251
         message = Replacement.processReplacements(escMessage);
252
         message = Replacement.processReplacements(escMessage);
252
 
253
 
253
         var messageContainer =
254
         var messageContainer =
270
      */
271
      */
271
     my.chatAddError = function(errorMessage, originalText)
272
     my.chatAddError = function(errorMessage, originalText)
272
     {
273
     {
273
-        errorMessage = Util.escapeHtml(errorMessage);
274
-        originalText = Util.escapeHtml(originalText);
274
+        errorMessage = UIUtil.escapeHtml(errorMessage);
275
+        originalText = UIUtil.escapeHtml(originalText);
275
 
276
 
276
         $('#chatconversation').append(
277
         $('#chatconversation').append(
277
             '<div class="errorMessage"><b>Error: </b>' + 'Your message' +
278
             '<div class="errorMessage"><b>Error: </b>' + 'Your message' +
290
     {
291
     {
291
         if(subject)
292
         if(subject)
292
             subject = subject.trim();
293
             subject = subject.trim();
293
-        $('#subject').html(Replacement.linkify(Util.escapeHtml(subject)));
294
+        $('#subject').html(Replacement.linkify(UIUtil.escapeHtml(subject)));
294
         if(subject === "")
295
         if(subject === "")
295
         {
296
         {
296
             $("#subject").css({display: "none"});
297
             $("#subject").css({display: "none"});

+ 3
- 1
modules/UI/side_pannels/chat/Commands.js Visa fil

1
+var UIUtil = require("../../util/UIUtil");
2
+
1
 /**
3
 /**
2
  * List with supported commands. The keys are the names of the commands and
4
  * List with supported commands. The keys are the names of the commands and
3
  * the value is the function that processes the message.
5
  * the value is the function that processes the message.
31
  */
33
  */
32
 function processTopic(commandArguments)
34
 function processTopic(commandArguments)
33
 {
35
 {
34
-    var topic = Util.escapeHtml(commandArguments);
36
+    var topic = UIUtil.escapeHtml(commandArguments);
35
     xmpp.setSubject(topic);
37
     xmpp.setSubject(topic);
36
 }
38
 }
37
 
39
 

+ 3
- 2
modules/UI/side_pannels/settings/SettingsMenu.js Visa fil

1
 var Avatar = require("../../avatar/Avatar");
1
 var Avatar = require("../../avatar/Avatar");
2
 var Settings = require("./Settings");
2
 var Settings = require("./Settings");
3
+var UIUtil = require("../../util/UIUtil");
3
 
4
 
4
 
5
 
5
 var SettingsMenu = {
6
 var SettingsMenu = {
6
 
7
 
7
     update: function() {
8
     update: function() {
8
-        var newDisplayName = Util.escapeHtml($('#setDisplayName').get(0).value);
9
-        var newEmail = Util.escapeHtml($('#setEmail').get(0).value);
9
+        var newDisplayName = UIUtil.escapeHtml($('#setDisplayName').get(0).value);
10
+        var newEmail = UIUtil.escapeHtml($('#setEmail').get(0).value);
10
 
11
 
11
         if(newDisplayName) {
12
         if(newDisplayName) {
12
             var displayName = Settings.setDisplayName(newDisplayName);
13
             var displayName = Settings.setDisplayName(newDisplayName);

+ 2
- 2
modules/UI/toolbars/Toolbar.js Visa fil

102
                     var token = document.getElementById('recordingToken');
102
                     var token = document.getElementById('recordingToken');
103
 
103
 
104
                     if (token.value) {
104
                     if (token.value) {
105
-                        callback(Util.escapeHtml(token.value));
105
+                        callback(UIUtil.escapeHtml(token.value));
106
                     }
106
                     }
107
                 }
107
                 }
108
             },
108
             },
321
                             var lockKey = document.getElementById('lockKey');
321
                             var lockKey = document.getElementById('lockKey');
322
 
322
 
323
                             if (lockKey.value) {
323
                             if (lockKey.value) {
324
-                                Toolbar.setSharedKey(Util.escapeHtml(lockKey.value));
324
+                                Toolbar.setSharedKey(UIUtil.escapeHtml(lockKey.value));
325
                                 lockRoom(true);
325
                                 lockRoom(true);
326
                             }
326
                             }
327
                         }
327
                         }

+ 58
- 0
modules/UI/util/UIUtil.js Visa fil

17
      */
17
      */
18
     buttonClick: function(id, classname) {
18
     buttonClick: function(id, classname) {
19
         $(id).toggleClass(classname); // add the class to the clicked element
19
         $(id).toggleClass(classname); // add the class to the clicked element
20
+    },
21
+    /**
22
+     * Returns the text width for the given element.
23
+     *
24
+     * @param el the element
25
+     */
26
+    getTextWidth: function (el) {
27
+        return (el.clientWidth + 1);
28
+    },
29
+
30
+    /**
31
+     * Returns the text height for the given element.
32
+     *
33
+     * @param el the element
34
+     */
35
+    getTextHeight: function (el) {
36
+        return (el.clientHeight + 1);
37
+    },
38
+
39
+    /**
40
+     * Plays the sound given by id.
41
+     *
42
+     * @param id the identifier of the audio element.
43
+     */
44
+    playSoundNotification: function (id) {
45
+        document.getElementById(id).play();
46
+    },
47
+
48
+    /**
49
+     * Escapes the given text.
50
+     */
51
+    escapeHtml: function (unsafeText) {
52
+        return $('<div/>').text(unsafeText).html();
53
+    },
54
+
55
+    imageToGrayScale: function (canvas) {
56
+        var context = canvas.getContext('2d');
57
+        var imgData = context.getImageData(0, 0, canvas.width, canvas.height);
58
+        var pixels  = imgData.data;
59
+
60
+        for (var i = 0, n = pixels.length; i < n; i += 4) {
61
+            var grayscale
62
+                = pixels[i] * .3 + pixels[i+1] * .59 + pixels[i+2] * .11;
63
+            pixels[i  ] = grayscale;        // red
64
+            pixels[i+1] = grayscale;        // green
65
+            pixels[i+2] = grayscale;        // blue
66
+            // pixels[i+3]              is alpha
67
+        }
68
+        // redraw the image in black & white
69
+        context.putImageData(imgData, 0, 0);
70
+    },
71
+
72
+    setTooltip: function (element, tooltipText, position) {
73
+        element.setAttribute("data-content", tooltipText);
74
+        element.setAttribute("data-toggle", "popover");
75
+        element.setAttribute("data-placement", position);
76
+        element.setAttribute("data-html", true);
77
+        element.setAttribute("data-container", "body");
20
     }
78
     }
21
 
79
 
22
 
80
 

+ 6
- 6
modules/UI/videolayout/VideoLayout.js Visa fil

464
 function createEditDisplayNameButton() {
464
 function createEditDisplayNameButton() {
465
     var editButton = document.createElement('a');
465
     var editButton = document.createElement('a');
466
     editButton.className = 'displayname';
466
     editButton.className = 'displayname';
467
-    Util.setTooltip(editButton,
467
+    UIUtil.setTooltip(editButton,
468
         'Click to edit your<br/>display name',
468
         'Click to edit your<br/>display name',
469
         "top");
469
         "top");
470
     editButton.innerHTML = '<i class="fa fa-pencil"></i>';
470
     editButton.innerHTML = '<i class="fa fa-pencil"></i>';
483
     moderatorIndicator.className = 'fa fa-star';
483
     moderatorIndicator.className = 'fa fa-star';
484
     parentElement.appendChild(moderatorIndicator);
484
     parentElement.appendChild(moderatorIndicator);
485
 
485
 
486
-    Util.setTooltip(parentElement,
486
+    UIUtil.setTooltip(parentElement,
487
         "The owner of<br/>this conference",
487
         "The owner of<br/>this conference",
488
         "top");
488
         "top");
489
 }
489
 }
679
             container.id = 'mixedstream';
679
             container.id = 'mixedstream';
680
             container.className = 'videocontainer';
680
             container.className = 'videocontainer';
681
             remotes.appendChild(container);
681
             remotes.appendChild(container);
682
-            Util.playSoundNotification('userJoined');
682
+            UIUtil.playSoundNotification('userJoined');
683
         }
683
         }
684
 
684
 
685
         if (container) {
685
         if (container) {
1201
             // Remove whole container
1201
             // Remove whole container
1202
             container.remove();
1202
             container.remove();
1203
 
1203
 
1204
-            Util.playSoundNotification('userLeft');
1204
+            UIUtil.playSoundNotification('userLeft');
1205
             VideoLayout.resizeThumbnails();
1205
             VideoLayout.resizeThumbnails();
1206
         }
1206
         }
1207
 
1207
 
1406
 
1406
 
1407
                 var mutedIndicator = document.createElement('i');
1407
                 var mutedIndicator = document.createElement('i');
1408
                 mutedIndicator.className = 'icon-camera-disabled';
1408
                 mutedIndicator.className = 'icon-camera-disabled';
1409
-                Util.setTooltip(mutedIndicator,
1409
+                UIUtil.setTooltip(mutedIndicator,
1410
                     "Participant has<br/>stopped the camera.",
1410
                     "Participant has<br/>stopped the camera.",
1411
                     "top");
1411
                     "top");
1412
                 videoMutedSpan.appendChild(mutedIndicator);
1412
                 videoMutedSpan.appendChild(mutedIndicator);
1449
             if(audioMutedSpan.length == 0 ) {
1449
             if(audioMutedSpan.length == 0 ) {
1450
                 audioMutedSpan = document.createElement('span');
1450
                 audioMutedSpan = document.createElement('span');
1451
                 audioMutedSpan.className = 'audioMuted';
1451
                 audioMutedSpan.className = 'audioMuted';
1452
-                Util.setTooltip(audioMutedSpan,
1452
+                UIUtil.setTooltip(audioMutedSpan,
1453
                     "Participant is muted",
1453
                     "Participant is muted",
1454
                     "top");
1454
                     "top");
1455
 
1455
 

+ 17
- 2
modules/xmpp/moderator.js Visa fil

6
  */
6
  */
7
 var connection = null;
7
 var connection = null;
8
 var focusUserJid;
8
 var focusUserJid;
9
-var getNextTimeout = Util.createExpBackoffTimer(1000);
10
-var getNextErrorTimeout = Util.createExpBackoffTimer(1000);
9
+function createExpBackoffTimer(step) {
10
+    var count = 1;
11
+    return function (reset) {
12
+        // Reset call
13
+        if (reset) {
14
+            count = 1;
15
+            return;
16
+        }
17
+        // Calculate next timeout
18
+        var timeout = Math.pow(2, count - 1);
19
+        count += 1;
20
+        return timeout * step;
21
+    };
22
+}
23
+
24
+var getNextTimeout = createExpBackoffTimer(1000);
25
+var getNextErrorTimeout = createExpBackoffTimer(1000);
11
 // External authentication stuff
26
 // External authentication stuff
12
 var externalAuthEnabled = false;
27
 var externalAuthEnabled = false;
13
 // Sip gateway can be enabled by configuring Jigasi host in config.js or
28
 // Sip gateway can be enabled by configuring Jigasi host in config.js or

+ 0
- 91
util.js Visa fil

1
-/* global $ */
2
-/**
3
- * Utility functions.
4
- */
5
-var Util = (function (my) {
6
-
7
-    /**
8
-     * Returns the text width for the given element.
9
-     *
10
-     * @param el the element
11
-     */
12
-    my.getTextWidth = function (el) {
13
-        return (el.clientWidth + 1);
14
-    };
15
-
16
-    /**
17
-     * Returns the text height for the given element.
18
-     *
19
-     * @param el the element
20
-     */
21
-    my.getTextHeight = function (el) {
22
-        return (el.clientHeight + 1);
23
-    };
24
-
25
-    /**
26
-     * Casts the given number to integer.
27
-     *
28
-     * @param number the number to cast
29
-     */
30
-    my.toInteger = function (number) {
31
-        return Math.round(Number(number));
32
-    };
33
-
34
-    /**
35
-     * Plays the sound given by id.
36
-     *
37
-     * @param id the identifier of the audio element.
38
-     */
39
-    my.playSoundNotification = function (id) {
40
-        document.getElementById(id).play();
41
-    };
42
-
43
-    /**
44
-     * Escapes the given text.
45
-     */
46
-    my.escapeHtml = function (unsafeText) {
47
-        return $('<div/>').text(unsafeText).html();
48
-    };
49
-
50
-    my.imageToGrayScale = function (canvas) {
51
-        var context = canvas.getContext('2d');
52
-        var imgData = context.getImageData(0, 0, canvas.width, canvas.height);
53
-        var pixels  = imgData.data;
54
-
55
-        for (var i = 0, n = pixels.length; i < n; i += 4) {
56
-            var grayscale
57
-                = pixels[i] * .3 + pixels[i+1] * .59 + pixels[i+2] * .11;
58
-            pixels[i  ] = grayscale;        // red
59
-            pixels[i+1] = grayscale;        // green
60
-            pixels[i+2] = grayscale;        // blue
61
-            // pixels[i+3]              is alpha
62
-        }
63
-        // redraw the image in black & white
64
-        context.putImageData(imgData, 0, 0);
65
-    };
66
-
67
-    my.setTooltip = function (element, tooltipText, position) {
68
-        element.setAttribute("data-content", tooltipText);
69
-        element.setAttribute("data-toggle", "popover");
70
-        element.setAttribute("data-placement", position);
71
-        element.setAttribute("data-html", true);
72
-        element.setAttribute("data-container", "body");
73
-    };
74
-
75
-    my.createExpBackoffTimer = function (step) {
76
-        var count = 1;
77
-        return function (reset) {
78
-            // Reset call
79
-            if (reset) {
80
-                count = 1;
81
-                return;
82
-            }
83
-            // Calculate next timeout
84
-            var timeout = Math.pow(2, count - 1);
85
-            count += 1;
86
-            return timeout * step;
87
-        };
88
-    };
89
-
90
-    return my;
91
-}(Util || {}));

Laddar…
Avbryt
Spara