mirror of
https://github.com/nerzhul/ocsms.git
synced 2025-06-07 07:56:23 +00:00
js code quality
This commit is contained in:
parent
39d46e2aeb
commit
5e48961a52
@ -31,8 +31,8 @@ var ContactList = new Vue({
|
||||
this.lastTotalUnreadCount = 0;
|
||||
},
|
||||
fetch: function () {
|
||||
var self = this;
|
||||
// Now bind the events when we click on the phone number
|
||||
let self = this;
|
||||
// Now bind the events when we click on the phone number
|
||||
$.getJSON(Sms.generateURL('/front-api/v1/peerlist'), function (jsondata, status) {
|
||||
// Use a buffer for better jQuery performance
|
||||
let bufferedContacts = [];
|
||||
|
@ -29,14 +29,14 @@ var Conversation = new Vue({
|
||||
this.messages = [];
|
||||
this.lastConvMessageDate = 0;
|
||||
|
||||
var self = this;
|
||||
$.getJSON(Sms.generateURL('/front-api/v1/conversation'), {'phoneNumber': self.selectedContact.nav},
|
||||
let self = this;
|
||||
$.getJSON(Sms.generateURL('/front-api/v1/conversation'), {'phoneNumber': self.selectedContact.nav},
|
||||
function (jsondata, status) {
|
||||
var phoneNumberLabel = self.selectedContact.nav;
|
||||
let phoneNumberLabel = self.selectedContact.nav;
|
||||
|
||||
if (typeof jsondata['phoneNumbers'] !== 'undefined') {
|
||||
var phoneNumberList = arrayUnique(jsondata['phoneNumbers']);
|
||||
phoneNumberLabel = phoneNumberList.toString();
|
||||
if (typeof jsondata['phoneNumbers'] !== 'undefined') {
|
||||
const phoneNumberList = arrayUnique(jsondata['phoneNumbers']);
|
||||
phoneNumberLabel = phoneNumberList.toString();
|
||||
}
|
||||
|
||||
// Reinit messages before showing conversation
|
||||
@ -97,11 +97,11 @@ var Conversation = new Vue({
|
||||
// Return (int) msgCount, (str) htmlConversation
|
||||
formatConversation: function (jsondata) {
|
||||
// Improve jQuery performance
|
||||
var buf = false;
|
||||
// Improve JS performance
|
||||
var msgClass = '';
|
||||
var msgCount = 0;
|
||||
var self = this;
|
||||
let buf = false;
|
||||
// Improve JS performance
|
||||
let msgClass = '';
|
||||
let msgCount = 0;
|
||||
let self = this;
|
||||
|
||||
$.each(jsondata["conversation"], function (id, vals) {
|
||||
if (vals["type"] == 1) {
|
||||
@ -138,10 +138,11 @@ var Conversation = new Vue({
|
||||
*/
|
||||
addConversationMessage: function (msg) {
|
||||
this.messages.push(msg);
|
||||
console.log(this.messages);
|
||||
},
|
||||
removeConversationMessage: function (msgId) {
|
||||
var len = this.messages.length;
|
||||
var self = this;
|
||||
const len = this.messages.length;
|
||||
let self = this;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var curMsg = this.messages[i];
|
||||
if (curMsg['id'] === msgId) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user