diff --git a/css/admin.toolbar.css b/css/admin.toolbar.css index 98550bf..de4bded 100755 --- a/css/admin.toolbar.css +++ b/css/admin.toolbar.css @@ -216,3 +216,16 @@ [dir="rtl"] .toolbar .toolbar-tray-vertical li.open > ul.toolbar-menu.clearfix { display: block; } + +.__tba_toggle { + position: fixed; + top: 0; + left: 0; + height: 38px; + width: 38px; + color: white; + padding: 5px 2px 0px 10px; + font-weight: bold; + cursor: pointer; + z-index: 99999999; +} diff --git a/js/admin_toolbar.js b/js/admin_toolbar.js index a714c6e..44f53a0 100755 --- a/js/admin_toolbar.js +++ b/js/admin_toolbar.js @@ -1,7 +1,35 @@ (function ($, Drupal) { Drupal.behaviors.adminToolbar = { + toggle: function(context, settings) { + if ($("#toolbar-administration:hidden")[0]) { + $("#toolbar-item-administration", context).css('margin-left', "38px") + $("#toolbar-administration", context).show() + $("body", context).css("padding-top", settings.initial_toolbar_padding_top) + $("body", context).css("margin-left", settings.initial_toolbar_margin_left) + $(".__tba_toggle", context).text('▲') + } + else { + $("#toolbar-administration", context).hide(); + settings.initial_toolbar_padding_top = $("body", context).css("padding-top"); + settings.initial_toolbar_margin_left = $("body", context).css("margin-left"); + $("body", context).css("padding-top", 0); + $("body", context).css("margin-left", 0); + $(".__tba_toggle", context).text('▼'); + } + }, attach: function (context, settings) { + // On non-admin-routes, hide the toolbar and show minimal toggle. + if (!settings.path.currentPathIsAdmin) { + + $("body", context).prepend('
'); + $('.__tba_toggle', context).css("background-color", $("#toolbar-bar", context).css("background-color")); + $("#toolbar-item-administration", context).css('margin-left', "38px"); + $("body", context).on('click', '.__tba_toggle', function(){ + Drupal.behaviors.adminToolbar.toggle(context, settings); + }); + } + $('a.toolbar-icon', context).removeAttr('title'); // Make the toolbar menu navigable with keyboard.