jshint all the things
Small style fixes here and there. Removed one unused file.
This commit is contained in:
parent
76da5bb4f9
commit
ec43a0b633
9 changed files with 36 additions and 55 deletions
16
Gruntfile.js
16
Gruntfile.js
|
@ -151,7 +151,21 @@ module.exports = function(grunt) {
|
|||
}
|
||||
},
|
||||
jshint: {
|
||||
files: ['Gruntfile.js', 'js/background.js'], // add 'src/**/*.js', 'test/**/*.js'
|
||||
files: [
|
||||
'Gruntfile.js',
|
||||
'js/background.js',
|
||||
'js/chromium.js',
|
||||
'js/bimap.js',
|
||||
'js/conversation_panel.js',
|
||||
'js/database.js',
|
||||
'js/inbox_controller.js',
|
||||
'js/index.js',
|
||||
'js/libphonenumber-util.js',
|
||||
'js/options.js',
|
||||
'js/panel_controller.js',
|
||||
'js/models/*.js',
|
||||
'js/views/*.js',
|
||||
],
|
||||
options: { jshintrc: '.jshintrc' },
|
||||
},
|
||||
jscs: {
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
getCountryCode: function(regionCode) {
|
||||
var cc = libphonenumber.getCountryCodeForRegion(regionCode);
|
||||
return (cc != 0) ? cc : "";
|
||||
return (cc !== 0) ? cc : "";
|
||||
},
|
||||
|
||||
verifyNumber: function(number, regionCode) {
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
}
|
||||
this.save({unreadCount: this.get('unreadCount') + 1, active: true});
|
||||
|
||||
return new Promise(function (resolve) { m.save().then(resolve(m)) });
|
||||
return new Promise(function (resolve) { m.save().then(resolve(m)); });
|
||||
},
|
||||
|
||||
fetchMessages: function(options) {
|
||||
|
|
|
@ -81,4 +81,4 @@
|
|||
return this.fetch(options);
|
||||
}
|
||||
});
|
||||
})()
|
||||
})();
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
if (verificationCode.length == 6) {
|
||||
return verificationCode;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function displayError(error) {
|
||||
$('#error').hide().text(error).addClass('in').fadeIn();
|
||||
};
|
||||
}
|
||||
|
||||
$(function() {
|
||||
var phoneView = new Whisper.PhoneInputView({el: $('#phone-number-input')});
|
||||
|
@ -146,7 +146,7 @@
|
|||
'?uuid=' + proto.uuid +
|
||||
'&pub_key=' + encodeURIComponent(btoa(getString(cryptoInfo.pubKey))));
|
||||
$('img').removeAttr('style');
|
||||
$('#multi-device .status').text("Use your phone to scan the QR code.")
|
||||
$('#multi-device .status').text("Use your phone to scan the QR code.");
|
||||
request.respond(200, 'OK');
|
||||
} else if (request.path == "/v1/message" && request.verb == "PUT") {
|
||||
$('#init-setup').hide();
|
||||
|
@ -173,8 +173,7 @@
|
|||
$('#verify4done').text('done');
|
||||
//$('#complete-number').text(parsedNumber);
|
||||
textsecure.registration.done();
|
||||
case 5:
|
||||
//TODO: Do sync to get 5!
|
||||
//case 5: //TODO: Do sync to get 5!
|
||||
$('#verify').hide();
|
||||
$('#setup-complete').show().addClass('in');
|
||||
textsecure.registration.done();
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
};
|
||||
|
||||
window.updateConversation = function(conversationId) {
|
||||
var conversation = conversations.get(conversationId)
|
||||
var conversation = conversations.get(conversationId);
|
||||
if (conversation) {
|
||||
conversation.fetch();
|
||||
conversation.fetchMessages();
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
function closeConversation (windowId) {
|
||||
windowMap.remove('windowId', windowId);
|
||||
};
|
||||
}
|
||||
|
||||
window.openConversation = function openConversation (modelId) {
|
||||
var conversation = conversations.add({id: modelId});
|
||||
|
|
|
@ -110,7 +110,6 @@
|
|||
toggleSettings: function (e) {
|
||||
$('body').toggleClass('settings-open');
|
||||
console.log('toggling');
|
||||
debugger;
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
|
|
@ -68,20 +68,23 @@ var Whisper = Whisper || {};
|
|||
var promises = [];
|
||||
var files = this.$input.prop('files');
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var contentType = files[i].type;
|
||||
var p = new Promise(function(resolve, reject) {
|
||||
var FR = new FileReader();
|
||||
FR.onload = function(e) {
|
||||
resolve({data: e.target.result, contentType: contentType});
|
||||
};
|
||||
FR.readAsArrayBuffer(files[i]);
|
||||
}.bind(this));
|
||||
promises.push(p);
|
||||
promises.push(readFile(files[i]));
|
||||
}
|
||||
this.clearForm();
|
||||
return Promise.all(promises);
|
||||
},
|
||||
|
||||
readFile: function(file) {
|
||||
var contentType = file.type;
|
||||
return new Promise(function(resolve, reject) {
|
||||
var FR = new FileReader();
|
||||
FR.onload = function(e) {
|
||||
resolve({data: e.target.result, contentType: contentType});
|
||||
};
|
||||
FR.readAsArrayBuffer(file);
|
||||
});
|
||||
},
|
||||
|
||||
clearForm: function() {
|
||||
this.thumb.remove();
|
||||
},
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
var Whisper = Whisper || {};
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// This is an ephemeral collection of global notification messages to be
|
||||
// presented in some nice way to the user. In this case they will fade in/out
|
||||
// one at a time.
|
||||
|
||||
var queue = new Backbone.Collection();
|
||||
var view = new (Backbone.View.extend({
|
||||
className: 'help',
|
||||
initialize: function() {
|
||||
this.$el.appendTo($('body'));
|
||||
this.listenToOnce(queue, 'add', this.presentNext);
|
||||
},
|
||||
presentNext: function() {
|
||||
var next = queue.shift();
|
||||
if (next) {
|
||||
this.$el.text(next.get('message')).fadeIn(this.setFadeOut.bind(this));
|
||||
} else {
|
||||
this.listenToOnce(queue, 'add', this.presentNext);
|
||||
}
|
||||
},
|
||||
setFadeOut: function() {
|
||||
setTimeout(this.fadeOut.bind(this), 1500);
|
||||
},
|
||||
fadeOut: function() {
|
||||
this.$el.fadeOut(this.presentNext.bind(this));
|
||||
},
|
||||
}))();
|
||||
|
||||
Whisper.notify = function(str) { queue.add({message: str}); }
|
||||
|
||||
})();
|
Loading…
Reference in a new issue