]> git.joonet.de Git - adminer.git/commitdiff
Reveal menu items only if mouse is over wide links
authorJakub Vrana <jakub@vrana.cz>
Tue, 21 Aug 2012 05:20:22 +0000 (22:20 -0700)
committerJakub Vrana <jakub@vrana.cz>
Tue, 21 Aug 2012 05:20:22 +0000 (22:20 -0700)
adminer/include/adminer.inc.php
adminer/static/functions.js
editor/include/adminer.inc.php
plugins/tables-filter.php

index 65bc2dbbeb09844efa0c53fe020e5dcf4eeb9523..2cd5831e5c942d9ece0067291e5e082ddbe8ce8b 100644 (file)
@@ -785,7 +785,7 @@ DROP PROCEDURE adminer_alter;
                                        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 @@ DROP PROCEDURE adminer_alter;
        * @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
index d502540bbac9d735cccac881836f40225eea012c..df574a4d67b4016be9439112396b4b28f911cabd 100644 (file)
@@ -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';
 }
index 019833b67e77268084a57227513b41eceee09104..ea66d33ff654d3b4a7b02aa08c076ce508dc8021 100644 (file)
@@ -538,7 +538,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
                        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 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
        }
        
        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
index 1c77d26105697e723ac38b6cd22f1b3456ff2d77..bb9664b7e3ae71994654c43f9eb5d93ec5d5c873 100644 (file)
@@ -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";