diff --git a/static/js/app.js b/static/js/app.js
index 80f05dea..a39433cc 100644
--- a/static/js/app.js
+++ b/static/js/app.js
@@ -38,6 +38,7 @@ define([
'angular-animate',
'angular-humanize',
'angular-route',
+
'mobile-events'
], function(require, $, _, angular, modernizr, moment, services, directives, filters, controllers, languages) {
@@ -65,12 +66,13 @@ define([
var appConfig = {};
// Implement translation store.
- var TranslationData = function(default_language) {
+ var TranslationData = function(default_language, launcher) {
// Create data structure.
this.data = {
locale_data: {}
};
this.lang = this.default_lang = default_language;
+ this.getHTTP = launcher.$http.get;
};
TranslationData.prototype.language = function() {
// Return language.
@@ -97,25 +99,24 @@ define([
};
TranslationData.prototype.load = function(domain, url) {
var that = this;
- return $.ajax({
- dataType: "json",
- url: url,
- success: function(data) {
+ return this.getHTTP(url).
+ success(function(data) {
//console.log("loaded translation data", data);
that.add(domain, data);
- },
- error: function(err, textStatus, errorThrown) {
- console.warn("Failed to load translation data: " + errorThrown);
+ }).
+ error(function(data, status) {
+ console.warn("Failed to load translation data: " + status);
that.add(domain, null);
- }
- });
+ });
};
TranslationData.prototype.get = function() {
return this.data;
};
- var translationData = new TranslationData("en");
- var create = function(ms) {
+ var create = function(ms, launcher) {
+
+ // Create translation data instance.
+ var translationData = launcher.translationData = new TranslationData("en", launcher);
var modules = ['ui.bootstrap', 'ngSanitize', 'ngAnimate', 'ngHumanize', 'ngRoute'];
if (ms && ms.length) {
@@ -183,11 +184,11 @@ define([
// breaking changes to plugins can check on it.
var apiversion = 1.1;
- var initialize = function(app) {
+ var initialize = function(app, launcher) {
- var deferred = $.Deferred();
+ var deferred = launcher.$q.defer();
- var globalContext = JSON.parse($("#globalcontext").text());
+ var globalContext = JSON.parse(document.getElementById("globalcontext").innerHTML);
if (!globalContext.Cfg.Version) {
globalContext.Cfg.Version = "unknown";
}
@@ -240,16 +241,19 @@ define([
console.info("Selected language: "+lang);
// Set language and load default translations.
- translationData.lang = lang;
- var domain = "messages";
- if (lang === translationData.default_lang) {
+ launcher.translationData.lang = lang;
+ var translationDomain = "messages";
+ if (lang === launcher.translationData.default_lang) {
// No need to load default language as it is built in.
- translationData.add(domain, null);
+ launcher.translationData.add(translationDomain, null);
deferred.resolve();
} else {
// Load default translation catalog.
- var url = require.toUrl('translation/' + domain + "-" + lang + '.json');
- $.when(translationData.load(domain, url)).always(function() {
+ var url = require.toUrl('translation/'+translationDomain+"-"+lang+'.json');
+ launcher.translationData.load(translationDomain, url).then(function() {
+ deferred.resolve();
+ }, function() {
+ // Ignore errors.
deferred.resolve();
});
}
@@ -257,7 +261,7 @@ define([
// Set momemt language.
moment.lang(lang);
- return deferred.promise();
+ return deferred.promise;
};
@@ -266,7 +270,6 @@ define([
initialize: initialize,
query: urlQuery,
config: appConfig,
- translationData: translationData,
apiversion: apiversion
};
diff --git a/static/js/controllers/chatroomcontroller.js b/static/js/controllers/chatroomcontroller.js
index f5d56a5e..f4d16182 100644
--- a/static/js/controllers/chatroomcontroller.js
+++ b/static/js/controllers/chatroomcontroller.js
@@ -23,10 +23,10 @@ define(['jquery', 'underscore', 'moment', 'text!partials/fileinfo.html', 'text!p
// ChatroomController
return ["$scope", "$element", "$window", "safeMessage", "safeDisplayName", "$compile", "$filter", "translation", function($scope, $element, $window, safeMessage, safeDisplayName, $compile, $filter, translation) {
- $scope.outputElement = $(".output", $element);
- $scope.inputElement = $(".input", $element);
- $scope.bodyElement = $(".chatbody", $element);
- $scope.menuElement = $(".chatmenu", $element);
+ $scope.outputElement = $element.find(".output");
+ $scope.inputElement = $element.find(".input");
+ $scope.bodyElement = $element.find(".chatbody");
+ $scope.menuElement = $element.find(".chatmenu");
var lastSender = null;
var lastDate = null;
var lastMessageContainer = null;
@@ -159,7 +159,7 @@ define(['jquery', 'underscore', 'moment', 'text!partials/fileinfo.html', 'text!p
$scope.canScroll = function() {
- var o = $scope.outputElement.get(0);
+ var o = $scope.outputElement[0];
if ((o.clientHeight - 20) < o.scrollHeight) {
if (!scrollAfterInput && (o.clientHeight + 20) < (o.scrollHeight - o.scrollTop)) {
// Manually scrolled -> do nothing.
diff --git a/static/js/directives/audiovideo.js b/static/js/directives/audiovideo.js
index 5f28c032..7a3b5f5e 100644
--- a/static/js/directives/audiovideo.js
+++ b/static/js/directives/audiovideo.js
@@ -33,13 +33,13 @@ define(['jquery', 'underscore', 'text!partials/audiovideo.html', 'text!partials/
return id;
};
- $scope.container = $element.get(0);
+ $scope.container = $element[0];
$scope.layoutparent = $element.parent();
- $scope.remoteVideos = $element.find(".remoteVideos").get(0);
- $scope.localVideo = $element.find(".localVideo").get(0);
- $scope.miniVideo = $element.find(".miniVideo").get(0);
- $scope.mini = $element.find(".miniContainer").get(0);
+ $scope.remoteVideos = $element.find(".remoteVideos")[0];
+ $scope.localVideo = $element.find(".localVideo")[0];
+ $scope.miniVideo = $element.find(".miniVideo")[0];
+ $scope.mini = $element.find(".miniContainer")[0];
$scope.hasUsermedia = false;
$scope.isActive = false;
@@ -85,7 +85,7 @@ define(['jquery', 'underscore', 'text!partials/audiovideo.html', 'text!partials/
$($scope.remoteVideos).append(clonedElement);
clonedElement.data("peerid", scope.peerid);
scope.element = clonedElement;
- var video = clonedElement.find("video").get(0);
+ var video = clonedElement.find("video")[0];
$window.attachMediaStream(video, stream);
// Waiter callbacks also count as connected, as browser support (FireFox 25) is not setting state changes properly.
videoWaiter.wait(video, stream, function(withvideo) {
@@ -174,7 +174,7 @@ define(['jquery', 'underscore', 'text!partials/audiovideo.html', 'text!partials/
//console.log("Toggle full screen", BigScreen.enabled, $scope.isActive, $scope.hasUsermedia);
if (BigScreen.enabled && ($scope.isActive || $scope.hasUsermedia)) {
$scope.layoutparent.toggleClass("fullscreen");
- BigScreen.toggle($scope.layoutparent.get(0));
+ BigScreen.toggle($scope.layoutparent[0]);
}
};
diff --git a/static/js/directives/buddypicturecapture.js b/static/js/directives/buddypicturecapture.js
index 0e96a856..3a68d0ab 100644
--- a/static/js/directives/buddypicturecapture.js
+++ b/static/js/directives/buddypicturecapture.js
@@ -176,10 +176,10 @@ define(['jquery', 'underscore', 'text!partials/buddypicturecapture.html'], funct
var link = function($scope, $element, $attrs, modelController) {
- $scope.video = $element.find("video").get(0);
+ $scope.video = $element.find("video")[0];
$scope.flash = $element.find(".videoFlash");
- $scope.canvasPic = $element.find("canvas.videoPic").get(0);
- $scope.canvasPrev = $element.find("canvas.videoPrev").get(0);
+ $scope.canvasPic = $element.find("canvas.videoPic")[0];
+ $scope.canvasPrev = $element.find("canvas.videoPrev")[0];
$($scope.canvasPic).attr($scope.captureSize);
$scope.save = function() {
diff --git a/static/js/directives/buddypictureupload.js b/static/js/directives/buddypictureupload.js
index ed800f0a..a8951b42 100644
--- a/static/js/directives/buddypictureupload.js
+++ b/static/js/directives/buddypictureupload.js
@@ -211,7 +211,7 @@ define(['jquery', 'underscore', 'text!partials/buddypictureupload.html'], functi
var link = function($scope, $element) {
- $scope.prevImage = $element.find("img.preview").get(0);
+ $scope.prevImage = $element.find("img.preview")[0];
$scope.clearInput = function() {
$element.find("input[type=file]")[0].value = "";
};
diff --git a/static/js/directives/presentation.js b/static/js/directives/presentation.js
index 770576c8..3e90155d 100644
--- a/static/js/directives/presentation.js
+++ b/static/js/directives/presentation.js
@@ -685,7 +685,7 @@ define(['jquery', 'underscore', 'text!partials/presentation.html', 'bigscreen'],
if (elem) {
BigScreen.toggle(elem);
} else {
- BigScreen.toggle(pane.get(0));
+ BigScreen.toggle(pane[0]);
}
}
diff --git a/static/js/directives/screenshare.js b/static/js/directives/screenshare.js
index 8ffff71d..e4d2061e 100644
--- a/static/js/directives/screenshare.js
+++ b/static/js/directives/screenshare.js
@@ -132,7 +132,7 @@ define(['jquery', 'underscore', 'text!partials/screenshare.html', 'text!partials
peerTemplate(subscope, function(clonedElement, scope) {
pane.append(clonedElement);
scope.element = clonedElement;
- var video = clonedElement.find("video").get(0);
+ var video = clonedElement.find("video")[0];
$window.attachMediaStream(video, stream);
videoWaiter.wait(video, stream, function() {
console.log("Screensharing size: ", video.videoWidth, video.videoHeight);
@@ -311,7 +311,7 @@ define(['jquery', 'underscore', 'text!partials/screenshare.html', 'text!partials
if (elem) {
BigScreen.toggle(elem);
} else {
- BigScreen.toggle(pane.get(0));
+ BigScreen.toggle(pane[0]);
}
}
diff --git a/static/js/directives/socialshare.js b/static/js/directives/socialshare.js
index e38a71b3..9549ae30 100644
--- a/static/js/directives/socialshare.js
+++ b/static/js/directives/socialshare.js
@@ -18,7 +18,7 @@
* along with this program. If not, see