Permalink
Browse files

Hide JS only elements with disabled JavaScript

  • Loading branch information...
1 parent 10bb2b1 commit 266d83215db4c9cc31072c7035f051f3fa7504fd @vrana committed Mar 18, 2011
View
@@ -161,7 +161,7 @@
</table>
<p>
<?php echo lang('Auto Increment'); ?>: <input name="Auto_increment" size="6" value="<?php echo h($row["Auto_increment"]); ?>">
-<label><input type="checkbox" onclick="columnShow(this.checked, 5);"><?php echo lang('Default values'); ?></label>
+<label><input type="checkbox" onclick="columnShow(this.checked, 5);" class="jsonly"><?php echo lang('Default values'); ?></label>
<?php echo (support("comment") ? checkbox("", "", $comments, lang('Comment'), "columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus();") . ' <input id="Comment" name="Comment" value="' . h($row["Comment"]) . '" maxlength="60"' . ($comments ? '' : ' class="hidden"') . '>' : ''); ?>
<p>
<input type="submit" value="<?php echo lang('Save'); ?>">
@@ -28,7 +28,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
<link rel="stylesheet" type="text/css" href="adminer.css">
<?php } ?>
-<body class="<?php echo lang('ltr'); ?>" onclick="return bodyClick(event, '<?php echo js_escape(DB); ?>', '<?php echo js_escape($_GET["ns"]); ?>');" onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion('$protocol');"); ?>">
+<body class="<?php echo lang('ltr'); ?> nojs" onclick="return bodyClick(event, '<?php echo js_escape(DB); ?>', '<?php echo js_escape($_GET["ns"]); ?>');" onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion('$protocol');"); ?>">
<script type="text/javascript">
var areYouSure = '<?php echo lang('Are you sure?'); ?>';
</script>
@@ -91,7 +91,7 @@ function nl_br($string) {
function checkbox($name, $value, $checked, $label = "", $onclick = "") {
static $id = 0;
$id++;
- $return = "<input type='checkbox'" . ($name ? " name='$name' value='" . h($value) . "'" : "") . ($checked ? " checked" : "") . ($onclick ? " onclick=\"$onclick\"" : "") . " id='checkbox-$id'>";
+ $return = "<input type='checkbox'" . ($name ? " name='$name' value='" . h($value) . "'" : " class='jsonly'") . ($checked ? " checked" : "") . ($onclick ? " onclick=\"$onclick\"" : "") . " id='checkbox-$id'>";
return ($label != "" ? "<label for='checkbox-$id'>$return" . h($label) . "</label>" : $return);
}
View
@@ -394,7 +394,7 @@
if (!information_schema(DB)) {
?>
<fieldset><legend><?php echo lang('Edit'); ?></legend><div>
-<input type="submit" id="save" value="<?php echo lang('Save'); ?>" title="<?php echo lang('Double click on a value to modify it.'); ?>">
+<input type="submit" id="save" value="<?php echo lang('Save'); ?>" title="<?php echo lang('Double click on a value to modify it.'); ?>" class="jsonly">
<input type="submit" name="edit" value="<?php echo lang('Edit'); ?>">
<input type="submit" name="clone" value="<?php echo lang('Clone'); ?>">
<input type="submit" name="delete" value="<?php echo lang('Delete'); ?>" onclick="return confirm('<?php echo lang('Are you sure?'); ?> (' + (this.form['all'].checked ? <?php echo $found_rows; ?> : formChecked(this, /check/)) + ')');">
@@ -20,7 +20,7 @@ code { background: #eee; }
tr:hover td, tr:hover th { background: #ddf; }
pre { margin: 1em 0 0; }
.version { color: #777; font-size: 67%; }
-.js .hidden { display: none; }
+.js .hidden, .nojs .jsonly { display: none; }
.nowrap td, .nowrap th, td.nowrap { white-space: pre; }
.wrap td { white-space: normal; }
.error { color: red; background: #fee; }
@@ -1,5 +1,5 @@
// to hide elements displayed by JavaScript
-document.body.className += ' js';
+document.body.className = document.body.className.replace(/(^|\s)nojs(\s|$)/, '$1js$2');
/** Toggle visibility
* @param string

0 comments on commit 266d832

Please sign in to comment.