From 6f7dca1f837edfff17f632fa8e1271c93e5b0748 Mon Sep 17 00:00:00 2001 From: ngosang Date: Wed, 17 Jun 2015 01:01:57 +0200 Subject: [PATCH] [Web UI] Option to hide Top Toolbar --- src/webui/www/private/index.html | 1 + src/webui/www/public/css/Layout.css | 1 - src/webui/www/public/css/style.css | 4 ++++ src/webui/www/public/scripts/client.js | 28 +++++++++++++++++++++++++- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/webui/www/private/index.html b/src/webui/www/private/index.html index c5094bf53..0459315e5 100644 --- a/src/webui/www/private/index.html +++ b/src/webui/www/private/index.html @@ -61,6 +61,7 @@
  • QBT_TR(&View)QBT_TR
  • diff --git a/src/webui/www/public/css/Layout.css b/src/webui/www/public/css/Layout.css index f400335df..c9d8bf7a4 100644 --- a/src/webui/www/public/css/Layout.css +++ b/src/webui/www/public/css/Layout.css @@ -108,7 +108,6 @@ body { /* Fixes by Chris */ /*background-color: #ccc;*/ height: 20px; - margin-bottom: 5px; border-bottom: 1px solid #3f3f3f; } diff --git a/src/webui/www/public/css/style.css b/src/webui/www/public/css/style.css index d5ddf31dd..05eadaf23 100644 --- a/src/webui/www/public/css/style.css +++ b/src/webui/www/public/css/style.css @@ -262,6 +262,10 @@ a.propButton img { } /* Mocha Customization */ +#mochaToolbar { + margin-top: 5px; +} + #mochaToolbar .divider { background-image: url(../images/skin/toolbox-divider.gif); background-repeat: no-repeat; diff --git a/src/webui/www/public/scripts/client.js b/src/webui/www/public/scripts/client.js index f2db50cc0..f1891c626 100644 --- a/src/webui/www/public/scripts/client.js +++ b/src/webui/www/public/scripts/client.js @@ -89,7 +89,6 @@ window.addEvent('load', function () { width : null, resizeLimit : [100, 300] }); - MochaUI.Desktop.setDesktopSize(); setFilter = function (f) { // Visually Select the right filter @@ -129,10 +128,23 @@ window.addEvent('load', function () { }); initializeWindows(); + // Show Top Toolbar is enabled by default + if (localStorage.getItem('show_top_toolbar') == null) + var showTopToolbar = true; + else + var showTopToolbar = localStorage.getItem('show_top_toolbar') == "true"; + if (!showTopToolbar) { + $('showTopToolbarLink').firstChild.style.opacity = '0'; + $('mochaToolbar').addClass('invisible'); + } + var speedInTitle = localStorage.getItem('speed_in_browser_title_bar') == "true"; if (!speedInTitle) $('speedInBrowserTitleBarLink').firstChild.style.opacity = '0'; + // After Show Top Toolbar + MochaUI.Desktop.setDesktopSize(); + var syncMainDataLastResponseId = 0; var serverState = {}; @@ -271,6 +283,20 @@ window.addEvent('load', function () { updateMainData(); }; + $('showTopToolbarLink').addEvent('click', function(e) { + showTopToolbar = !showTopToolbar; + localStorage.setItem('show_top_toolbar', showTopToolbar.toString()); + if (showTopToolbar) { + $('showTopToolbarLink').firstChild.style.opacity = '1'; + $('mochaToolbar').removeClass('invisible'); + } + else { + $('showTopToolbarLink').firstChild.style.opacity = '0'; + $('mochaToolbar').addClass('invisible'); + } + MochaUI.Desktop.setDesktopSize(); + }); + $('speedInBrowserTitleBarLink').addEvent('click', function(e) { speedInTitle = !speedInTitle; localStorage.setItem('speed_in_browser_title_bar', speedInTitle.toString());