Skip to content

Commit

Permalink
Define JS functions in AdminerTablesFilter sooner
Browse files Browse the repository at this point in the history
  • Loading branch information
vrana committed Jan 19, 2018
1 parent 1b98a10 commit 2dcad1f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
3 changes: 3 additions & 0 deletions adminer/static/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,9 @@ function findDefaultSubmit(el) {
if (el.jushTextarea) {
el = el.jushTextarea;
}
if (!el.form) {
return null;
}
var inputs = qsa('input', el.form);
for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];
Expand Down
32 changes: 16 additions & 16 deletions plugins/tables-filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,6 @@
*/
class AdminerTablesFilter {
function tablesPrint($tables) { ?>
<p class="jsonly"><input id="filter-field" autocomplete="off"><?php echo script("qs('#filter-field').oninput = tablesFilterInput;"); ?>
<ul id='tables'>
<?php
echo script("mixin(qs('#tables'), {onmouseover: menuOver, onmouseout: menuOut});");
foreach ($tables as $table => $status) {
echo '<li data-table-name="' . h($table) . '"><a href="' . h(ME) . 'select=' . urlencode($table) . '"' . bold($_GET["select"] == $table || $_GET["edit"] == $table, "select") . ">" . lang('select') . "</a> ";
$name = h($status["Name"]);
echo (support("table") || support("indexes")
? '<a href="' . h(ME) . 'table=' . urlencode($table) . '"'
. bold(in_array($table, array($_GET["table"], $_GET["create"], $_GET["indexes"], $_GET["foreign"], $_GET["trigger"])), (is_view($status) ? "view" : "structure"))
. " title='" . lang('Show structure') . "'>$name</a>"
: "<span>$name</span>"
) . "\n";
}
?>
</ul>
<script<?php echo nonce(); ?>>
var tablesFilterTimeout = null;
var tablesFilterValue = '';
Expand Down Expand Up @@ -70,6 +54,22 @@ function tablesFilterInput() {
sessionStorage.setItem('adminer_tables_filter_db', db);
}
</script>
<p class="jsonly"><input id="filter-field" autocomplete="off"><?php echo script("qs('#filter-field').oninput = tablesFilterInput;"); ?>
<ul id='tables'>
<?php
echo script("mixin(qs('#tables'), {onmouseover: menuOver, onmouseout: menuOut});");
foreach ($tables as $table => $status) {
echo '<li data-table-name="' . h($table) . '"><a href="' . h(ME) . 'select=' . urlencode($table) . '"' . bold($_GET["select"] == $table || $_GET["edit"] == $table, "select") . ">" . lang('select') . "</a> ";
$name = h($status["Name"]);
echo (support("table") || support("indexes")
? '<a href="' . h(ME) . 'table=' . urlencode($table) . '"'
. bold(in_array($table, array($_GET["table"], $_GET["create"], $_GET["indexes"], $_GET["foreign"], $_GET["trigger"])), (is_view($status) ? "view" : "structure"))
. " title='" . lang('Show structure') . "'>$name</a>"
: "<span>$name</span>"
) . "\n";
}
?>
</ul>
<?php
return true;
}
Expand Down

0 comments on commit 2dcad1f

Please sign in to comment.