Browse Source

Fixed JSHint errors and warnings.

pull/145/head
Simon Eisenmann 11 years ago
parent
commit
9f8bb75f21
  1. 2
      static/js/controllers/chatroomcontroller.js
  2. 6
      static/js/controllers/mediastreamcontroller.js
  3. 6
      static/js/directives/buddypicturecapture.js
  4. 2
      static/js/directives/chat.js
  5. 2
      static/js/directives/fileinfo.js
  6. 2
      static/js/directives/roombar.js
  7. 1
      static/js/directives/screenshare.js
  8. 6
      static/js/directives/youtubevideo.js
  9. 10
      static/js/main.js
  10. 2
      static/js/mediastream/connector.js
  11. 2
      static/js/mediastream/peerconference.js
  12. 6
      static/js/mediastream/peerconnection.js
  13. 8
      static/js/mediastream/tokens.js
  14. 6
      static/js/mediastream/usermedia.js
  15. 2
      static/js/mediastream/utils.js
  16. 8
      static/js/mediastream/webrtc.js
  17. 2
      static/js/services/buddydata.js
  18. 2
      static/js/services/buddylist.js
  19. 2
      static/js/services/buddypicture.js
  20. 2
      static/js/services/contactdata.js
  21. 4
      static/js/services/contacts.js
  22. 14
      static/js/services/desktopnotify.js
  23. 6
      static/js/services/filedata.js
  24. 2
      static/js/services/localstatus.js
  25. 16
      static/js/services/mediasources.js
  26. 3
      static/js/services/mediastream.js

