<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[20749] trunk/wp-admin: Auto-fold the admin menu with CSS, fixes #20642</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/20749">20749</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2012-05-09 03:56:40 +0000 (Wed, 09 May 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Auto-fold the admin menu with CSS, fixes <a href="http://core.trac.wordpress.org/ticket/20642">#20642</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincsscolorsclassicdevcss">trunk/wp-admin/css/colors-classic.dev.css</a></li>
<li><a href="#trunkwpadmincsscolorsfreshdevcss">trunk/wp-admin/css/colors-fresh.dev.css</a></li>
<li><a href="#trunkwpadmincsswpadminrtldevcss">trunk/wp-admin/css/wp-admin-rtl.dev.css</a></li>
<li><a href="#trunkwpadmincsswpadmindevcss">trunk/wp-admin/css/wp-admin.dev.css</a></li>
<li><a href="#trunkwpadminjscommondevjs">trunk/wp-admin/js/common.dev.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincsscolorsclassicdevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/colors-classic.dev.css (20748 => 20749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/colors-classic.dev.css        2012-05-09 03:25:22 UTC (rev 20748)
+++ trunk/wp-admin/css/colors-classic.dev.css        2012-05-09 03:56:40 UTC (rev 20749)
</span><span class="lines">@@ -1443,6 +1443,45 @@
</span><span class="cx">         background-position: 0 -108px;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/* Auto-folding of the admin menu */
+@media only screen and (max-width: 900px) {
+        #adminmenu li.menu-top {
+                border-top-color: #ffffff;
+                border-bottom-color: #cae6ff;
+        }
+
+        #adminmenu li.wp-has-current-submenu,
+        #adminmenu li.current.menu-top {
+                background-color: #5589AA; /* Fallback */
+                background-image: -ms-linear-gradient(bottom, #5589AA, #619bbb); /* IE10 */
+                background-image: -moz-linear-gradient(bottom, #5589AA, #619bbb); /* Firefox */
+                background-image: -o-linear-gradient(bottom, #5589AA, #619bbb); /* Opera */
+                background-image: -webkit-gradient(linear, left bottom, left top, from(#5589AA), to(#619bbb)); /* old Webkit */
+                background-image: -webkit-linear-gradient(bottom, #5589AA, #619bbb); /* new Webkit */
+                background-image: linear-gradient(bottom, #5589AA, #619bbb); /* proposed W3C Markup */
+        }
+
+        #adminmenu li.menu-top li:hover a {
+                background-image: none;
+        }
+
+        #adminmenu li.wp-has-current-submenu,
+        #adminmenu li.current.menu-top {
+                border-top-color: #5A8FAD;
+                border-bottom-color: #5589AA;
+        }
+
+        #adminmenu .wp-has-current-submenu .wp-submenu-wrap {
+                -moz-box-shadow: 2px 2px 5px rgba( 0, 0, 0, 0.4 );
+                -webkit-box-shadow: 2px 2px 5px rgba( 0, 0, 0, 0.4 );
+                box-shadow: 2px 2px 5px rgba( 0, 0, 0, 0.4 );
+        }
+
+        #collapse-button div {
+                background-position: 0 -108px;
+        }
+}
+
</ins><span class="cx"> /* menu and screen icons */
</span><span class="cx"> .icon16,
</span><span class="cx"> .icon32,
</span><span class="lines">@@ -2437,6 +2476,19 @@
</span><span class="cx">         background-position: 0 -72px;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/* Auto-folding of the admin menu for RTL */
+@media only screen and (max-width: 900px) {
+        .rtl #adminmenu .wp-has-current-submenu .wp-submenu-wrap{
+                -moz-box-shadow: -2px 2px 5px rgba( 0, 0, 0, 0.4 );
+                -webkit-box-shadow: -2px 2px 5px rgba( 0, 0, 0, 0.4 );
+                box-shadow: -2px 2px 5px rgba( 0, 0, 0, 0.4 );
+        }
+
+        .rtl #collapse-button div {
+                background-position: 0 -72px;
+        }
+}
+
</ins><span class="cx"> /* edit image */
</span><span class="cx"> .rtl .meta-box-sortables .postbox:hover .handlediv {
</span><span class="cx">         background: transparent url(../images/arrows-vs.png) no-repeat 6px 7px;
</span></span></pre></div>
<a id="trunkwpadmincsscolorsfreshdevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/colors-fresh.dev.css (20748 => 20749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/colors-fresh.dev.css        2012-05-09 03:25:22 UTC (rev 20748)
+++ trunk/wp-admin/css/colors-fresh.dev.css        2012-05-09 03:56:40 UTC (rev 20749)
</span><span class="lines">@@ -1107,16 +1107,58 @@
</span><span class="cx">         background-image: -webkit-linear-gradient(bottom, #dfdfdf, #fff); /* new Webkit */
</span><span class="cx">         background-image: linear-gradient(bottom, #dfdfdf, #fff); /* proposed W3C Markup */
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #collapse-menu:hover #collapse-button {
</span><span class="cx">         border-color: #aaa;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #collapse-button div {
</span><span class="cx">         background: transparent url(../images/arrows.png) no-repeat 0 -72px;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> .folded #collapse-button div {
</span><span class="cx">         background-position: 0 -108px;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/* Auto-folding of the admin menu */
+@media only screen and (max-width: 900px) {
+        #adminmenu li.menu-top {
+                border-top-color: #f9f9f9;
+                border-bottom-color: #dfdfdf;
+        }
+
+        #adminmenu li.wp-has-current-submenu,
+        #adminmenu li.current.menu-top {
+                background-color: #777; /* Fallback */
+                background-image: -ms-linear-gradient(bottom, #6d6d6d, #808080); /* IE10 */
+                background-image: -moz-linear-gradient(bottom, #6d6d6d, #808080); /* Firefox */
+                background-image: -o-linear-gradient(bottom, #6d6d6d, #808080); /* Opera */
+                background-image: -webkit-gradient(linear, left bottom, left top, from(#6d6d6d), to(#808080)); /* old Webkit */
+                background-image: -webkit-linear-gradient(bottom, #6d6d6d, #808080); /* new Webkit */
+                background-image: linear-gradient(bottom, #6d6d6d, #808080); /* proposed W3C Markup */
+        }
+
+        #adminmenu li.menu-top li:hover a {
+                background-image: none;
+        }
+
+        #adminmenu li.wp-has-current-submenu,
+        #adminmenu li.current.menu-top {
+                border-top-color: #808080;
+                border-bottom-color: #6d6d6d;
+        }
+
+        #adminmenu .wp-has-current-submenu .wp-submenu-wrap {
+                -moz-box-shadow: 2px 2px 5px rgba( 0, 0, 0, 0.4 );
+                -webkit-box-shadow: 2px 2px 5px rgba( 0, 0, 0, 0.4 );
+                box-shadow: 2px 2px 5px rgba( 0, 0, 0, 0.4 );
+        }
+
+        #collapse-button div {
+                background-position: 0 -108px;
+        }
+}
+
</ins><span class="cx"> /* menu and screen icons */
</span><span class="cx"> .icon16,
</span><span class="cx"> .icon32,
</span><span class="lines">@@ -2026,6 +2068,19 @@
</span><span class="cx">         background-position: 0 -72px;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/* Auto-folding of the admin menu for RTL */
+@media only screen and (max-width: 900px) {
+        .rtl #adminmenu .wp-has-current-submenu .wp-submenu-wrap{
+                -moz-box-shadow: -2px 2px 5px rgba( 0, 0, 0, 0.4 );
+                -webkit-box-shadow: -2px 2px 5px rgba( 0, 0, 0, 0.4 );
+                box-shadow: -2px 2px 5px rgba( 0, 0, 0, 0.4 );
+        }
+
+        .rtl #collapse-button div {
+                background-position: 0 -72px;
+        }
+}
+
</ins><span class="cx"> /* Edit Image */
</span><span class="cx"> .rtl .meta-box-sortables .postbox:hover .handlediv {
</span><span class="cx">         background: transparent url(../images/arrows.png) no-repeat 6px 7px;
</span></span></pre></div>
<a id="trunkwpadmincsswpadminrtldevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin-rtl.dev.css (20748 => 20749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin-rtl.dev.css        2012-05-09 03:25:22 UTC (rev 20748)
+++ trunk/wp-admin/css/wp-admin-rtl.dev.css        2012-05-09 03:56:40 UTC (rev 20749)
</span><span class="lines">@@ -352,8 +352,7 @@
</span><span class="cx">         left: 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#adminmenu li .wp-submenu,
-.folded #adminmenu .wp-has-current-submenu .wp-submenu {
</del><ins>+#adminmenu li .wp-submenu {
</ins><span class="cx">         left: auto;
</span><span class="cx">         right: 146px;
</span><span class="cx"> }
</span><span class="lines">@@ -498,7 +497,63 @@
</span><span class="cx">         float: right;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/* Auto-folding of the admin menu */
+@media only screen and (max-width: 900px) {
+        #adminmenu li .wp-submenu,
+        #adminmenu .wp-has-current-submenu .wp-submenu {
+                left: auto;
+                right: 26px;
+        }
</ins><span class="cx">
</span><ins>+        #adminmenu li.focused.wp-has-current-submenu .wp-submenu,
+        #adminmenu .wp-has-current-submenu .wp-submenu.sub-open {
+                padding: 0 0 8px 8px;
+        }
+
+        .folded #adminmenu .wp-not-current-submenu li a {
+                padding-left: 0;
+                padding-right: 12px;
+        }
+
+        #adminmenu li li,
+        #adminmenu li li a {
+                padding-left: inherit;
+                padding-right: 0
+        }
+
+        .wp-menu-arrow {
+                -moz-transform: translate( -27px );
+                -webkit-transform: translate( -27px );
+                -o-transform: translate( -27px );
+                -ms-transform: translate( -27px );
+                transform: translate( -27px );
+        }
+
+        #adminmenu .wp-submenu ul {
+                border-width: 0 1px 0 0;
+        }
+
+        #adminmenu .wp-submenu a {
+                padding-left: 0;
+                padding-right: 10px;
+        }
+
+        #adminmenu a.wp-has-submenu {
+                margin-left: 0;
+                margin-right: 40px;
+        }
+
+        body #wpcontent {
+                margin-left: 0;
+                margin-right: 52px;
+        }
+
+        body .wp-admin #footer {
+                margin-left: 15px;
+                margin-right: 52px;
+        }
+}
+
</ins><span class="cx"> /* List table styles */
</span><span class="cx"> .post-com-count-wrapper {
</span><span class="cx">         font-family: Tahoma, Arial, sans-serif;
</span></span></pre></div>
<a id="trunkwpadmincsswpadmindevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin.dev.css (20748 => 20749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin.dev.css        2012-05-09 03:25:22 UTC (rev 20748)
+++ trunk/wp-admin/css/wp-admin.dev.css        2012-05-09 03:56:40 UTC (rev 20749)
</span><span class="lines">@@ -1725,7 +1725,125 @@
</span><span class="cx">         border-radius: 10px;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/* Auto-folding of the admin menu */
+@media only screen and (max-width: 900px) {
+        #wpcontent,
+        #footer {
+                margin-left: 52px;
+        }
</ins><span class="cx">
</span><ins>+        #adminmenuback,
+        #adminmenuwrap,
+        #adminmenu,
+        #adminmenu li.menu-top {
+                width: 32px;
+        }
+
+        #adminmenu .wp-has-current-submenu .wp-submenu {
+                display: none;
+                position: absolute;
+                width: 145px;
+                z-index: 999;
+                overflow: hidden;
+        }
+
+        #adminmenu .wp-has-current-submenu .wp-submenu.sub-open {
+                display: block;
+        }
+
+        #adminmenu li .wp-submenu,
+        #adminmenu .wp-has-current-submenu .wp-submenu {
+                top: -5px;
+                left: 26px;
+        }
+
+        #adminmenu li.focused.wp-has-current-submenu .wp-submenu,
+        #adminmenu .wp-has-current-submenu .wp-submenu.sub-open {
+                padding: 0 8px 8px 0;
+        }
+
+        #adminmenu div.wp-submenu-head {
+                display: block;
+        }
+
+        #adminmenu a.menu-top,
+        #adminmenu div.wp-menu-toggle {
+                display: none;
+        }
+
+        #adminmenu div.wp-menu-image {
+                width: 30px;
+        }
+
+        #adminmenu .wp-not-current-submenu li a {
+                padding-left: 12px;
+        }
+
+        #adminmenu li li {
+                margin-left: 0;
+        }
+
+        #adminmenu li li a {
+                padding-left: 0;
+        }
+
+        .wp-menu-arrow {
+                -moz-transform: translate( 33px );
+                -webkit-transform: translate( 33px );
+                -o-transform: translate( 33px );
+                -ms-transform: translate( 33px );
+                transform: translate( 33px );
+        }
+
+        #adminmenu li.menu-top:hover .wp-menu-arrow {
+                display: none;
+        }
+
+        #adminmenu li.current:hover .wp-menu-arrow,
+        #adminmenu li.menu-top.wp-menu-open:hover .wp-menu-arrow {
+                display: block;
+                z-index: 125;
+        }
+
+        #adminmenu li.menu-top {
+                border-width: 1px 0;
+                border-style: solid none;
+        }
+
+        #adminmenu .wp-submenu .wp-submenu-wrap {
+                margin-top: 3px;
+        }
+
+        #adminmenu .wp-has-current-submenu {
+                margin-bottom: 1px;
+        }
+
+        #adminmenu .wp-has-current-submenu.menu-top-last {
+                margin-bottom: 0;
+        }
+
+        #adminmenu .wp-has-current-submenu .wp-submenu-wrap {
+                margin-top: 4px;
+        }
+
+        #adminmenu .wp-submenu ul {
+                border-width: 0 0 0 1px;
+                border-style: solid;
+        }
+
+        #adminmenu .wp-submenu a {
+                padding-left: 10px;
+        }
+
+        #adminmenu a.wp-has-submenu {
+                margin-left: 40px;
+        }
+
+        #collapse-menu {
+                display: none;
+        }
+}
+
</ins><span class="cx"> /* List table styles */
</span><span class="cx"> .post-com-count-wrapper {
</span><span class="cx">         min-width: 22px;
</span><span class="lines">@@ -2084,6 +2202,10 @@
</span><span class="cx"> 9.0 - Dashboard
</span><span class="cx"> ------------------------------------------------------------------------------*/
</span><span class="cx">
</span><ins>+#dashboard-widgets-wrap {
+        margin: 0 -8px;
+}
+
</ins><span class="cx"> #wpbody-content .metabox-holder {
</span><span class="cx">         padding-top: 10px;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpadminjscommondevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/common.dev.js (20748 => 20749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/common.dev.js        2012-05-09 03:25:22 UTC (rev 20748)
+++ trunk/wp-admin/js/common.dev.js        2012-05-09 03:56:40 UTC (rev 20749)
</span><span class="lines">@@ -160,7 +160,7 @@
</span><span class="cx">
</span><span class="cx"> $(document).ready( function() {
</span><span class="cx">         var lastClicked = false, checks, first, last, checked, menu = $('#adminmenu'),
</span><del>-                pageInput = $('input.current-page'), currentPage = pageInput.val(), folded, refresh;
</del><ins>+                pageInput = $('input.current-page'), currentPage = pageInput.val(), refresh;
</ins><span class="cx">
</span><span class="cx">         // admin menu
</span><span class="cx">         refresh = function(i, el){ // force the browser to refresh the tabbing index
</span><span class="lines">@@ -354,28 +354,6 @@
</span><span class="cx">                 });
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        // auto-fold the menu when screen is under 900px
-        $(window).bind('resize.autofold', function(){
-                if ( getUserSetting('mfold') == 'f' )
-                        return;
-
-                var width = $(window).width();
-
-                // fold admin menu
-                if ( width <= 900 ) {
-                        if ( !folded ) {
-                                $(document.body).addClass('folded');
-                                folded = true;
-                        }
-                } else {
-                        if ( folded ) {
-                                $(document.body).removeClass('folded');
-                                folded = false;
-                        }
-                }
-
-        }).triggerHandler('resize');
-
</del><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> // internal use
</span></span></pre>
</div>
</div>
</body>
</html>