Fixing lint errors
Fixing JSLint Problems
This commit is contained in:
parent
0956d328da
commit
d537d6a91f
3 changed files with 105 additions and 99 deletions
23
js/api.js
23
js/api.js
|
@ -27,19 +27,19 @@ window.textsecure.api = function() {
|
|||
// Staging server
|
||||
var URL_BASE = "https://textsecure-service-staging.whispersystems.org";
|
||||
self.relay = "textsecure-service-staging.whispersystems.org";
|
||||
var ATTACHMENT_HOST = "whispersystems-textsecure-attachments-staging.s3.amazonaws.com"
|
||||
var ATTACHMENT_HOST = "whispersystems-textsecure-attachments-staging.s3.amazonaws.com";
|
||||
|
||||
// This is the real server
|
||||
//var URL_BASE = "https://textsecure-service.whispersystems.org";
|
||||
|
||||
var URL_CALLS = {};
|
||||
URL_CALLS['accounts'] = "/v1/accounts";
|
||||
URL_CALLS['devices'] = "/v1/devices";
|
||||
URL_CALLS['keys'] = "/v2/keys";
|
||||
URL_CALLS['push'] = "/v1/websocket";
|
||||
URL_CALLS['temp_push'] = "/v1/temp_websocket";
|
||||
URL_CALLS['messages'] = "/v1/messages";
|
||||
URL_CALLS['attachment'] = "/v1/attachments";
|
||||
URL_CALLS.accounts = "/v1/accounts";
|
||||
URL_CALLS.devices = "/v1/devices";
|
||||
URL_CALLS.keys = "/v2/keys";
|
||||
URL_CALLS.push = "/v1/websocket";
|
||||
URL_CALLS.temp_push = "/v1/temp_websocket";
|
||||
URL_CALLS.messages = "/v1/messages";
|
||||
URL_CALLS.attachment = "/v1/attachments";
|
||||
|
||||
/**
|
||||
* REQUIRED PARAMS:
|
||||
|
@ -55,8 +55,9 @@ window.textsecure.api = function() {
|
|||
* jsonData: JSON data sent in the request body
|
||||
*/
|
||||
var doAjax = function (param) {
|
||||
if (param.urlParameters === undefined)
|
||||
if (param.urlParameters === undefined) {
|
||||
param.urlParameters = "";
|
||||
}
|
||||
|
||||
if (param.do_auth) {
|
||||
param.user = textsecure.storage.getUnencrypted("number_id");
|
||||
|
@ -82,7 +83,7 @@ window.textsecure.api = function() {
|
|||
|
||||
error : function(jqXHR, textStatus, errorThrown) {
|
||||
var code = jqXHR.status;
|
||||
if (code == 200) {
|
||||
if (code === 200) {
|
||||
// happens sometimes when we get no response
|
||||
// (TODO: Fix server to return 204? instead)
|
||||
resolve(null);
|
||||
|
@ -153,7 +154,7 @@ window.textsecure.api = function() {
|
|||
jsonData : { signalingKey : btoa(getString(signaling_key)),
|
||||
supportsSms : false,
|
||||
fetchesMessages : true,
|
||||
registrationId : registrationId},
|
||||
registrationId : registrationId}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/*global chrome*/
|
||||
/* vim: ts=4:sw=4
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -13,24 +14,24 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
window.extension = window.extension || {};
|
||||
|
||||
window.extension.navigator = function() {
|
||||
var self = {};
|
||||
|
||||
var tabs = {};
|
||||
window.extension.navigator = (function () {
|
||||
var self = {},
|
||||
tabs = {};
|
||||
tabs.create = function (url) {
|
||||
chrome.tabs.create({url: url});
|
||||
};
|
||||
self.tabs = tabs;
|
||||
|
||||
self.setBadgeText = function (text) {
|
||||
chrome.browserAction.setBadgeText({text: text + ""});
|
||||
chrome.browserAction.setBadgeText({text: String(text)});
|
||||
};
|
||||
|
||||
return self;
|
||||
}();
|
||||
}());
|
||||
|
||||
// Random shared utilities that are used only by chromium things
|
||||
|
||||
|
@ -50,4 +51,5 @@ function addRegistrationListener(callback) {
|
|||
callback();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
}());
|
||||
|
|
13
js/index.js
13
js/index.js
|
@ -1,3 +1,4 @@
|
|||
/*global $, Whisper, Backbone, textsecure, extension*/
|
||||
/* vim: ts=4:sw=4:expandtab:
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -13,7 +14,8 @@
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
Whisper.Layout = new (Backbone.View.extend({
|
||||
initialize: function () {
|
||||
this.gutter = $('#gutter');
|
||||
|
@ -43,10 +45,10 @@ Whisper.Layout = new (Backbone.View.extend({
|
|||
new Whisper.NewGroupView();
|
||||
},
|
||||
resize: function (e) {
|
||||
var windowheight = window.innerHeight;
|
||||
var form = $('.send-message-area').outerHeight();
|
||||
var gutter_offset = this.gutter.offset().top;
|
||||
var contacts_offset = this.contacts.offset().top;
|
||||
var windowheight = window.innerHeight,
|
||||
form = $('.send-message-area').outerHeight(),
|
||||
gutter_offset = this.gutter.offset().top,
|
||||
contacts_offset = this.contacts.offset().top;
|
||||
if (window.innerWidth < 480) {
|
||||
this.gutter.css('height', windowheight - gutter_offset - form);
|
||||
this.contacts.css('height', windowheight - contacts_offset - form);
|
||||
|
@ -71,3 +73,4 @@ if (textsecure.storage.getUnencrypted("number_id") === undefined) {
|
|||
Whisper.Threads.at(0).trigger('render');
|
||||
}
|
||||
}
|
||||
}());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue