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: {
|
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' },
|
options: { jshintrc: '.jshintrc' },
|
||||||
},
|
},
|
||||||
jscs: {
|
jscs: {
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
getCountryCode: function(regionCode) {
|
getCountryCode: function(regionCode) {
|
||||||
var cc = libphonenumber.getCountryCodeForRegion(regionCode);
|
var cc = libphonenumber.getCountryCodeForRegion(regionCode);
|
||||||
return (cc != 0) ? cc : "";
|
return (cc !== 0) ? cc : "";
|
||||||
},
|
},
|
||||||
|
|
||||||
verifyNumber: function(number, regionCode) {
|
verifyNumber: function(number, regionCode) {
|
||||||
|
|
|
@ -136,7 +136,7 @@
|
||||||
}
|
}
|
||||||
this.save({unreadCount: this.get('unreadCount') + 1, active: true});
|
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) {
|
fetchMessages: function(options) {
|
||||||
|
|
|
@ -81,4 +81,4 @@
|
||||||
return this.fetch(options);
|
return this.fetch(options);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})()
|
})();
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
if (verificationCode.length == 6) {
|
if (verificationCode.length == 6) {
|
||||||
return verificationCode;
|
return verificationCode;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
function displayError(error) {
|
function displayError(error) {
|
||||||
$('#error').hide().text(error).addClass('in').fadeIn();
|
$('#error').hide().text(error).addClass('in').fadeIn();
|
||||||
};
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var phoneView = new Whisper.PhoneInputView({el: $('#phone-number-input')});
|
var phoneView = new Whisper.PhoneInputView({el: $('#phone-number-input')});
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
'?uuid=' + proto.uuid +
|
'?uuid=' + proto.uuid +
|
||||||
'&pub_key=' + encodeURIComponent(btoa(getString(cryptoInfo.pubKey))));
|
'&pub_key=' + encodeURIComponent(btoa(getString(cryptoInfo.pubKey))));
|
||||||
$('img').removeAttr('style');
|
$('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');
|
request.respond(200, 'OK');
|
||||||
} else if (request.path == "/v1/message" && request.verb == "PUT") {
|
} else if (request.path == "/v1/message" && request.verb == "PUT") {
|
||||||
$('#init-setup').hide();
|
$('#init-setup').hide();
|
||||||
|
@ -173,8 +173,7 @@
|
||||||
$('#verify4done').text('done');
|
$('#verify4done').text('done');
|
||||||
//$('#complete-number').text(parsedNumber);
|
//$('#complete-number').text(parsedNumber);
|
||||||
textsecure.registration.done();
|
textsecure.registration.done();
|
||||||
case 5:
|
//case 5: //TODO: Do sync to get 5!
|
||||||
//TODO: Do sync to get 5!
|
|
||||||
$('#verify').hide();
|
$('#verify').hide();
|
||||||
$('#setup-complete').show().addClass('in');
|
$('#setup-complete').show().addClass('in');
|
||||||
textsecure.registration.done();
|
textsecure.registration.done();
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
window.updateConversation = function(conversationId) {
|
window.updateConversation = function(conversationId) {
|
||||||
var conversation = conversations.get(conversationId)
|
var conversation = conversations.get(conversationId);
|
||||||
if (conversation) {
|
if (conversation) {
|
||||||
conversation.fetch();
|
conversation.fetch();
|
||||||
conversation.fetchMessages();
|
conversation.fetchMessages();
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
function closeConversation (windowId) {
|
function closeConversation (windowId) {
|
||||||
windowMap.remove('windowId', windowId);
|
windowMap.remove('windowId', windowId);
|
||||||
};
|
}
|
||||||
|
|
||||||
window.openConversation = function openConversation (modelId) {
|
window.openConversation = function openConversation (modelId) {
|
||||||
var conversation = conversations.add({id: modelId});
|
var conversation = conversations.add({id: modelId});
|
||||||
|
|
|
@ -110,7 +110,6 @@
|
||||||
toggleSettings: function (e) {
|
toggleSettings: function (e) {
|
||||||
$('body').toggleClass('settings-open');
|
$('body').toggleClass('settings-open');
|
||||||
console.log('toggling');
|
console.log('toggling');
|
||||||
debugger;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -68,18 +68,21 @@ var Whisper = Whisper || {};
|
||||||
var promises = [];
|
var promises = [];
|
||||||
var files = this.$input.prop('files');
|
var files = this.$input.prop('files');
|
||||||
for (var i = 0; i < files.length; i++) {
|
for (var i = 0; i < files.length; i++) {
|
||||||
var contentType = files[i].type;
|
promises.push(readFile(files[i]));
|
||||||
var p = new Promise(function(resolve, reject) {
|
}
|
||||||
|
this.clearForm();
|
||||||
|
return Promise.all(promises);
|
||||||
|
},
|
||||||
|
|
||||||
|
readFile: function(file) {
|
||||||
|
var contentType = file.type;
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
var FR = new FileReader();
|
var FR = new FileReader();
|
||||||
FR.onload = function(e) {
|
FR.onload = function(e) {
|
||||||
resolve({data: e.target.result, contentType: contentType});
|
resolve({data: e.target.result, contentType: contentType});
|
||||||
};
|
};
|
||||||
FR.readAsArrayBuffer(files[i]);
|
FR.readAsArrayBuffer(file);
|
||||||
}.bind(this));
|
});
|
||||||
promises.push(p);
|
|
||||||
}
|
|
||||||
this.clearForm();
|
|
||||||
return Promise.all(promises);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
clearForm: function() {
|
clearForm: function() {
|
||||||
|
|
|
@ -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…
Add table
Add a link
Reference in a new issue