mirror of
https://github.com/nerzhul/ocsms.git
synced 2025-06-07 16:06:15 +00:00
When phone number is passed as a param, load the conversation
This commit is contained in:
parent
01ff6a2099
commit
e800822c37
20
js/script.js
20
js/script.js
@ -12,6 +12,17 @@
|
||||
// Some global vars to improve performances
|
||||
var selectedConversation = null;
|
||||
|
||||
// Source: http://www.sitepoint.com/url-parameters-jquery/
|
||||
$.urlParam = function(name){
|
||||
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
|
||||
if (results == null) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return results[1] || 0;
|
||||
}
|
||||
}
|
||||
|
||||
function fetchConversation(phoneNumber) {
|
||||
$.getJSON(OC.generateUrl('/apps/ocsms/get/conversation'),
|
||||
{'phoneNumber': phoneNumber},
|
||||
@ -87,6 +98,15 @@ function changeSelectedConversation(item) {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
var urlPhoneNumber = decodeURIComponent($.urlParam('phonenumber'));
|
||||
if (urlPhoneNumber != null) {
|
||||
fetchConversation(urlPhoneNumber);
|
||||
|
||||
var pObject = $("a[mailbox-navigation='" + urlPhoneNumber + "']");
|
||||
if (pObject != null) {
|
||||
changeSelectedConversation(pObject);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user