From e3617c725c8fc318400a4677956b7359c4c861ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot=20=28=40U-Exp=29?= Date: Fri, 26 Sep 2014 18:43:41 +0200 Subject: [PATCH] prepare a JS refresh in JS --- js/script.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/script.js b/js/script.js index b42b085..5efb2c7 100644 --- a/js/script.js +++ b/js/script.js @@ -11,6 +11,7 @@ // Some global vars to improve performances var selectedConversation = null; +var curPhoneNumber = null; // Source: http://www.sitepoint.com/url-parameters-jquery/ $.urlParam = function(name){ @@ -21,7 +22,11 @@ $.urlParam = function(name){ else { return results[1] || 0; } -} +}; + +var refreshConversation = function() { + alert(curPhoneNumber); +}; function fetchConversation(phoneNumber) { $.getJSON(OC.generateUrl('/apps/ocsms/get/conversation'), @@ -67,6 +72,7 @@ function fetchConversation(phoneNumber) { conversationBuf += '
' + vals["msg"] + '
' + formatedDate + '
'; + curPhoneNumber = phoneNumber; }); $('#app-content').html(conversationBuf); @@ -115,6 +121,7 @@ function changeSelectedConversation(item) { } } }); + setInterval(refreshConversation, 10000); }); })(jQuery, OC);