mirror of
				https://github.com/nerzhul/ocsms.git
				synced 2025-10-31 02:17:38 +00:00 
			
		
		
		
	Added a function to add a style when a conversation is selected
This commit is contained in:
		
							parent
							
								
									b4b93a2f0c
								
							
						
					
					
						commit
						01ff6a2099
					
				
							
								
								
									
										16
									
								
								js/script.js
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								js/script.js
									
									
									
									
									
								
							| @ -8,6 +8,10 @@ | |||||||
|  * @copyright Loic Blot 2014 |  * @copyright Loic Blot 2014 | ||||||
|  */ |  */ | ||||||
|   |   | ||||||
|  | 
 | ||||||
|  | // Some global vars to improve performances
 | ||||||
|  | var selectedConversation = null; | ||||||
|  | 
 | ||||||
| function fetchConversation(phoneNumber) { | function fetchConversation(phoneNumber) { | ||||||
| 	$.getJSON(OC.generateUrl('/apps/ocsms/get/conversation'), | 	$.getJSON(OC.generateUrl('/apps/ocsms/get/conversation'), | ||||||
| 		{'phoneNumber': phoneNumber}, | 		{'phoneNumber': phoneNumber}, | ||||||
| @ -47,13 +51,22 @@ function fetchConversation(phoneNumber) { | |||||||
| 		} | 		} | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | function changeSelectedConversation(item) { | ||||||
|  | 	if (selectedConversation != null) { | ||||||
|  | 		selectedConversation.removeClass('active'); | ||||||
|  | 	} | ||||||
|  | 	selectedConversation = $(this); | ||||||
|  | 	selectedConversation.addClass('active'); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| (function ($, OC) { | (function ($, OC) { | ||||||
| 	$(document).ready(function () { | 	$(document).ready(function () { | ||||||
| 		// Now bind the events when we click on the phone number
 | 		// Now bind the events when we click on the phone number
 | ||||||
| 		$('#app-navigation').find('a').on('click', function (event) { | 		$('#app-navigation').find('a').on('click', function (event) { | ||||||
| 			OC.Util.History.pushState('feed=' + $(this).attr('nav-feed')); | 			OC.Util.History.pushState('feed=' + $(this).attr('nav-feed')); | ||||||
| 			event.preventDefault(); | 			event.preventDefault(); | ||||||
|         }); | 		}); | ||||||
| 
 | 
 | ||||||
| 		$.getJSON(OC.generateUrl('/apps/ocsms/get/peerlist'), function(jsondata, status) { | 		$.getJSON(OC.generateUrl('/apps/ocsms/get/peerlist'), function(jsondata, status) { | ||||||
| 			// Use a buffer for better jQuery performance
 | 			// Use a buffer for better jQuery performance
 | ||||||
| @ -70,6 +83,7 @@ function fetchConversation(phoneNumber) { | |||||||
| 				var phoneNumber = $(this).attr('mailbox-navigation'); | 				var phoneNumber = $(this).attr('mailbox-navigation'); | ||||||
| 				OC.Util.History.pushState('phonenumber=' + phoneNumber); | 				OC.Util.History.pushState('phonenumber=' + phoneNumber); | ||||||
| 				fetchConversation(phoneNumber); | 				fetchConversation(phoneNumber); | ||||||
|  | 				changeSelectedConversation($(this)); | ||||||
| 				event.preventDefault(); | 				event.preventDefault(); | ||||||
| 			}); | 			}); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user