3

A Screenshot

Only shows the logo and main menu on mouse-over on the top bar.

Sorry to not provide a file for download but i am sure you will manage somehow, adjust includes as needed:

// ==UserScript==
// @name           Collapse Headers
// @namespace      stackoverflow
// @include        *stackoverflow.com*
// ==/UserScript==

(function ()
{
    GM_addStyle("#header { height: 0px; }");

    var cancelWaiting = false;
    jq_wait();


    function jq_wait()
    {
        if (typeof unsafeWindow.jQuery == 'undefined')
        {
            window.setTimeout(jq_wait, 100);
        } else
        {
            $ = unsafeWindow.jQuery;
            window.setTimeout(function () { cancelWaiting = true; }, 5000);
            $(document).ready(header_wait);
        }
    }

    function header_wait()
    {
        var topbar = $(".topbar");
        if (topbar.length == 0)
        {
            if (cancelWaiting) return;
            window.setTimeout(header_wait, 10);
        }
        else
        {
            var header = $("#header");
            var content = $("#content");
            header.css("overflow", "hidden");
            topbar.mouseenter(function ()
            {
                header.stop();
                header.animate({ height: "120px" }, 500);
            });
            content.mouseenter(function ()
            {
                header.stop();
                header.animate({ height: "0px" }, 500);
            });
        }
    }
})();

Edits:

  • Changed expand/collapse logic to not allow endless queuing.
  • 2013/12/05 - Updated script to work accordingly for the new top bar.

0

You must log in to answer this question.

Browse other questions tagged .