Preserve highlighted row during context menu operation
authorJoey Schulze <joey@infodrom.org>
Fri, 25 Dec 2009 20:56:35 +0000 (21:56 +0100)
committerJoey Schulze <joey@infodrom.org>
Fri, 25 Feb 2011 17:40:23 +0000 (18:40 +0100)
lib/basics.js
phone.js

index d548e3d..521533b 100644 (file)
@@ -57,6 +57,8 @@ function ajax_request(func,params,oncomplete)
 function menu_hide(e)
 {
     e.target.parentNode.style.display = 'none';
+    if (e.target.parentNode.payload['row'] != undefined)
+       e.target.parentNode.payload['row'].style.backgroundColor = '';
 }
 
 function menu_create(id,data)
index 73bc2b5..f5932f3 100644 (file)
--- a/phone.js
+++ b/phone.js
@@ -6,6 +6,8 @@ var menu_list = {
               {'name': 'Cancel', 'type': 'hide'}]
 };
 
+var hover_color = '#c9e5ff';
+
 function page_init()
 {
     var frame = document.getElementById('phonecall');
@@ -130,6 +132,7 @@ function play_message(event)
 {
     var frame = document.getElementById('phonecall');
     var params = 'dir='+event.originalTarget.payload['dir']+'&call='+event.originalTarget.payload['call'];
+
     ajax_request('callinfo', params, play_message_callback);
     frame.src = 'index.php?'+params;
     event.originalTarget.className = '';
@@ -155,6 +158,9 @@ function save()
 
 function list_context(e)
 {
+    var target = e.target;
+    target.style.backgroundColor = hover_color;
+
     var menu = document.getElementById('menu_list');
     if (!menu)
         menu = menu_create('menu_list', menu_list);
@@ -165,6 +171,7 @@ function list_context(e)
     menu.payload = new Array();
     menu.payload['dir'] = e.target.payload['dir'];
     menu.payload['call'] = e.target.payload['call'];
+    menu.payload['row'] = target;
 
     return false;
 }
@@ -203,6 +210,7 @@ function menu_list_archive(e)
        ajax_request('archive_call', 'call='+e.target.parentNode.payload['call'], menu_list_archive_callback);
 
     e.target.parentNode.style.display = 'none';
+    e.target.parentNode.payload['row'].style.backgroundColor = '';
 }
 
 function menu_list_edit(e)
@@ -211,6 +219,7 @@ function menu_list_edit(e)
     ajax_request('callinfo', params, menu_list_edit_callback);
 
     e.target.parentNode.style.display = 'none';
+    e.target.parentNode.payload['row'].style.backgroundColor = '';
 
     var edit = document.getElementById('container_edit');
     var config = document.getElementById('container_config');
@@ -225,6 +234,7 @@ function menu_list_delete(e)
     ajax_request('delete_call', params, menu_list_archive_callback);
 
     e.target.parentNode.style.display = 'none';
+    e.target.parentNode.payload['row'].style.backgroundColor = '';
 }
 
 function fetch_messages_callback(data)