Avoid qsl in a loop
Table with 500 rows rendered in 1.5 instead of 5.5 seconds.
This commit is contained in:
parent
14998e12b6
commit
4b45722fad
|
@ -440,8 +440,10 @@ if (!$columns && support("table")) {
|
||||||
echo "<td>" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>");
|
echo "<td>" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>");
|
||||||
} else {
|
} else {
|
||||||
$long = strpos($val, "<i>...</i>");
|
$long = strpos($val, "<i>...</i>");
|
||||||
echo "<td id='$id'>$val</td>";
|
echo "<td id='$id' data-text='" . ($long ? 2 : ($text ? 1 : 0)) . "'"
|
||||||
echo script("qsl('td').onclick = partialArg(selectClick, " . ($long ? 2 : ($text ? 1 : 0)) . ($editable ? "" : ", '" . h(lang('Use edit link to modify this value.')) . "'") . ");", "");
|
. ($editable ? "" : " data-warning='" . h(lang('Use edit link to modify this value.')) . "'")
|
||||||
|
. ">$val</td>"
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,6 +246,13 @@ function formChecked(el, name) {
|
||||||
* @param [boolean] force click
|
* @param [boolean] force click
|
||||||
*/
|
*/
|
||||||
function tableClick(event, click) {
|
function tableClick(event, click) {
|
||||||
|
var td = parentTag(getTarget(event), 'td');
|
||||||
|
var text;
|
||||||
|
if (td && (text = td.getAttribute('data-text'))) {
|
||||||
|
if (selectClick.call(td, event, +text, td.getAttribute('data-warning'))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
click = (click || !window.getSelection || getSelection().isCollapsed);
|
click = (click || !window.getSelection || getSelection().isCollapsed);
|
||||||
var el = getTarget(event);
|
var el = getTarget(event);
|
||||||
while (!isTag(el, 'tr')) {
|
while (!isTag(el, 'tr')) {
|
||||||
|
@ -667,6 +674,7 @@ function ajaxForm(form, message, button) {
|
||||||
* @param MouseEvent
|
* @param MouseEvent
|
||||||
* @param number display textarea instead of input, 2 - load long text
|
* @param number display textarea instead of input, 2 - load long text
|
||||||
* @param [string] warning to display
|
* @param [string] warning to display
|
||||||
|
* @return boolean
|
||||||
* @this HTMLElement
|
* @this HTMLElement
|
||||||
*/
|
*/
|
||||||
function selectClick(event, text, warning) {
|
function selectClick(event, text, warning) {
|
||||||
|
@ -676,7 +684,8 @@ function selectClick(event, text, warning) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (warning) {
|
if (warning) {
|
||||||
return alert(warning);
|
alert(warning);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
var original = td.innerHTML;
|
var original = td.innerHTML;
|
||||||
text = text || /\n/.test(original);
|
text = text || /\n/.test(original);
|
||||||
|
@ -732,6 +741,7 @@ function selectClick(event, text, warning) {
|
||||||
range.moveEnd('character', -input.value.length + pos);
|
range.moveEnd('character', -input.value.length + pos);
|
||||||
range.select();
|
range.select();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
Adminer 4.6.1-dev:
|
Adminer 4.6.1-dev:
|
||||||
|
Speed up rendering of long tables
|
||||||
MySQL: Support non-utf8 charset in search in column
|
MySQL: Support non-utf8 charset in search in column
|
||||||
MySQL: Support geometry in MySQL 8 (bug #574)
|
MySQL: Support geometry in MySQL 8 (bug #574)
|
||||||
SQLite: Allow deleting PRIMARY KEY from tables with auto increment
|
SQLite: Allow deleting PRIMARY KEY from tables with auto increment
|
||||||
|
|
Loading…
Reference in a new issue