]> git.joonet.de Git - adminer.git/commitdiff
Move inline event handlers to <script>
authorJakub Vrana <jakub@vrana.cz>
Fri, 12 Jan 2018 15:29:18 +0000 (16:29 +0100)
committerJakub Vrana <jakub@vrana.cz>
Fri, 12 Jan 2018 16:11:29 +0000 (17:11 +0100)
adminer/db.inc.php
adminer/indexes.inc.php
adminer/schema.inc.php
adminer/sql.inc.php
adminer/user.inc.php

index a096d69934625ca0e30414ecf268ecb83c197c8c..c17f0807b682e91e8a1c247a048e1ce0c48af7cd 100644 (file)
@@ -136,7 +136,8 @@ if ($adminer->homepage()) {
                                        echo (support("copy") ? " <input type='submit' name='copy' value='" . lang('Copy') . "'>" : "");
                                        echo "\n";
                                }
-                               echo "<input type='hidden' name='all' value='' onclick=\"selectCount('selected', formChecked(this, /^(tables|views)\[/));" . (support("table") ? " selectCount('selected2', formChecked(this, /^tables\[/) || $tables);" : "") . "\">\n"; // used by trCheck()
+                               echo "<input type='hidden' name='all' value=''>"; // used by trCheck()
+                               echo script("qsl('input').onclick = function () { selectCount('selected', formChecked(this, /^(tables|views)\[/));" . (support("table") ? " selectCount('selected2', formChecked(this, /^tables\[/) || $tables);" : "") . " }");
                                echo "<input type='hidden' name='token' value='$token'>\n";
                                echo "</div></fieldset>\n";
                        }
index 345123473c2038f3f1dd2ab29a92ec096965eba8..0b43ee3e68cb2e48bf2d0724c543fac3e9a5fab9 100644 (file)
@@ -132,7 +132,7 @@ foreach ($row["indexes"] as $index) {
                }
 
                echo "<td><input name='indexes[$j][name]' value='" . h($index["name"]) . "' autocapitalize='off' aria-labelledby='label-name'>\n";
-               echo "<td><input type='image' class='icon' name='drop_col[$j]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick=\"return editingRemoveRow.call(this, 'indexes\$1[type]');\">\n";
+               echo "<td><input type='image' class='icon' name='drop_col[$j]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "'>" . script("qsl('input').onclick = partial(editingRemoveRow, 'indexes\$1[type]');");
        }
        $j++;
 }
index ff80018ebaf28f5ea92a8818c8ba3939660a6972..ecb8304d2e21ae7b08e8d6da76ce78f02fbd4a9d 100644 (file)
@@ -53,14 +53,13 @@ foreach (table_status('', true) as $table => $table_status) {
 var tablePos = {<?php echo implode(",", $table_pos_js) . "\n"; ?>};
 var em = qs('#schema').offsetHeight / <?php echo $top; ?>;
 document.onmousemove = schemaMousemove;
-document.onmouseup = function (ev) {
-       schemaMouseup(ev, '<?php echo js_escape(DB); ?>');
-};
+document.onmouseup = partialArg(schemaMouseup, '<?php echo js_escape(DB); ?>');
 </script>
 <?php
 foreach ($schema as $name => $table) {
-       echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;' onmousedown='schemaMousedown.call(this, event);'>";
+       echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;'>";
        echo '<a href="' . h(ME) . 'table=' . urlencode($name) . '"><b>' . h($name) . "</b></a>";
+       echo script("qsl('div').onmousedown = schemaMousedown;");
        
        foreach ($table["fields"] as $field) {
                $val = '<span' . type_class($field["type"]) . ' title="' . h($field["full_type"] . ($field["null"] ? " NULL" : '')) . '">' . h($field["field"]) . '</span>';
index a3c5410f5853f688964f524304bcec8d165d51e3..f218dc93ffa0939e764ff01369edaec9b30195e1 100644 (file)
@@ -137,7 +137,7 @@ if (!$error && $_POST) {
                                                                                echo "<p>" . ($num_rows ? ($limit && $num_rows > $limit ? lang('%d / ', $limit) : "") . lang('%d row(s)', $num_rows) : "");
                                                                                echo $time;
                                                                                $id = "export-$commands";
-                                                                               $export = ", <a href='#$id' onclick=\"return toggle('$id');\">" . lang('Export') . "</a><span id='$id' class='hidden'>: "
+                                                                               $export = ", <a href='#$id'>" . lang('Export') . "</a>" . script("qsl('a').onclick = partial(toggle, '$id');", "") . "<span id='$id' class='hidden'>: "
                                                                                        . html_select("output", $adminer->dumpOutput(), $adminer_export["output"]) . " "
                                                                                        . html_select("format", $dump_format, $adminer_export["format"])
                                                                                        . "<input type='hidden' name='query' value='" . h($q) . "'>"
@@ -145,7 +145,7 @@ if (!$error && $_POST) {
                                                                                ;
                                                                                if ($connection2 && preg_match("~^($space|\\()*+SELECT\\b~i", $q) && ($explain = explain($connection2, $q))) {
                                                                                        $id = "explain-$commands";
-                                                                                       echo ", <a href='#$id' onclick=\"return toggle('$id');\">EXPLAIN</a>$export";
+                                                                                       echo ", <a href='#$id'>EXPLAIN</a>" . script("qsl('a').onclick = partial(toggle, '$id');", "") . $export;
                                                                                        echo "<div id='$id' class='hidden'>\n";
                                                                                        select($explain, $connection2, $orgtables);
                                                                                        echo "</div>\n";
index c7e859568d78070f9667f95c62efb2582ccdbe1f..59a082e0c8b9f47fa203e006e278d6727ad502e4 100644 (file)
@@ -169,7 +169,11 @@ foreach (array(
                        } elseif (isset($_GET["grant"])) {
                                echo "<td><select name=$name><option><option value='1'" . ($value ? " selected" : "") . ">" . lang('Grant') . "<option value='0'" . ($value == "0" ? " selected" : "") . ">" . lang('Revoke') . "</select>";
                        } else {
-                               echo "<td align='center'><label class='block'><input type='checkbox' name=$name value='1'" . ($value ? " checked" : "") . ($privilege == "All privileges" ? " id='grants-$i-all'" : ($privilege == "Grant option" ? "" : " onclick=\"if (this.checked) formUncheck('grants-$i-all');\"")) . "></label>"; //! uncheck all except grant if all is checked
+                               echo "<td align='center'><label class='block'>";
+                               echo "<input type='checkbox' name=$name value='1'" . ($value ? " checked" : "") . ($privilege == "All privileges"
+                                       ? " id='grants-$i-all'>" //! uncheck all except grant if all is checked
+                                       : ">" . ($privilege == "Grant option" ? "" : script("qsl('input').onclick = function () { if (this.checked) formUncheck('grants-$i-all'); };")));
+                               echo "</label>";
                        }
                        $i++;
                }