From: Joey Schulze Date: Fri, 25 Dec 2009 20:56:35 +0000 (+0100) Subject: Preserve highlighted row during context menu operation X-Git-Url: https://git.infodrom.org/?p=infodrom%2Fphone;a=commitdiff_plain;h=a8f2401383fb9bd1706168c23b4d7a13a8873cb8 Preserve highlighted row during context menu operation --- diff --git a/lib/basics.js b/lib/basics.js index d548e3d..521533b 100644 --- a/lib/basics.js +++ b/lib/basics.js @@ -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) diff --git a/phone.js b/phone.js index 73bc2b5..f5932f3 100644 --- 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)