Skip to content
Browse files

Reveal menu items only if mouse is over wide links

  • Loading branch information...
1 parent beafccb commit 5d337fe04cac2060f7884ac268a20d3adca1051e @vrana committed Aug 20, 2012
Showing with 19 additions and 7 deletions.
  1. +2 −2 adminer/include/adminer.inc.php
  2. +14 −2 adminer/static/functions.js
  3. +2 −2 editor/include/adminer.inc.php
  4. +1 −1 plugins/tables-filter.php
View
4 adminer/include/adminer.inc.php
@@ -785,7 +785,7 @@ function navigation($missing) {
foreach ($usernames as $username => $password) {
if ($password !== null) {
if ($first) {
- echo "<p id='logins' onmouseover='menuOver(this);' onmouseout='menuOut(this);'>\n";
+ echo "<p id='logins' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>\n";
$first = false;
}
echo "<a href='" . h(auth_url($driver, $server, $username)) . "'>($drivers[$driver]) " . h($username . ($server != "" ? "@$server" : "")) . "</a><br>\n";
@@ -867,7 +867,7 @@ function databasesPrint($missing) {
* @return null
*/
function tablesPrint($tables) {
- echo "<p id='tables' onmouseover='menuOver(this);' onmouseout='menuOut(this);'>\n";
+ echo "<p id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>\n";
foreach ($tables as $table => $type) {
echo '<a href="' . h(ME) . 'select=' . urlencode($table) . '"' . bold($_GET["select"] == $table) . ">" . lang('select') . "</a> ";
echo '<a href="' . h(ME) . 'table=' . urlencode($table) . '"' . bold($_GET["table"] == $table) . " title='" . lang('Show structure') . "'>" . $this->tableName(array("Name" => $table)) . "</a><br>\n"; //! Adminer::tableName may work with full table status
View
16 adminer/static/functions.js
@@ -209,10 +209,22 @@ function pageClick(href, page, event) {
}
}
-function menuOver(el) {
- el.style.overflow = 'visible';
+
+
+/** Display items in menu
+* @param HTMLElement
+* @param MouseEvent
+*/
+function menuOver(el, event) {
+ var a = event.target;
+ if (/^a$/i.test(a.tagName) && a.offsetLeft + a.offsetWidth > a.parentNode.offsetWidth) {
+ el.style.overflow = 'visible';
+ }
}
+/** Hide items in menu
+* @param HTMLElement
+*/
function menuOut(el) {
el.style.overflow = 'auto';
}
View
4 editor/include/adminer.inc.php
@@ -538,7 +538,7 @@ function navigation($missing) {
foreach ((array) $_SESSION["pwds"]["server"][""] as $username => $password) {
if ($password !== null) {
if ($first) {
- echo "<p id='logins' onmouseover='menuOver(this);' onmouseout='menuOut(this);'>\n";
+ echo "<p id='logins' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>\n";
$first = false;
}
echo "<a href='" . h(auth_url("server", "", $username)) . "'>" . ($username != "" ? h($username) : "<i>" . lang('empty') . "</i>") . "</a><br>\n";
@@ -569,7 +569,7 @@ function databasesPrint($missing) {
}
function tablesPrint($tables) {
- echo "<p id='tables' onmouseover='menuOver(this);' onmouseout='menuOut(this);'>\n";
+ echo "<p id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>\n";
foreach ($tables as $row) {
$name = $this->tableName($row);
if (isset($row["Engine"]) && $name != "") { // ignore views and tables without name
View
2 plugins/tables-filter.php
@@ -23,7 +23,7 @@ function tablesFilter(value) {
</script>
<p class="jsonly"><input onkeyup="tablesFilter(this.value);">
<?php
- echo "<p id='tables' onmouseover='menuOver(this);' onmouseout='menuOut(this);'>\n";
+ echo "<p id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>\n";
foreach ($tables as $table => $type) {
echo '<span><a href="' . h(ME) . 'select=' . urlencode($table) . '"' . bold($_GET["select"] == $table) . ">" . lang('select') . "</a> ";
echo '<a href="' . h(ME) . 'table=' . urlencode($table) . '"' . bold($_GET["table"] == $table) . ">" . h($table) . "</a><br></span>\n";

0 comments on commit 5d337fe

Please sign in to comment.
Something went wrong with that request. Please try again.