Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-03-28 13:34:58 +01:00
commit aea91a6f21
2 changed files with 58 additions and 30 deletions

View File

@ -45,6 +45,7 @@ phpMyAdmin - ChangeLog
+ rfe #420 $cfg['CharEditing']='textarea' for structure edit
4.1.13.0 (not yet released)
- bug #4279 CTRL + up or down moves 2 fields
4.1.12.0 (2014-03-27)
- bug #4334 Add event : datepicker won't open

View File

@ -1,8 +1,7 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
// gloabl vars to hold Arrow Down event timeStamps
var prevTimeStamp = 0;
var curTimeStamp = 0;
// global var that holds: 0- if ctrl key is not pressed 1- if ctrl key is pressed
var ctrlKeyHistory = 0;
/**
* Allows moving around inputs/select by Ctrl+arrows
@ -13,16 +12,6 @@ function onKeyDownArrowsHandler(e)
{
e = e || window.event;
curTimeStamp = e.timeStamp;
if( prevTimeStamp == 0 ) {
prevTimeStamp = curTimeStamp;
}
else if( Math.abs(curTimeStamp-prevTimeStamp) < 150 ) {
// event in a very quick succession
return;
}
prevTimeStamp = curTimeStamp;
var o = (e.srcElement || e.target);
if (!o) {
return;
@ -30,19 +19,31 @@ function onKeyDownArrowsHandler(e)
if (o.tagName != "TEXTAREA" && o.tagName != "INPUT" && o.tagName != "SELECT") {
return;
}
if (navigator.userAgent.toLowerCase().indexOf('applewebkit/') != -1) {
if (e.ctrlKey || e.shiftKey || !e.altKey) {
return;
}
} else {
if (!e.ctrlKey || e.shiftKey || e.altKey) {
return;
}
if ((e.which != 17) && (e.which != 37) && (e.which != 38) && (e.which != 39) && (e.which !=40)) {
return;
}
if (!o.id) {
return;
}
if (e.type == "keyup") {
if (e.which==17) {
ctrlKeyHistory = 0;
}
return;
}
else if (e.type == "keydown") {
if (e.which == 17) {
ctrlKeyHistory = 1;
}
}
if (ctrlKeyHistory != 1) {
return;
}
e.preventDefault();
var pos = o.id.split("_");
if (pos[0] != "field" || typeof pos[2] == "undefined") {
return;
@ -75,11 +76,6 @@ function onKeyDownArrowsHandler(e)
var is_firefox = navigator.userAgent.toLowerCase().indexOf("firefox/") > -1;
// restore selected index, bug #3799
if (is_firefox && e.type == "keyup") {
o.selectedIndex = window["selectedIndex_" + o.id];
}
var id = "field_" + y + "_" + x;
nO = document.getElementById(id);
if (! nO) {
@ -91,12 +87,43 @@ function onKeyDownArrowsHandler(e)
if (! nO) {
return;
}
if (e.type == "keydown") {
nO.focus();
if (is_firefox) {
window["selectedIndex_" + nO.id] = nO.selectedIndex;
// for firefox select tag
var lvalue = o.selectedIndex;
var nOvalue = nO.selectedIndex;
nO.focus();
if (is_firefox) {
var ffcheck = 0;
var ffversion;
for (ffversion = 3 ; ffversion < 25 ; ffversion++) {
var is_firefox_v_24 = navigator.userAgent.toLowerCase().indexOf('firefox/'+ffversion) > -1;
if (is_firefox_v_24) {
ffcheck = 1;
break;
}
}
if (ffcheck == 1) {
if (e.which == 38 || e.which == 37) {
nOvalue++;
}
else if (e.which == 40 || e.which == 39) {
nOvalue--;
}
nO.selectedIndex=nOvalue;
}
else {
if (e.which == 38 || e.which == 37) {
lvalue++;
}
else if (e.which == 40 || e.which == 39) {
lvalue--;
}
o.selectedIndex=lvalue;
}
}
if (nO.tagName != 'SELECT') {
nO.select();
}