2
static/js/controllers/chatroomcontroller.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
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 // ChatroomController
return ["$scope", "$element", "$window", "safeMessage", "safeDisplayName", "$compile", "$filter", "translation", function($scope, $element, $window, safeMessage, safeDisplayName, $compile, $filter, translation) { return ["$scope", "$element", "$window", "safeMessage", "safeDisplayName", "$compile", "$filter", "translation", function($scope, $element, $window, safeMessage, safeDisplayName, $compile, $filter, translation) {

6
static/js/controllers/mediastreamcontroller.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
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) { 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 iceServers = [];
var iceServer; var iceServer;
if ($scope.stun.length) { if ($scope.stun.length) {
iceServer = createIceServers($scope.stun); iceServer = $window.createIceServers($scope.stun);
if (iceServer.length) { if (iceServer.length) {
iceServers.push.apply(iceServers, iceServer); iceServers.push.apply(iceServers, iceServer);
} }
} }
if ($scope.turn.urls && $scope.turn.urls.length) { 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) { if (iceServer.length) {
iceServers.push.apply(iceServers, iceServer); iceServers.push.apply(iceServers, iceServer);
} }

6
static/js/directives/buddypicturecapture.js

@ -21,7 +21,7 @@
define(['jquery', 'underscore', 'text!partials/buddypicturecapture.html'], function($, _, template) { define(['jquery', 'underscore', 'text!partials/buddypicturecapture.html'], function($, _, template) {
// buddyPictureCapture // buddyPictureCapture
return ["$compile", function($compile) { return ["$compile", "$window", function($compile, $window) {
var controller = ['$scope', 'safeApply', '$timeout', '$q', function($scope, safeApply, $timeout, $q) { 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 video: videoConstraints
}, function(stream) { }, function(stream) {
$scope.showTakePicture = true; $scope.showTakePicture = true;
localStream = stream; localStream = stream;
$scope.waitingForPermission = false; $scope.waitingForPermission = false;
attachMediaStream($scope.video, stream); $window.attachMediaStream($scope.video, stream);
safeApply($scope); safeApply($scope);
videoAllowed.resolve(true); videoAllowed.resolve(true);
}, function(error) { }, function(error) {

2
static/js/directives/chat.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
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) { 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) {

2
static/js/directives/fileinfo.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
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) { return ["fileData", "fileUpload", "fileDownload", "mediaStream", "$window", "alertify", "translation", function(fileData, fileUpload, fileDownload, mediaStream, $window, alertify, translation) {

2
static/js/directives/roombar.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
define(['underscore', 'text!partials/roombar.html'], function(_, template) { define(['underscore', 'angular', 'text!partials/roombar.html'], function(_, angular, template) {
// roomBar // roomBar
return ["$window", "rooms", function($window, rooms) { return ["$window", "rooms", function($window, rooms) {

1
static/js/directives/screenshare.js

@ -246,7 +246,6 @@ define(['jquery', 'underscore', 'text!partials/screenshare.html', 'text!partials
mediaStream.tokens.off(token, handler); mediaStream.tokens.off(token, handler);
mediaStream.webrtc.e.off("statechange", updater); mediaStream.webrtc.e.off("statechange", updater);
handler = null; handler = null;
updated = null;
// Send by to all connected peers. // Send by to all connected peers.
_.each(screenshares, function(peerscreenshare) { _.each(screenshares, function(peerscreenshare) {
peerscreenshare.send({ peerscreenshare.send({

6
static/js/directives/youtubevideo.js

@ -273,7 +273,7 @@ define(['jquery', 'underscore', 'text!partials/youtubevideo.html', 'bigscreen'],
isYouTubeIframeAPIReady.done(function() { isYouTubeIframeAPIReady.done(function() {
if (!player) { if (!player) {
var origin = $window.location.protocol + "//" + $window.location.host; var origin = $window.location.protocol + "//" + $window.location.host;
player = new YT.Player("youtubeplayer", { player = new $window.YT.Player("youtubeplayer", {
height: "390", height: "390",
width: "640", width: "640",
playerVars: { playerVars: {
@ -563,11 +563,7 @@ define(['jquery', 'underscore', 'text!partials/youtubevideo.html', 'bigscreen'],
$scope.toggleFullscreen = function(elem) { $scope.toggleFullscreen = function(elem) {
if (BigScreen.enabled) { if (BigScreen.enabled) {
if (elem) {
BigScreen.toggle(elem); BigScreen.toggle(elem);
} else {
BigScreen.toggle(pane.get(0));
}
} }
}; };

10
static/js/main.js

@ -123,9 +123,9 @@ require.config({
exports: 'odf', exports: 'odf',
init: function() { init: function() {
return { return {
webodf: webodf, webodf: this.webodf,
odf: odf, odf: this.odf,
runtime: runtime runtime: this.runtime
}; };
} }
}, },
@ -171,7 +171,7 @@ require.onError = (function() {
return; return;
} }
if (err.requireType === "timeout" || err.requireType === "scripterror") { 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; retrying = true;
document.location.reload(true); document.location.reload(true);
} else { } else {
@ -274,5 +274,5 @@ if (Object.create) {
}); });
} else { } 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.");
} }

2
static/js/mediastream/connector.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
define(['jquery', 'underscore'], function($, _, uaparser) { define(['jquery', 'underscore'], function($, _) {
var timeout = 5000; var timeout = 5000;
var timeout_max = 20000; var timeout_max = 20000;

2
static/js/mediastream/peerconference.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
define(['underscore', 'mediastream/peercall'], function(_, PeerCall) { define(['jquery', 'underscore', 'mediastream/peercall'], function($, _, PeerCall) {
//NOTE(longsleep): This id should be changed to something undeterministic. //NOTE(longsleep): This id should be changed to something undeterministic.
var conferences = 0; var conferences = 0;

6
static/js/mediastream/peerconnection.js

@ -54,7 +54,7 @@ define(['jquery', 'underscore', 'webrtc.adapter'], function($, _) {
console.log('Creating RTCPeerConnnection with:\n' + console.log('Creating RTCPeerConnnection with:\n' +
' config: \'' + JSON.stringify(currentcall.pcConfig) + '\';\n' + ' config: \'' + JSON.stringify(currentcall.pcConfig) + '\';\n' +
' constraints: \'' + JSON.stringify(currentcall.pcConstraints) + '\'.'); ' 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) { } catch (e) {
console.error('Failed to create PeerConnection, exception: ' + e.message); console.error('Failed to create PeerConnection, exception: ' + e.message);
pc = this.pc = null; 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. // for example https://bugzilla.mozilla.org/show_bug.cgi?id=998546.
pc.onaddstream = _.bind(this.onRemoteStreamAdded, this); pc.onaddstream = _.bind(this.onRemoteStreamAdded, this);
pc.onremovestream = _.bind(this.onRemoteStreamRemoved, 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 // NOTE(longsleep): onnegotiationneeded is not supported by Firefox. We trigger it
// manually when a stream is added or removed. // manually when a stream is added or removed.
// https://bugzilla.mozilla.org/show_bug.cgi?id=840728 // 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. // Create default data channel when we are in initiate mode.
if (currentcall.initiate) { 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 // NOTE(longsleep): Android (Chrome 32) does have broken SCTP data channels
// which makes connection fail because of sdp set error for answer/offer. // 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 // See https://code.google.com/p/webrtc/issues/detail?id=2253 Lets hope the

8
static/js/mediastream/tokens.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
define(['jquery', 'underscore'], function(jquery, _) { define(['jquery', 'underscore'], function($, _) {
var Token = function(handlerKey) { var Token = function(handlerKey) {
this.e = $({}); this.e = $({});
@ -147,7 +147,7 @@ define(['jquery', 'underscore'], function(jquery, _) {
// Set message implementation. // Set message implementation.
handler.messageHandler = _.bind(obj.trigger, obj); 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) { handler.createAnswer(_.bind(function(sessionDescription, currenthandler) {
//console.log("Sending handler answer", sessionDescription, currenthandler.id); //console.log("Sending handler answer", sessionDescription, currenthandler.id);
webrtc.api.sendAnswer(from, sessionDescription); webrtc.api.sendAnswer(from, sessionDescription);
@ -159,10 +159,10 @@ define(['jquery', 'underscore'], function(jquery, _) {
if (!handler.messageHandler) { if (!handler.messageHandler) {
handler.messageHandler = _.bind(obj.trigger, obj); handler.messageHandler = _.bind(obj.trigger, obj);
} }
handler.setRemoteDescription(new RTCSessionDescription(data)); handler.setRemoteDescription(new window.RTCSessionDescription(data));
break; break;
case "Candidate": case "Candidate":
var candidate = new RTCIceCandidate({ var candidate = new window.RTCIceCandidate({
sdpMLineIndex: data.sdpMLineIndex, sdpMLineIndex: data.sdpMLineIndex,
sdpMid: data.sdpMid, sdpMid: data.sdpMid,
candidate: data.candidate candidate: data.candidate

6
static/js/mediastream/usermedia.js

@ -126,7 +126,7 @@ define(['jquery', 'underscore', 'audiocontext', 'webrtc.adapter'], function($, _
error_cb.apply(this, args); error_cb.apply(this, args);
}; };
try { try {
getUserMedia({ window.getUserMedia({
video: true, video: true,
audio: true audio: true
}, success_helper, error_helper); }, success_helper, error_helper);
@ -171,7 +171,7 @@ define(['jquery', 'underscore', 'audiocontext', 'webrtc.adapter'], function($, _
try { try {
console.log('Requesting access to local media with mediaConstraints:\n' + console.log('Requesting access to local media with mediaConstraints:\n' +
' \'' + JSON.stringify(constraints) + '\'', constraints); ' \'' + 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; this.started = true;
return true; return true;
} catch (e) { } catch (e) {
@ -390,7 +390,7 @@ define(['jquery', 'underscore', 'audiocontext', 'webrtc.adapter'], function($, _
UserMedia.prototype.attachMediaStream = function(video) { UserMedia.prototype.attachMediaStream = function(video) {
attachMediaStream(video, this.localStream); window.attachMediaStream(video, this.localStream);
}; };

2
static/js/mediastream/utils.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
define(['jquery', 'underscore'], function($, _) { define([], function() {
var Utils = function() {} var Utils = function() {}

8
static/js/mediastream/webrtc.js

@ -237,7 +237,7 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u
targetcall = this.findTargetCall(from); targetcall = this.findTargetCall(from);
if (targetcall) { if (targetcall) {
// Hey we know this call. // 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) { if (currentcall === this.currentcall) {
// Main call. // Main call.
this.e.triggerHandler("peercall", [this.currentcall]); 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); console.log("Received conference Offer -> auto.", from, data._conference);
// Clean own internal data before feeding into browser. // Clean own internal data before feeding into browser.
delete data._conference; delete data._conference;
this.currentconference.autoAnswer(from, new RTCSessionDescription(data)); this.currentconference.autoAnswer(from, new window.RTCSessionDescription(data));
break; break;
} }
// Cannot do anything with this offer, reply with busy. // 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); console.warn("Received Candidate for unknown id -> ignore.", from);
return; return;
} }
var candidate = new RTCIceCandidate({ var candidate = new window.RTCIceCandidate({
sdpMLineIndex: data.sdpMLineIndex, sdpMLineIndex: data.sdpMLineIndex,
sdpMid: data.sdpMid, sdpMid: data.sdpMid,
candidate: data.candidate 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 // 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. // 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. // Received remote description as answer.
console.log("Received answer after we sent offer", data); console.log("Received answer after we sent offer", data);
}); });

2
static/js/services/buddydata.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
define(['underscore'], function(underscore) { define(['underscore'], function(_) {
// buddyData // buddyData
return ["appData", "contactData", "mediaStream", "$rootScope", function(appData, contactData, mediaStream, $rootScope) { return ["appData", "contactData", "mediaStream", "$rootScope", function(appData, contactData, mediaStream, $rootScope) {

2
static/js/services/buddylist.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
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() { var BuddyTree = function() {

2
static/js/services/buddypicture.js

@ -19,7 +19,7 @@
* *
*/ */
define(['underscore'], function(underscore) { define([], function() {
// buddyPicture // buddyPicture
return ["$window", "restURL", function($window, restURL) { return ["$window", "restURL", function($window, restURL) {

2
static/js/services/contactdata.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
define(['underscore', 'jquery'], function(underscore, $) { define(['underscore', 'jquery'], function(_, $) {
// contactData // contactData
return [function() { return [function() {

4
static/js/services/contacts.js

@ -26,7 +26,7 @@ define(['underscore', 'jquery', 'modernizr', 'sjcl', 'text!partials/contactsmana
this.db = null; this.db = null;
this.name = name; this.name = name;
this.e = $({}); this.e = $({});
var request = indexedDB.open(this.name, this.version); var request = window.indexedDB.open(this.name, this.version);
var that = this; var that = this;
request.onupgradeneeded = function(event) { request.onupgradeneeded = function(event) {
var db = event.target.result; var db = event.target.result;
@ -90,7 +90,7 @@ define(['underscore', 'jquery', 'modernizr', 'sjcl', 'text!partials/contactsmana
Database.prototype.all = function(storename, iteratorCallback, errorCallback) { Database.prototype.all = function(storename, iteratorCallback, errorCallback) {
var transaction = this.db.transaction(storename); var transaction = this.db.transaction(storename);
var store = transaction.objectStore(storename); var store = transaction.objectStore(storename);
var keyRange = IDBKeyRange.lowerBound(0); var keyRange = window.IDBKeyRange.lowerBound(0);
var cursorRequest = store.openCursor(keyRange); var cursorRequest = store.openCursor(keyRange);
cursorRequest.onsuccess = function(event) { cursorRequest.onsuccess = function(event) {
var result = event.target.result; var result = event.target.result;

14
static/js/services/desktopnotify.js

@ -35,7 +35,7 @@ define(['jquery', 'underscore', 'desktop-notify'], function($, _, notify) {
var helper = notify; var helper = notify;
var desktopNotify = function() { var DesktopNotify = function() {
this.asked = false; this.asked = false;
this.windowHasFocus = true; 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") { if (this.level === "default") {
this.asked = true; 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.supported = helper.isSupported;
this.level = helper.permissionLevel(); this.level = helper.permissionLevel();
}; };
desktopNotify.prototype.requestPermission = function(cb) { DesktopNotify.prototype.requestPermission = function(cb) {
//console.log("request permission"); //console.log("request permission");
return helper.requestPermission(_.bind(function() { 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); return helper.createNotification(title, options);
}; };
desktopNotify.prototype.notify = function(title, body, options) { DesktopNotify.prototype.notify = function(title, body, options) {
if (!this.enabled()) { if (!this.enabled()) {
return this.dummy; return this.dummy;
@ -113,7 +113,7 @@ define(['jquery', 'underscore', 'desktop-notify'], function($, _, notify) {
}; };
return new desktopNotify(); return new DesktopNotify();
}]; }];

6
static/js/services/filedata.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
define(["jquery", "underscore", "sha", "webrtc.adapter"], function($, _, jsSHA) { define(["jquery", "underscore", "sha", "webrtc.adapter"], function($, _, JsSHA) {
var requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem || null; var requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem || null;
if (!requestFileSystem) { 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 // 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. // 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. // Fake implementation for browsers which do not support FileSystem API.
var FileWriterFake = function(owner) { var FileWriterFake = function(owner) {
@ -423,7 +423,7 @@ define(["jquery", "underscore", "sha", "webrtc.adapter"], function($, _, jsSHA)
}, },
createFile: function(namespace, data) { createFile: function(namespace, data) {
var id = namespace + "_" + (fileCount++); 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 token = shaObj.getHMAC(randomSecret, "TEXT", "SHA-384", "HEX");
var file = filesTable[token] = new File(token, data); var file = filesTable[token] = new File(token, data);
return file; return file;

2
static/js/services/localstatus.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
define(['angular', 'underscore'], function(angular, underscore) { define(['angular', 'underscore'], function(angular, _) {
// localStatus // localStatus
return ["mediaStream", "$window", function(mediaStream, $window) { return ["mediaStream", "$window", function(mediaStream, $window) {

16
static/js/services/mediasources.js

@ -22,15 +22,15 @@ define(['jquery', 'underscore'], function($, _) {
return ["$window", function($window) { 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.audio = [];
this.video = []; this.video = [];
}; };
mediaSources.prototype.refresh = function(cb) { MediaSources.prototype.refresh = function(cb) {
if (!this.supported) { if (!this.supported) {
if (cb) { 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 audio = this.audio = [];
var video = this.video = []; var video = this.video = [];
_.each(sources, function(source) { _.each(sources, function(source) {
@ -78,7 +78,7 @@ define(['jquery', 'underscore'], function($, _) {
}; };
mediaSources.prototype.hasAudioId = function(id) { MediaSources.prototype.hasAudioId = function(id) {
var i; var i;
for (i = 0; i < this.audio.length; 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; var i;
for (i = 0; i < this.video.length; i++) { for (i = 0; i < this.video.length; i++) {
@ -103,7 +103,7 @@ define(['jquery', 'underscore'], function($, _) {
}; };
return new mediaSources(); return new MediaSources();
}]; }];

3
static/js/services/mediastream.js

@ -22,10 +22,11 @@ define([
'jquery', 'jquery',
'underscore', 'underscore',
'ua-parser', 'ua-parser',
'sjcl',
'modernizr', 'modernizr',
'mediastream/tokens' '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) { 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) {

Loading…
Cancel
Save