From f892e93431b85de82d796da0941443f3e995d0c7 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Thu, 20 Oct 2005 11:57:20 +0000 Subject: [PATCH] every table with class data now has mark and hover effect --- ChangeLog | 2 ++ libraries/functions.js | 60 +++++++++++++++++++++++++++++++++++------- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5fd5cde57..5ede09911 100755 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,8 @@ $Source$ * sql.php, footer.inc.php: refresh left frame on view creation * left.php: view icon for views * libraries/left.js: dropped + * libraries/function.js: tuned PMA_merkRowsInit(): + every table with class data now has mark and hover effect 2005-10-19 Alexander M. Turek * lang/*.inc.php, libraries/mysql_charsets.lib.php: Correct description diff --git a/libraries/functions.js b/libraries/functions.js index 0f85529ee..308b63e67 100644 --- a/libraries/functions.js +++ b/libraries/functions.js @@ -465,20 +465,27 @@ var marked_row = new Array; /** * enables highlight and marking of rows in data tables + * */ -function tabdataInit() { +function PMA_markRowsInit() { + // in every table ... var tables = document.getElementsByTagName('table'); for (var t=0; t 0 ) { + unique_id = checkbox.id; + } else { + unique_id = checkbox.name + checkbox.value; + } + } else if ( this.id.length > 0 ) { + unique_id = this.id; } else { - marked_row[this.id] = false; + return; + } + + if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] ) { + marked_row[unique_id] = true; + } else { + marked_row[unique_id] = false; } - if ( marked_row[this.id] ) { + if ( marked_row[unique_id] ) { this.className += ' marked'; } else { this.className = this.className.replace(' marked', ''); } + + if ( checkbox && checkbox.disabled == false ) { + checkbox.checked = marked_row[unique_id]; + } } + + // ... and disable label ... + var labeltag = rows[i].getElementsByTagName('label')[0]; + if ( labeltag ) { + labeltag.onclick = function() { + return false; + } + } + // .. and checkbox clicks + var checkbox = rows[i].getElementsByTagName('input')[0]; + if ( checkbox ) { + checkbox.onclick = function() { + // opera does not recognize return false; + this.checked = ! this.checked; + } + } } } } -window.onload=tabdataInit; +window.onload=PMA_markRowsInit; /** * Sets/unsets the pointer and marker in browse mode