]> git.joonet.de Git - adminer.git/commitdiff
JSLint
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 29 May 2009 16:51:21 +0000 (16:51 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 29 May 2009 16:51:21 +0000 (16:51 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@620 7c3ca157-0c34-0410-bff1-cbf682f78f5c

editing.inc.php
functions.js
schema.inc.php

index df06613a22794fd19e9a7a2c2c72d51f8779d36d..f9368b17a55cb4deae4f7ffe5ffebc8dcd7ddb0d 100644 (file)
@@ -124,12 +124,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0) {
 <td><input type="radio" name="auto_increment_col" value="" /><?php echo lang('Auto Increment'); ?></td>
 <td<?php echo ($column_comments ? "" : " class='hidden'"); ?>><?php echo lang('Comment'); ?></td>
 <?php } ?>
-<td><input type="image" name="add[0]" src="plus.gif" title="<?php echo lang('Add next'); ?>" />
-<script type="text/javascript">
-var added = '.';
-var row_count = <?php echo count($fields); ?>;
-</script>
-</td>
+<td><input type="image" name="add[0]" src="plus.gif" title="<?php echo lang('Add next'); ?>" /><script type="text/javascript">row_count = <?php echo count($fields); ?>;</script></td>
 </tr></thead>
 <?php
        foreach ($fields as $i => $field) {
index bb3c242ce0eaea8ef4f5d95e9b15fcae782dd94f..d82f24f657bda6d7025615bd5a1adf7c6c7e50c4 100644 (file)
@@ -1,3 +1,5 @@
+document.body.className = 'js';
+
 function toggle(id) {
        var el = document.getElementById(id);
        el.className = (el.className == 'hidden' ? '' : 'hidden');
@@ -20,6 +22,8 @@ function tables_check(el) {
        }
 }
 
+
+
 function where_change(op) {
        for (var i=0; i < op.form.elements.length; i++) {
                var el = op.form.elements[i];
@@ -46,11 +50,15 @@ function select_add_row(field) {
        field.onchange = function () { };
 }
 
+
+
+var added = '.', row_count;
+
 function editing_add_row(button, allowed) {
        if (allowed && row_count >= allowed) {
                return false;
        }
-       var match = /([0-9]+)(\.[0-9]+)?/.exec(button.name)
+       var match = /([0-9]+)(\.[0-9]+)?/.exec(button.name);
        var x = match[0] + (match[2] ? added.substr(match[2].length) : added) + '1';
        var row = button.parentNode.parentNode;
        var row2 = row.cloneNode(true);
@@ -119,6 +127,8 @@ function partition_name_change(el) {
        el.onchange = function () {};
 }
 
+
+
 function foreign_add_row(field) {
        var row = field.parentNode.parentNode.cloneNode(true);
        var selects = row.getElementsByTagName('select');
@@ -130,6 +140,8 @@ function foreign_add_row(field) {
        field.onchange = function () { };
 }
 
+
+
 function indexes_add_row(field) {
        var row = field.parentNode.parentNode.cloneNode(true);
        var spans = row.getElementsByTagName('span');
@@ -158,9 +170,12 @@ function indexes_add_column(field) {
        field.onchange = function () { };
 }
 
-function schema_mousedown(el, event, top) {
+
+
+var that, x, y, em, table_pos;
+
+function schema_mousedown(el, event) {
        that = el;
-       em = document.getElementById('schema').offsetHeight / top;
        x = event.clientX - el.offsetLeft;
        y = event.clientY - el.offsetTop;
 }
@@ -223,6 +238,8 @@ function schema_mouseup(ev) {
        }
 }
 
+
+
 function dump_check(a, name, value) {
        var inputs = a.parentNode.parentNode.parentNode.parentNode.getElementsByTagName('input');
        for (var i=0; i < inputs.length; i++) {
@@ -232,5 +249,3 @@ function dump_check(a, name, value) {
        }
        return true;
 }
-
-document.body.className = 'js';
index 44e97bc07bfc22030fed12b0a669b1406c31718e..0d78224e83529411512760fdd63a847d315200d3 100644 (file)
@@ -50,17 +50,16 @@ while ($row = $result->fetch_assoc()) {
 $result->free();
 
 ?>
+<div id="schema" style="height: <?php echo $top; ?>em;">
 <script type="text/javascript">
-var that, x, y, em;
-var table_pos = {<?php echo implode(",", $table_pos_js) . "\n"; ?>};
+table_pos = {<?php echo implode(",", $table_pos_js) . "\n"; ?>};
+em = document.getElementById('schema').offsetHeight / <?php echo $top; ?>;
 document.onmousemove = schema_mousemove;
 document.onmouseup = schema_mouseup;
 </script>
-
-<div id="schema" style="height: <?php echo $top; ?>em;">
 <?php
 foreach ($schema as $name => $table) {
-       echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;' onmousedown='schema_mousedown(this, event, $top);'>";
+       echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;' onmousedown='schema_mousedown(this, event);'>";
        echo '<a href="' . htmlspecialchars($SELF) . 'table=' . urlencode($name) . '"><strong>' . htmlspecialchars($name) . "</strong></a><br />\n";
        foreach ($table["fields"] as $field) {
                $val = htmlspecialchars($field["field"]);