Use Option key for Safari for moving (bug #1094137), move key handler function to separate file so we have only one, make movement work correctly in vertical display of properties.
This commit is contained in:
@@ -5,6 +5,13 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$Source$
|
||||
|
||||
2005-01-07 Michal Čihař <michal@cihar.com>
|
||||
* Documentation.html, tbl_change.php, tbl_properties.inc.php,
|
||||
libraries/functions.js, libraries/tbl_change.js,
|
||||
libraries/keyhandler.js: Use Option key for Safari for moving (bug
|
||||
#1094137), move key handler function to separate file so we have only
|
||||
one, make movement work correctly in vertical display of properties.
|
||||
|
||||
2005-01-06 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* tbl_change.php: removed old PHP3-workaround that caused problems
|
||||
with field names like '000'
|
||||
|
@@ -1540,7 +1540,7 @@ Defaults to FALSE (drop-down). <br />
|
||||
<b>$cfg['CtrlArrowsMoving'] </b>boolean<br />
|
||||
</dt>
|
||||
<dd>
|
||||
Enable Ctrl+Arrows moving between fields when editing?
|
||||
Enable Ctrl+Arrows (Option+Arrows in Safari) moving between fields when editing?
|
||||
<br /><br />
|
||||
</dd>
|
||||
|
||||
@@ -3572,7 +3572,7 @@ To create a new, empty mimetype please see libraries/transformations/template_ge
|
||||
[6.16] How can I simply move in page with plenty editing fields?
|
||||
</h4>
|
||||
<p>
|
||||
You can use Ctrl+arrows for moving on most pages with plenty editing
|
||||
You can use Ctrl+arrows (Option+Arrows in Safari) for moving on most pages with plenty editing
|
||||
fields (table structure changes, row editing, etc.) (must be enabled in
|
||||
configuration - see. <a href="#CtrlArrowsMoving">$cfg['CtrlArrowsMoving']</a>). You can also have a look
|
||||
at the directive <a href="#DefaultPropDisplay">$cfg['DefaultPropDisplay']</a> ('vertical') and see if this
|
||||
|
@@ -745,48 +745,6 @@ function setSelectOptions(the_form, the_select, do_check)
|
||||
return true;
|
||||
} // end of the 'setSelectOptions()' function
|
||||
|
||||
/**
|
||||
* Allows moving around inputs/select by Ctrl+arrows
|
||||
*
|
||||
* @param object event data
|
||||
*/
|
||||
function onKeyDownArrowsHandler(e) {
|
||||
e = e||window.event;
|
||||
var o = (e.srcElement||e.target);
|
||||
if (!o) return;
|
||||
if (o.tagName != "TEXTAREA" && o.tagName != "INPUT" && o.tagName != "SELECT") return;
|
||||
if (!e.ctrlKey) return;
|
||||
if (!o.id) return;
|
||||
|
||||
var pos = o.id.split("_");
|
||||
if (pos[0] != "field" || typeof pos[2] == "undefined") return;
|
||||
|
||||
var x = pos[2], y=pos[1];
|
||||
|
||||
// skip non existent fields
|
||||
for (i=0; i<10; i++)
|
||||
{
|
||||
switch(e.keyCode) {
|
||||
case 38: y--; break; // up
|
||||
case 40: y++; break; // down
|
||||
case 37: x--; break; // left
|
||||
case 39: x++; break; // right
|
||||
default: return;
|
||||
}
|
||||
|
||||
var id = "field_" + y + "_" + x;
|
||||
var nO = document.getElementById(id);
|
||||
if (nO) break;
|
||||
}
|
||||
|
||||
if (!nO) return;
|
||||
nO.focus();
|
||||
if (nO.tagName != 'SELECT') {
|
||||
nO.select();
|
||||
}
|
||||
e.returnValue = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts multiple fields.
|
||||
*
|
||||
|
59
libraries/keyhandler.js
Normal file
59
libraries/keyhandler.js
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Allows moving around inputs/select by Ctrl+arrows
|
||||
*
|
||||
* @param object event data
|
||||
*/
|
||||
function onKeyDownArrowsHandler(e) {
|
||||
e = e||window.event;
|
||||
var o = (e.srcElement||e.target);
|
||||
if (!o) return;
|
||||
if (o.tagName != "TEXTAREA" && o.tagName != "INPUT" && o.tagName != "SELECT") return;
|
||||
if (navigator.userAgent.toLowerCase().indexOf('aplewebkit/') != -1) {
|
||||
if (e.ctrlKey || e.shiftKey || !e.altKey) return;
|
||||
} else {
|
||||
if (!e.ctrlKey || e.shiftKey || e.altKey) return;
|
||||
}
|
||||
if (!o.id) return;
|
||||
|
||||
var pos = o.id.split("_");
|
||||
if (pos[0] != "field" || typeof pos[2] == "undefined") return;
|
||||
|
||||
var x = pos[2], y=pos[1];
|
||||
|
||||
// skip non existent fields
|
||||
for (i=0; i<10; i++)
|
||||
{
|
||||
if (switch_movement) {
|
||||
switch(e.keyCode) {
|
||||
case 38: x--; break; // up
|
||||
case 40: x++; break; // down
|
||||
case 37: y--; break; // left
|
||||
case 39: y++; break; // right
|
||||
default: return;
|
||||
}
|
||||
} else {
|
||||
switch(e.keyCode) {
|
||||
case 38: y--; break; // up
|
||||
case 40: y++; break; // down
|
||||
case 37: x--; break; // left
|
||||
case 39: x++; break; // right
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
||||
var id = "field_" + y + "_" + x;
|
||||
var nO = document.getElementById(id);
|
||||
if (!nO) {
|
||||
var id = "field_" + y + "_" + x + "_0";
|
||||
var nO = document.getElementById(id);
|
||||
}
|
||||
if (nO) break;
|
||||
}
|
||||
|
||||
if (!nO) return;
|
||||
nO.focus();
|
||||
if (nO.tagName != 'SELECT') {
|
||||
nO.select();
|
||||
}
|
||||
e.returnValue = false;
|
||||
}
|
@@ -69,53 +69,6 @@ function unNullify(urlField, multi_edit)
|
||||
return true;
|
||||
} // end of the 'unNullify()' function
|
||||
|
||||
/**
|
||||
* Allows moving around inputs/select by Ctrl+arrows
|
||||
*
|
||||
* @param object event data
|
||||
*/
|
||||
function onKeyDownArrowsHandler(e) {
|
||||
e = e||window.event;
|
||||
var o = (e.srcElement||e.target);
|
||||
if (!o) return;
|
||||
if (o.tagName != "TEXTAREA" && o.tagName != "INPUT" && o.tagName != "SELECT") return;
|
||||
if (!e.ctrlKey || e.shiftKey || e.altKey) return;
|
||||
if (!o.id) return;
|
||||
|
||||
var pos = o.id.split("_");
|
||||
if (pos[0] != "field" || typeof pos[2] == "undefined") return;
|
||||
|
||||
var x = pos[2], y=pos[1];
|
||||
|
||||
// skip non existent fields
|
||||
for (i=0; i<10; i++)
|
||||
{
|
||||
switch(e.keyCode) {
|
||||
case 38: y--; break; // up
|
||||
case 40: y++; break; // down
|
||||
case 37: x--; break; // left
|
||||
case 39: x++; break; // right
|
||||
default: return;
|
||||
}
|
||||
|
||||
var id = "field_" + y + "_" + x;
|
||||
var nO = document.getElementById(id);
|
||||
if (!nO) {
|
||||
var id = "field_" + y + "_" + x + "_0";
|
||||
var nO = document.getElementById(id);
|
||||
}
|
||||
if (nO) break;
|
||||
}
|
||||
|
||||
if (!nO) return;
|
||||
nO.focus();
|
||||
if (nO.tagName != 'SELECT') {
|
||||
nO.select();
|
||||
}
|
||||
e.returnValue = false;
|
||||
}
|
||||
|
||||
|
||||
var day;
|
||||
var month;
|
||||
var year;
|
||||
|
@@ -148,8 +148,10 @@ $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5)
|
||||
|
||||
<?php if ($cfg['CtrlArrowsMoving']) { ?>
|
||||
<!-- Set on key handler for moving using by Ctrl+arrows -->
|
||||
<script src="libraries/keyhandler.js" type="text/javascript" language="javascript"></script>
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
var switch_movement = 0;
|
||||
document.onkeydown = onKeyDownArrowsHandler;
|
||||
// -->
|
||||
</script>
|
||||
|
@@ -13,8 +13,10 @@ require_once('./libraries/mysql_charsets.lib.php');
|
||||
?>
|
||||
<?php if ($cfg['CtrlArrowsMoving']) { ?>
|
||||
<!-- Set on key handler for moving using by Ctrl+arrows -->
|
||||
<script src="libraries/keyhandler.js" type="text/javascript" language="javascript"></script>
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
var switch_movement = <?php echo $cfg['DefaultPropDisplay'] == 'horizontal' ? '0' : '1'; ?>;
|
||||
document.onkeydown = onKeyDownArrowsHandler;
|
||||
// -->
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user