From 9f8bb75f21d284f7c28dc16edd606a405cac1d6f Mon Sep 17 00:00:00 2001 From: Simon Eisenmann Date: Fri, 14 Nov 2014 12:16:16 +0100 Subject: [PATCH] Fixed JSHint errors and warnings. --- static/js/controllers/chatroomcontroller.js | 2 +- static/js/controllers/mediastreamcontroller.js | 6 +++--- static/js/directives/buddypicturecapture.js | 6 +++--- static/js/directives/chat.js | 2 +- static/js/directives/fileinfo.js | 2 +- static/js/directives/roombar.js | 2 +- static/js/directives/screenshare.js | 1 - static/js/directives/youtubevideo.js | 8 ++------ static/js/main.js | 10 +++++----- static/js/mediastream/connector.js | 2 +- static/js/mediastream/peerconference.js | 2 +- static/js/mediastream/peerconnection.js | 6 +++--- static/js/mediastream/tokens.js | 8 ++++---- static/js/mediastream/usermedia.js | 6 +++--- static/js/mediastream/utils.js | 2 +- static/js/mediastream/webrtc.js | 8 ++++---- static/js/services/buddydata.js | 2 +- static/js/services/buddylist.js | 2 +- static/js/services/buddypicture.js | 2 +- static/js/services/contactdata.js | 2 +- static/js/services/contacts.js | 4 ++-- static/js/services/desktopnotify.js | 14 +++++++------- static/js/services/filedata.js | 6 +++--- static/js/services/localstatus.js | 2 +- static/js/services/mediasources.js | 16 ++++++++-------- static/js/services/mediastream.js | 3 ++- 26 files changed, 61 insertions(+), 65 deletions(-) diff --git a/static/js/controllers/chatroomcontroller.js b/static/js/controllers/chatroomcontroller.js index 7e37e1e0..f5d56a5e 100644 --- a/static/js/controllers/chatroomcontroller.js +++ b/static/js/controllers/chatroomcontroller.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['underscore', 'moment', 'text!partials/fileinfo.html', 'text!partials/contactrequest.html', 'text!partials/geolocation.html'], function(_, moment, templateFileInfo, templateContactRequest, templateGeolocation) { +define(['jquery', 'underscore', 'moment', 'text!partials/fileinfo.html', 'text!partials/contactrequest.html', 'text!partials/geolocation.html'], function($, _, moment, templateFileInfo, templateContactRequest, templateGeolocation) { // ChatroomController return ["$scope", "$element", "$window", "safeMessage", "safeDisplayName", "$compile", "$filter", "translation", function($scope, $element, $window, safeMessage, safeDisplayName, $compile, $filter, translation) { diff --git a/static/js/controllers/mediastreamcontroller.js b/static/js/controllers/mediastreamcontroller.js index 7e639f32..17b4e0f4 100644 --- a/static/js/controllers/mediastreamcontroller.js +++ b/static/js/controllers/mediastreamcontroller.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'webrtc.adapter'], function(_, BigScreen, moment, sjcl, Modernizr) { +define(['jquery', 'underscore', 'angular', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'webrtc.adapter'], function($, _, angular, BigScreen, moment, sjcl, Modernizr) { return ["$scope", "$rootScope", "$element", "$window", "$timeout", "safeDisplayName", "safeApply", "mediaStream", "appData", "playSound", "desktopNotify", "alertify", "toastr", "translation", "fileDownload", "localStorage", "screensharing", "userSettingsData", "localStatus", "dialogs", "rooms", function($scope, $rootScope, $element, $window, $timeout, safeDisplayName, safeApply, mediaStream, appData, playSound, desktopNotify, alertify, toastr, translation, fileDownload, localStorage, screensharing, userSettingsData, localStatus, dialogs, rooms) { @@ -225,13 +225,13 @@ define(['underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'webrtc.adapte var iceServers = []; var iceServer; if ($scope.stun.length) { - iceServer = createIceServers($scope.stun); + iceServer = $window.createIceServers($scope.stun); if (iceServer.length) { iceServers.push.apply(iceServers, iceServer); } } if ($scope.turn.urls && $scope.turn.urls.length) { - iceServer = createIceServers($scope.turn.urls, $scope.turn.username, $scope.turn.password); + iceServer = $window.createIceServers($scope.turn.urls, $scope.turn.username, $scope.turn.password); if (iceServer.length) { iceServers.push.apply(iceServers, iceServer); } diff --git a/static/js/directives/buddypicturecapture.js b/static/js/directives/buddypicturecapture.js index a0657c64..0e96a856 100644 --- a/static/js/directives/buddypicturecapture.js +++ b/static/js/directives/buddypicturecapture.js @@ -21,7 +21,7 @@ define(['jquery', 'underscore', 'text!partials/buddypicturecapture.html'], function($, _, template) { // buddyPictureCapture - return ["$compile", function($compile) { + return ["$compile", "$window", function($compile, $window) { var controller = ['$scope', 'safeApply', '$timeout', '$q', function($scope, safeApply, $timeout, $q) { @@ -124,13 +124,13 @@ define(['jquery', 'underscore', 'text!partials/buddypicturecapture.html'], funct }] }; } - getUserMedia({ + $window.getUserMedia({ video: videoConstraints }, function(stream) { $scope.showTakePicture = true; localStream = stream; $scope.waitingForPermission = false; - attachMediaStream($scope.video, stream); + $window.attachMediaStream($scope.video, stream); safeApply($scope); videoAllowed.resolve(true); }, function(error) { diff --git a/static/js/directives/chat.js b/static/js/directives/chat.js index dcbf0a06..489b644e 100644 --- a/static/js/directives/chat.js +++ b/static/js/directives/chat.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'], function(_, templateChat, templateChatroom) { +define(['jquery', 'underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'], function($, _, templateChat, templateChatroom) { return ["$compile", "safeDisplayName", "mediaStream", "safeApply", "desktopNotify", "translation", "playSound", "fileUpload", "randomGen", "buddyData", "appData", "$timeout", "geolocation", function($compile, safeDisplayName, mediaStream, safeApply, desktopNotify, translation, playSound, fileUpload, randomGen, buddyData, appData, $timeout, geolocation) { diff --git a/static/js/directives/fileinfo.js b/static/js/directives/fileinfo.js index d661ca24..8a862f9d 100644 --- a/static/js/directives/fileinfo.js +++ b/static/js/directives/fileinfo.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['jquery', 'underscore'], function($, _) { +define(['jquery', 'underscore', 'moment'], function($, _, moment) { return ["fileData", "fileUpload", "fileDownload", "mediaStream", "$window", "alertify", "translation", function(fileData, fileUpload, fileDownload, mediaStream, $window, alertify, translation) { diff --git a/static/js/directives/roombar.js b/static/js/directives/roombar.js index 2ab20274..ebe0f90b 100644 --- a/static/js/directives/roombar.js +++ b/static/js/directives/roombar.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['underscore', 'text!partials/roombar.html'], function(_, template) { +define(['underscore', 'angular', 'text!partials/roombar.html'], function(_, angular, template) { // roomBar return ["$window", "rooms", function($window, rooms) { diff --git a/static/js/directives/screenshare.js b/static/js/directives/screenshare.js index 06017928..a4ece18a 100644 --- a/static/js/directives/screenshare.js +++ b/static/js/directives/screenshare.js @@ -246,7 +246,6 @@ define(['jquery', 'underscore', 'text!partials/screenshare.html', 'text!partials mediaStream.tokens.off(token, handler); mediaStream.webrtc.e.off("statechange", updater); handler = null; - updated = null; // Send by to all connected peers. _.each(screenshares, function(peerscreenshare) { peerscreenshare.send({ diff --git a/static/js/directives/youtubevideo.js b/static/js/directives/youtubevideo.js index 772d27db..a3de19fa 100644 --- a/static/js/directives/youtubevideo.js +++ b/static/js/directives/youtubevideo.js @@ -273,7 +273,7 @@ define(['jquery', 'underscore', 'text!partials/youtubevideo.html', 'bigscreen'], isYouTubeIframeAPIReady.done(function() { if (!player) { var origin = $window.location.protocol + "//" + $window.location.host; - player = new YT.Player("youtubeplayer", { + player = new $window.YT.Player("youtubeplayer", { height: "390", width: "640", playerVars: { @@ -563,11 +563,7 @@ define(['jquery', 'underscore', 'text!partials/youtubevideo.html', 'bigscreen'], $scope.toggleFullscreen = function(elem) { if (BigScreen.enabled) { - if (elem) { - BigScreen.toggle(elem); - } else { - BigScreen.toggle(pane.get(0)); - } + BigScreen.toggle(elem); } }; diff --git a/static/js/main.js b/static/js/main.js index 91bbe9fb..f6e5ee56 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -123,9 +123,9 @@ require.config({ exports: 'odf', init: function() { return { - webodf: webodf, - odf: odf, - runtime: runtime + webodf: this.webodf, + odf: this.odf, + runtime: this.runtime }; } }, @@ -171,7 +171,7 @@ require.onError = (function() { return; } if (err.requireType === "timeout" || err.requireType === "scripterror") { - alert('Failed to load application. Confirm to retry.'); + window.alert('Failed to load application. Confirm to retry.'); retrying = true; document.location.reload(true); } else { @@ -274,5 +274,5 @@ if (Object.create) { }); } else { - alert("Your browser does not support this application. Please update your browser to the latest version."); + window.alert("Your browser does not support this application. Please update your browser to the latest version."); } diff --git a/static/js/mediastream/connector.js b/static/js/mediastream/connector.js index d216dc9d..8d56c535 100644 --- a/static/js/mediastream/connector.js +++ b/static/js/mediastream/connector.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['jquery', 'underscore'], function($, _, uaparser) { +define(['jquery', 'underscore'], function($, _) { var timeout = 5000; var timeout_max = 20000; diff --git a/static/js/mediastream/peerconference.js b/static/js/mediastream/peerconference.js index b1a450c3..fbf97bb9 100644 --- a/static/js/mediastream/peerconference.js +++ b/static/js/mediastream/peerconference.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['underscore', 'mediastream/peercall'], function(_, PeerCall) { +define(['jquery', 'underscore', 'mediastream/peercall'], function($, _, PeerCall) { //NOTE(longsleep): This id should be changed to something undeterministic. var conferences = 0; diff --git a/static/js/mediastream/peerconnection.js b/static/js/mediastream/peerconnection.js index 02674cba..4cf1721f 100644 --- a/static/js/mediastream/peerconnection.js +++ b/static/js/mediastream/peerconnection.js @@ -54,7 +54,7 @@ define(['jquery', 'underscore', 'webrtc.adapter'], function($, _) { console.log('Creating RTCPeerConnnection with:\n' + ' config: \'' + JSON.stringify(currentcall.pcConfig) + '\';\n' + ' constraints: \'' + JSON.stringify(currentcall.pcConstraints) + '\'.'); - pc = this.pc = new RTCPeerConnection(currentcall.pcConfig, currentcall.pcConstraints); + pc = this.pc = new window.RTCPeerConnection(currentcall.pcConfig, currentcall.pcConstraints); } catch (e) { console.error('Failed to create PeerConnection, exception: ' + e.message); pc = this.pc = null; @@ -70,7 +70,7 @@ define(['jquery', 'underscore', 'webrtc.adapter'], function($, _) { // for example https://bugzilla.mozilla.org/show_bug.cgi?id=998546. pc.onaddstream = _.bind(this.onRemoteStreamAdded, this); pc.onremovestream = _.bind(this.onRemoteStreamRemoved, this); - if (webrtcDetectedBrowser === "firefox") { + if (window.webrtcDetectedBrowser === "firefox") { // NOTE(longsleep): onnegotiationneeded is not supported by Firefox. We trigger it // manually when a stream is added or removed. // https://bugzilla.mozilla.org/show_bug.cgi?id=840728 @@ -103,7 +103,7 @@ define(['jquery', 'underscore', 'webrtc.adapter'], function($, _) { // Create default data channel when we are in initiate mode. if (currentcall.initiate) { - if (webrtcDetectedBrowser !== "chrome" || !webrtcDetectedAndroid || (webrtcDetectedBrowser === "chrome" && webrtcDetectedVersion >= 33)) { + if (window.webrtcDetectedBrowser !== "chrome" || !window.webrtcDetectedAndroid || (window.webrtcDetectedBrowser === "chrome" && window.webrtcDetectedVersion >= 33)) { // NOTE(longsleep): Android (Chrome 32) does have broken SCTP data channels // which makes connection fail because of sdp set error for answer/offer. // See https://code.google.com/p/webrtc/issues/detail?id=2253 Lets hope the diff --git a/static/js/mediastream/tokens.js b/static/js/mediastream/tokens.js index 30747cb1..914f6fe7 100644 --- a/static/js/mediastream/tokens.js +++ b/static/js/mediastream/tokens.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['jquery', 'underscore'], function(jquery, _) { +define(['jquery', 'underscore'], function($, _) { var Token = function(handlerKey) { this.e = $({}); @@ -147,7 +147,7 @@ define(['jquery', 'underscore'], function(jquery, _) { // Set message implementation. handler.messageHandler = _.bind(obj.trigger, obj); } - handler.setRemoteDescription(new RTCSessionDescription(data), _.bind(function() { + handler.setRemoteDescription(new window.RTCSessionDescription(data), _.bind(function() { handler.createAnswer(_.bind(function(sessionDescription, currenthandler) { //console.log("Sending handler answer", sessionDescription, currenthandler.id); webrtc.api.sendAnswer(from, sessionDescription); @@ -159,10 +159,10 @@ define(['jquery', 'underscore'], function(jquery, _) { if (!handler.messageHandler) { handler.messageHandler = _.bind(obj.trigger, obj); } - handler.setRemoteDescription(new RTCSessionDescription(data)); + handler.setRemoteDescription(new window.RTCSessionDescription(data)); break; case "Candidate": - var candidate = new RTCIceCandidate({ + var candidate = new window.RTCIceCandidate({ sdpMLineIndex: data.sdpMLineIndex, sdpMid: data.sdpMid, candidate: data.candidate diff --git a/static/js/mediastream/usermedia.js b/static/js/mediastream/usermedia.js index 9b225631..47207b2c 100644 --- a/static/js/mediastream/usermedia.js +++ b/static/js/mediastream/usermedia.js @@ -126,7 +126,7 @@ define(['jquery', 'underscore', 'audiocontext', 'webrtc.adapter'], function($, _ error_cb.apply(this, args); }; try { - getUserMedia({ + window.getUserMedia({ video: true, audio: true }, success_helper, error_helper); @@ -171,7 +171,7 @@ define(['jquery', 'underscore', 'audiocontext', 'webrtc.adapter'], function($, _ try { console.log('Requesting access to local media with mediaConstraints:\n' + ' \'' + JSON.stringify(constraints) + '\'', constraints); - getUserMedia(constraints, _.bind(this.onUserMediaSuccess, this), _.bind(this.onUserMediaError, this)); + window.getUserMedia(constraints, _.bind(this.onUserMediaSuccess, this), _.bind(this.onUserMediaError, this)); this.started = true; return true; } catch (e) { @@ -390,7 +390,7 @@ define(['jquery', 'underscore', 'audiocontext', 'webrtc.adapter'], function($, _ UserMedia.prototype.attachMediaStream = function(video) { - attachMediaStream(video, this.localStream); + window.attachMediaStream(video, this.localStream); }; diff --git a/static/js/mediastream/utils.js b/static/js/mediastream/utils.js index af6a223c..fa035955 100644 --- a/static/js/mediastream/utils.js +++ b/static/js/mediastream/utils.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['jquery', 'underscore'], function($, _) { +define([], function() { var Utils = function() {} diff --git a/static/js/mediastream/webrtc.js b/static/js/mediastream/webrtc.js index 97c7f069..3aed21c7 100644 --- a/static/js/mediastream/webrtc.js +++ b/static/js/mediastream/webrtc.js @@ -237,7 +237,7 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u targetcall = this.findTargetCall(from); if (targetcall) { // Hey we know this call. - targetcall.setRemoteDescription(new RTCSessionDescription(data), _.bind(function(sessionDescription, currentcall) { + targetcall.setRemoteDescription(new window.RTCSessionDescription(data), _.bind(function(sessionDescription, currentcall) { if (currentcall === this.currentcall) { // Main call. this.e.triggerHandler("peercall", [this.currentcall]); @@ -253,7 +253,7 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u console.log("Received conference Offer -> auto.", from, data._conference); // Clean own internal data before feeding into browser. delete data._conference; - this.currentconference.autoAnswer(from, new RTCSessionDescription(data)); + this.currentconference.autoAnswer(from, new window.RTCSessionDescription(data)); break; } // Cannot do anything with this offer, reply with busy. @@ -268,7 +268,7 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u console.warn("Received Candidate for unknown id -> ignore.", from); return; } - var candidate = new RTCIceCandidate({ + var candidate = new window.RTCIceCandidate({ sdpMLineIndex: data.sdpMLineIndex, sdpMid: data.sdpMid, candidate: data.candidate @@ -288,7 +288,7 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u } // TODO(longsleep): In case of negotiation this could switch offer and answer // and result in a offer sdp sent as answer data. We need to handle this. - targetcall.setRemoteDescription(new RTCSessionDescription(data), function() { + targetcall.setRemoteDescription(new window.RTCSessionDescription(data), function() { // Received remote description as answer. console.log("Received answer after we sent offer", data); }); diff --git a/static/js/services/buddydata.js b/static/js/services/buddydata.js index c8f4db1b..24438af3 100644 --- a/static/js/services/buddydata.js +++ b/static/js/services/buddydata.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['underscore'], function(underscore) { +define(['underscore'], function(_) { // buddyData return ["appData", "contactData", "mediaStream", "$rootScope", function(appData, contactData, mediaStream, $rootScope) { diff --git a/static/js/services/buddylist.js b/static/js/services/buddylist.js index d2071ab5..b8ee2ccb 100644 --- a/static/js/services/buddylist.js +++ b/static/js/services/buddylist.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['angular', 'underscore', 'modernizr', 'avltree', 'text!partials/buddy.html', 'text!partials/buddyactions.html', 'text!partials/buddyactionsforaudiomixer.html'], function(angular, _, Modernizr, AvlTree, templateBuddy, templateBuddyActions, templateBuddyActionsForAudioMixer) { +define(['jquery', 'angular', 'underscore', 'modernizr', 'avltree', 'text!partials/buddy.html', 'text!partials/buddyactions.html', 'text!partials/buddyactionsforaudiomixer.html'], function($, angular, _, Modernizr, AvlTree, templateBuddy, templateBuddyActions, templateBuddyActionsForAudioMixer) { var BuddyTree = function() { diff --git a/static/js/services/buddypicture.js b/static/js/services/buddypicture.js index b426ac46..a4596a4b 100644 --- a/static/js/services/buddypicture.js +++ b/static/js/services/buddypicture.js @@ -19,7 +19,7 @@ * */ - define(['underscore'], function(underscore) { + define([], function() { // buddyPicture return ["$window", "restURL", function($window, restURL) { diff --git a/static/js/services/contactdata.js b/static/js/services/contactdata.js index 5f6074af..7ebddef2 100644 --- a/static/js/services/contactdata.js +++ b/static/js/services/contactdata.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['underscore', 'jquery'], function(underscore, $) { +define(['underscore', 'jquery'], function(_, $) { // contactData return [function() { diff --git a/static/js/services/contacts.js b/static/js/services/contacts.js index efe49078..58c71068 100644 --- a/static/js/services/contacts.js +++ b/static/js/services/contacts.js @@ -26,7 +26,7 @@ define(['underscore', 'jquery', 'modernizr', 'sjcl', 'text!partials/contactsmana this.db = null; this.name = name; this.e = $({}); - var request = indexedDB.open(this.name, this.version); + var request = window.indexedDB.open(this.name, this.version); var that = this; request.onupgradeneeded = function(event) { var db = event.target.result; @@ -90,7 +90,7 @@ define(['underscore', 'jquery', 'modernizr', 'sjcl', 'text!partials/contactsmana Database.prototype.all = function(storename, iteratorCallback, errorCallback) { var transaction = this.db.transaction(storename); var store = transaction.objectStore(storename); - var keyRange = IDBKeyRange.lowerBound(0); + var keyRange = window.IDBKeyRange.lowerBound(0); var cursorRequest = store.openCursor(keyRange); cursorRequest.onsuccess = function(event) { var result = event.target.result; diff --git a/static/js/services/desktopnotify.js b/static/js/services/desktopnotify.js index 64b2d5bc..72d88ef5 100644 --- a/static/js/services/desktopnotify.js +++ b/static/js/services/desktopnotify.js @@ -35,7 +35,7 @@ define(['jquery', 'underscore', 'desktop-notify'], function($, _, notify) { var helper = notify; - var desktopNotify = function() { + var DesktopNotify = function() { this.asked = false; this.windowHasFocus = true; @@ -51,7 +51,7 @@ define(['jquery', 'underscore', 'desktop-notify'], function($, _, notify) { }; - desktopNotify.prototype.enabled = function() { + DesktopNotify.prototype.enabled = function() { if (this.level === "default") { this.asked = true; @@ -61,14 +61,14 @@ define(['jquery', 'underscore', 'desktop-notify'], function($, _, notify) { }; - desktopNotify.prototype.refresh = function() { + DesktopNotify.prototype.refresh = function() { this.supported = helper.isSupported; this.level = helper.permissionLevel(); }; - desktopNotify.prototype.requestPermission = function(cb) { + DesktopNotify.prototype.requestPermission = function(cb) { //console.log("request permission"); return helper.requestPermission(_.bind(function() { @@ -83,13 +83,13 @@ define(['jquery', 'underscore', 'desktop-notify'], function($, _, notify) { }; - desktopNotify.prototype.createNotification = function(title, options) { + DesktopNotify.prototype.createNotification = function(title, options) { return helper.createNotification(title, options); }; - desktopNotify.prototype.notify = function(title, body, options) { + DesktopNotify.prototype.notify = function(title, body, options) { if (!this.enabled()) { return this.dummy; @@ -113,7 +113,7 @@ define(['jquery', 'underscore', 'desktop-notify'], function($, _, notify) { }; - return new desktopNotify(); + return new DesktopNotify(); }]; diff --git a/static/js/services/filedata.js b/static/js/services/filedata.js index 289a4fa5..5d464e22 100644 --- a/static/js/services/filedata.js +++ b/static/js/services/filedata.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(["jquery", "underscore", "sha", "webrtc.adapter"], function($, _, jsSHA) { +define(["jquery", "underscore", "sha", "webrtc.adapter"], function($, _, JsSHA) { var requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem || null; if (!requestFileSystem) { @@ -27,7 +27,7 @@ define(["jquery", "underscore", "sha", "webrtc.adapter"], function($, _, jsSHA) // NOTE(longsleep): A single chunk is 60k - https://code.google.com/p/webrtc/issues/detail?id=2270 // also Firefox does only support 16k maximum sents. See https://code.google.com/p/webrtc/issues/detail?id=2279. - var fileChunkSize = webrtcDetectedBrowser === "chrome" ? 60000 : 16000; + var fileChunkSize = window.webrtcDetectedBrowser === "chrome" ? 60000 : 16000; // Fake implementation for browsers which do not support FileSystem API. var FileWriterFake = function(owner) { @@ -423,7 +423,7 @@ define(["jquery", "underscore", "sha", "webrtc.adapter"], function($, _, jsSHA) }, createFile: function(namespace, data) { var id = namespace + "_" + (fileCount++); - var shaObj = new jsSHA(id, "TEXT"); + var shaObj = new JsSHA(id, "TEXT"); var token = shaObj.getHMAC(randomSecret, "TEXT", "SHA-384", "HEX"); var file = filesTable[token] = new File(token, data); return file; diff --git a/static/js/services/localstatus.js b/static/js/services/localstatus.js index 08a0eefb..0fd379a1 100644 --- a/static/js/services/localstatus.js +++ b/static/js/services/localstatus.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['angular', 'underscore'], function(angular, underscore) { +define(['angular', 'underscore'], function(angular, _) { // localStatus return ["mediaStream", "$window", function(mediaStream, $window) { diff --git a/static/js/services/mediasources.js b/static/js/services/mediasources.js index 0eb8b46f..85aae1fe 100644 --- a/static/js/services/mediasources.js +++ b/static/js/services/mediasources.js @@ -22,15 +22,15 @@ define(['jquery', 'underscore'], function($, _) { return ["$window", function($window) { - var mediaSources = function() { + var MediaSources = function() { - this.supported = window.MediaStreamTrack && window.MediaStreamTrack.getSources + this.supported = $window.MediaStreamTrack && $window.MediaStreamTrack.getSources this.audio = []; this.video = []; }; - mediaSources.prototype.refresh = function(cb) { + MediaSources.prototype.refresh = function(cb) { if (!this.supported) { if (cb) { @@ -53,9 +53,9 @@ define(['jquery', 'underscore'], function($, _) { }; - mediaSources.prototype._refresh = function(cb) { + MediaSources.prototype._refresh = function(cb) { - MediaStreamTrack.getSources(_.bind(function(sources) { + $window.MediaStreamTrack.getSources(_.bind(function(sources) { var audio = this.audio = []; var video = this.video = []; _.each(sources, function(source) { @@ -78,7 +78,7 @@ define(['jquery', 'underscore'], function($, _) { }; - mediaSources.prototype.hasAudioId = function(id) { + MediaSources.prototype.hasAudioId = function(id) { var i; for (i = 0; i < this.audio.length; i++) { @@ -90,7 +90,7 @@ define(['jquery', 'underscore'], function($, _) { }; - mediaSources.prototype.hasVideoId = function(id) { + MediaSources.prototype.hasVideoId = function(id) { var i; for (i = 0; i < this.video.length; i++) { @@ -103,7 +103,7 @@ define(['jquery', 'underscore'], function($, _) { }; - return new mediaSources(); + return new MediaSources(); }]; diff --git a/static/js/services/mediastream.js b/static/js/services/mediastream.js index 238c6e26..e5e4c2e7 100644 --- a/static/js/services/mediastream.js +++ b/static/js/services/mediastream.js @@ -22,10 +22,11 @@ define([ 'jquery', 'underscore', 'ua-parser', + 'sjcl', 'modernizr', 'mediastream/tokens' -], function($, _, uaparser, Modernizr, tokens) { +], function($, _, uaparser, sjcl, Modernizr, tokens) { return ["globalContext", "connector", "api", "webrtc", "$rootScope", "$route", "$location", "$window", "visibility", "alertify", "$http", "safeApply", "$timeout", "$sce", "localStorage", "continueConnector", "restURL", function(context, connector, api, webrtc, $rootScope, $route, $location, $window, visibility, alertify, $http, safeApply, $timeout, $sce, localStorage, continueConnector, restURL) {