Don't select row on double click

This commit is contained in:
Jakub Vrana 2012-10-04 00:42:56 -07:00
parent 7865695a86
commit 7015fd9706
6 changed files with 9 additions and 7 deletions

View file

@ -54,7 +54,7 @@ if ($adminer->homepage()) {
if ($_POST["search"] && $_POST["query"] != "") { if ($_POST["search"] && $_POST["query"] != "") {
search_tables(); search_tables();
} }
echo "<table cellspacing='0' class='nowrap checkable' onclick='tableClick(event);'>\n"; echo "<table cellspacing='0' class='nowrap checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);'>\n";
echo '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^(tables|views)\[/);">'; echo '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^(tables|views)\[/);">';
echo '<th>' . lang('Table'); echo '<th>' . lang('Table');
echo '<td>' . lang('Engine'); echo '<td>' . lang('Engine');

View file

@ -29,7 +29,7 @@ function connect_error() {
$scheme = support("scheme"); $scheme = support("scheme");
$collations = collations(); $collations = collations();
echo "<form action='' method='post'>\n"; echo "<form action='' method='post'>\n";
echo "<table cellspacing='0' class='checkable' onclick='tableClick(event);'>\n"; echo "<table cellspacing='0' class='checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);'>\n";
echo "<thead><tr><td>&nbsp;<th>" . lang('Database') . "<td>" . lang('Collation') . "<td>" . lang('Tables') . "</thead>\n"; echo "<thead><tr><td>&nbsp;<th>" . lang('Database') . "<td>" . lang('Collation') . "<td>" . lang('Tables') . "</thead>\n";
foreach ($databases as $db) { foreach ($databases as $db) {
$root = h(ME) . "db=" . urlencode($db); $root = h(ME) . "db=" . urlencode($db);

View file

@ -13,7 +13,7 @@ page_header(lang('Process list'), $error);
?> ?>
<form action="" method="post"> <form action="" method="post">
<table cellspacing="0" onclick="tableClick(event);" class="nowrap checkable"> <table cellspacing="0" onclick="tableClick(event);" ondblclick="tableClick(event, true);" class="nowrap checkable">
<?php <?php
// HTML valid because there is always at least one process // HTML valid because there is always at least one process
$i = -1; $i = -1;

View file

@ -282,7 +282,7 @@ if (!$columns) {
} else { } else {
$backward_keys = $adminer->backwardKeys($TABLE, $table_name); $backward_keys = $adminer->backwardKeys($TABLE, $table_name);
echo "<table id='table' cellspacing='0' class='nowrap checkable' onclick='tableClick(event);' onkeydown='return editingKeydown(event);'>\n"; echo "<table id='table' cellspacing='0' class='nowrap checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);' onkeydown='return editingKeydown(event);'>\n";
echo "<thead><tr>" . (!$group && $select ? "" : "<td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);'> <a href='" . h($_GET["modify"] ? remove_from_uri("modify") : $_SERVER["REQUEST_URI"] . "&modify=1") . "'>" . lang('edit') . "</a>"); echo "<thead><tr>" . (!$group && $select ? "" : "<td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);'> <a href='" . h($_GET["modify"] ? remove_from_uri("modify") : $_SERVER["REQUEST_URI"] . "&modify=1") . "'>" . lang('edit') . "</a>");
$names = array(); $names = array();
$functions = array(); $functions = array();

View file

@ -114,9 +114,10 @@ function formChecked(el, name) {
/** Select clicked row /** Select clicked row
* @param MouseEvent * @param MouseEvent
* @param [boolean] force click
*/ */
function tableClick(event) { function tableClick(event, click) {
var click = (!window.getSelection || getSelection().isCollapsed); click = (click || !window.getSelection || getSelection().isCollapsed);
var el = event.target || event.srcElement; var el = event.target || event.srcElement;
while (!/^tr$/i.test(el.tagName)) { while (!/^tr$/i.test(el.tagName)) {
if (/^(table|a|input|textarea)$/i.test(el.tagName)) { if (/^(table|a|input|textarea)$/i.test(el.tagName)) {
@ -130,7 +131,7 @@ function tableClick(event) {
} }
el = el.firstChild.firstChild; el = el.firstChild.firstChild;
if (click) { if (click) {
el.click && el.click(); el.checked = !el.checked;
el.onclick && el.onclick(); el.onclick && el.onclick();
} }
trCheck(el); trCheck(el);

View file

@ -1,5 +1,6 @@
Adminer 3.6.2-dev: Adminer 3.6.2-dev:
Edit values by Ctrl+click instead of double click Edit values by Ctrl+click instead of double click
Don't select row on double click
Shorten values in varchar fields Shorten values in varchar fields
Display table default values on wide screens Display table default values on wide screens
Fix switching language on first load Fix switching language on first load