mirror of
https://github.com/nerzhul/ocsms.git
synced 2025-06-08 16:36:25 +00:00
prepare a JS refresh in JS
This commit is contained in:
parent
f62272ee46
commit
e3617c725c
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
// Some global vars to improve performances
|
// Some global vars to improve performances
|
||||||
var selectedConversation = null;
|
var selectedConversation = null;
|
||||||
|
var curPhoneNumber = null;
|
||||||
|
|
||||||
// Source: http://www.sitepoint.com/url-parameters-jquery/
|
// Source: http://www.sitepoint.com/url-parameters-jquery/
|
||||||
$.urlParam = function(name){
|
$.urlParam = function(name){
|
||||||
@ -21,7 +22,11 @@ $.urlParam = function(name){
|
|||||||
else {
|
else {
|
||||||
return results[1] || 0;
|
return results[1] || 0;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
var refreshConversation = function() {
|
||||||
|
alert(curPhoneNumber);
|
||||||
|
};
|
||||||
|
|
||||||
function fetchConversation(phoneNumber) {
|
function fetchConversation(phoneNumber) {
|
||||||
$.getJSON(OC.generateUrl('/apps/ocsms/get/conversation'),
|
$.getJSON(OC.generateUrl('/apps/ocsms/get/conversation'),
|
||||||
@ -67,6 +72,7 @@ function fetchConversation(phoneNumber) {
|
|||||||
conversationBuf += '<div><div class="' + msgClass + '"><div>' +
|
conversationBuf += '<div><div class="' + msgClass + '"><div>' +
|
||||||
vals["msg"] + '</div><div class="msg-date">' +
|
vals["msg"] + '</div><div class="msg-date">' +
|
||||||
formatedDate + '</div></div><div class="msg-spacer"></div></div>';
|
formatedDate + '</div></div><div class="msg-spacer"></div></div>';
|
||||||
|
curPhoneNumber = phoneNumber;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#app-content').html(conversationBuf);
|
$('#app-content').html(conversationBuf);
|
||||||
@ -115,6 +121,7 @@ function changeSelectedConversation(item) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
setInterval(refreshConversation, 10000);
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery, OC);
|
})(jQuery, OC);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user