Skip to content

Commit

Permalink
Adjust top navbar styles and behaviors (#2801)
Browse files Browse the repository at this point in the history
* Adjust top navbar styles and behaviors

- Fix a sizing issue in MaterialDesign theme.
- Restore original navbar styles (background image and color), and
  unify styles of navbar items. The new implementation tries to
  resemble the old look of ruTorrent, while utilizing CSS variables.
  This philosophy helps remove code duplication. Some background
  images are also replaced by CSS gradient.
- Auto close collapsible top navbar when resizing and/or  opening
  a dialog window. This adds slightly to ease of use, and prevent
  styling issues when switching between different screen resolutions.

* Fix image path and collapse menu blink
  • Loading branch information
jevenski authored Nov 21, 2024
1 parent 94c13c4 commit 1c1975b
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 164 deletions.
61 changes: 33 additions & 28 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ span {
--header-border-color: #909090;
--dialog-bg-color: #FAFAFA;
--dialog-border-color: #909090;

--navbar-height: 36px;
--navbar-bg-color: #f0f0f0;
--navbar-bg-image: url(../images/t_bg.png);
--navbar-border-color: #d0d0d0;
--navbar-item-bg-color: #f0f0f0;
--navbar-item-border-color: #a0a0a0;
--loading-indicator-icon: url(../images/ajax-loader.gif);
--loading-indicator-side-length: 32px;
}
.dropdown-menu {
--bs-dropdown-border-color: var(--menu-border-color);
Expand Down Expand Up @@ -212,9 +221,12 @@ span.htkey {text-align:right; position: absolute; right: 16px; z-index:100}
#sel {width: 0px; height: 0px; left: 0px; top: 0px; border: 1px dotted #000000; display: none; z-index: 1000}

#t {
height: 36px;
background: #F0F0F0 url(../images/t_bg.png) repeat-x center 0.25rem;
border-bottom: 1px solid #D0D0D0;
height: var(--navbar-height);
background: var(--navbar-bg-image);
background-color: var(--navbar-bg-color);
background-position: center;
background-repeat: repeat-x;
border-bottom: 1px solid var(--navbar-border-color);
margin-bottom: 5px;
white-space: nowrap;
}
Expand All @@ -224,9 +236,9 @@ span.htkey {text-align:right; position: absolute; right: 16px; z-index:100}
align-items: center;
justify-content: space-between;
}
#top-menu {
background-color: #F0F0F0;
border-bottom: 1px solid #D0D0D0;
#top-menu.show, #top-menu.collapsing {
background-color: var(--menu-background-color);
border-bottom: 1px solid var(--navbar-border-color);
z-index: 30;
}
#top-menu .btn-group {
Expand Down Expand Up @@ -257,11 +269,10 @@ span.htkey {text-align:right; position: absolute; right: 16px; z-index:100}
width: 16px;
height: 16px;
}
div#t a {padding: 3px;}
#t .navbar-nav a:not(.dropdown-item):hover {
#t .nav-link:hover {
filter: brightness(1.3);
}
#t .nav-link:active {padding: 4px 2px 2px 4px;}
#t .nav-link:active {padding: 0.35rem 0.15rem 0.15rem 0.35rem;}
div#t div.TB_Separator {
align-self: stretch;
flex: 0 0 1px;
Expand All @@ -270,16 +281,16 @@ div#t div.TB_Separator {
border: 0;
background-color: #A0A0A0;
}
div#t .nav-link {
#t .nav-link {
display: flex;
flex-direction: row;
align-items: center;
gap: 0.5rem;
font-weight: bold;
border: 1px solid #A0A0A0;
border: 1px solid var(--navbar-item-border-color);
border-radius: 8px;
background-color: var(--btn-bg-color);
background-image: none;
background: var(--navbar-item-bg-color);
padding: 0.25rem;
margin: 0.15rem;
}
div.navbar-nav div.nav-icon {
Expand All @@ -306,16 +317,16 @@ div#plugins {background: url(../images/plugin.png) 0px center}
#go {background: url(../images/go.gif) 0px center; }

#ind {
background: transparent url(../images/ajax-loader.gif) no-repeat 0px center;
width: 32px;
height: 32px;
cursor: default;
background: transparent var(--loading-indicator-icon) no-repeat center;
background-size: var(--loading-indicator-side-length);
width: var(--loading-indicator-side-length);
height: var(--loading-indicator-side-length);
}

#pview_save_view_button { align-self: center; width: 38px; height: 19px; padding: 0px; line-height: 2px; font-size: 19px; }

a {color: #686868; text-decoration: none;}
#maincont {height: calc(100dvh - 36px - 5px - 25px - 5px);}
#maincont {height: calc(100dvh - var(--navbar-height) - 5px - 25px - 5px);}
.offcanvas-header .btn-close {background-color: var(--btn-bg-color);}
#offcanvas-sidepanel {
border: 1px solid var(--container-border-color);
Expand Down Expand Up @@ -632,19 +643,13 @@ div#tadd {max-width: 95vw;}
/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
/* Custom rules for medium devices */
#top-menu {
background-color: transparent;
border-bottom: none;
z-index: auto;
}
#t .navbar-nav a:not(.dropdown-item):hover {
#t .nav-link:hover {
background: transparent url(../images/tb_bg.gif) no-repeat scroll left center;
filter: none;
}
div#t .nav-link {
border: none;
border-radius: 0;
background-color: transparent;
#t .nav-link {
border: transparent;
background: transparent;
}
div#HDivider {cursor: e-resize;}
div#VDivider {cursor: n-resize;}
Expand Down
9 changes: 5 additions & 4 deletions js/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,13 @@ var theDialogManager = {
this.modalState = false;
},
show: function(id, callback) {
// Close side panel on mobile:
// An offcanvas is a modal under the hood and will intercept focus events
// from other elements, and make other text inputs unfocusable and uneditable.
if ($(window).width() < 768) {
// Close side panel on mobile:
// An offcanvas is a modal under the hood and will intercept focus events
// from other elements, and make other text inputs unfocusable and uneditable.
bootstrap.Offcanvas.getOrCreateInstance(document.querySelector("#offcanvas-sidepanel")).hide();
// close collapsible top menu on opening dialog windows
bootstrap.Collapse.getOrCreateInstance("#top-menu").hide();
}

const obj = $('#' + id);
Expand Down Expand Up @@ -456,4 +458,3 @@ var theContextMenu =
return(false);
}
}

4 changes: 4 additions & 0 deletions js/webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -2306,6 +2306,10 @@ var theWebUI =
theWebUI.resizeTop(null, h);
// center any open dialog
theDialogManager.visible.forEach(id => theDialogManager.center(id));
if ($(window).width < 768) {
// close collapsible top menu
bootstrap.Collapse.getOrCreateInstance("#top-menu").hide();
}
},

update: function()
Expand Down
29 changes: 10 additions & 19 deletions plugins/theme/themes/Acid/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ html, body { background-color: #1e2124; color: #BDDBDB }
--header-border-color: #909090;
--dialog-bg-color: #1E2124;
--dialog-border-color: #909090;

--navbar-height: 36px;
--navbar-bg-color: #252525;
--navbar-bg-image: url(../plugins/theme/themes/Acid/images/t_bg.png);
--navbar-border-color: #d0d0d0;
--navbar-item-bg-color: #1e2124;
--navbar-item-border-color: #d0d0d0;
--loading-indicator-icon: url(../plugins/theme/themes/Acid/images/ajax-loader.gif);
--loading-indicator-side-length: 32px;
}
category-panel {
--open-background-image: url(../plugins/theme/themes/Acid/images/pnl_open.gif);
Expand Down Expand Up @@ -76,16 +85,8 @@ div.graph_tab {background-color: #272E36; color: #BDDBDB; font-weight: bold;}
.graph_tab_legend { color: #FFF; background-color: #272E36; }
.graph_tab_tooltip { color: #FFF; background-color: #272E36; border: 1px solid #BDDBDB; }

#t {background: #252525 url(./images/t_bg.png) repeat-x center center; border-bottom: 1px solid #252525;}
#top-menu {
background-color: #252525;
border-bottom: 1px solid #252525;
}
div#t .nav-link {
background-color: #1E2124;
border-color: #D0D0D0;
#t .nav-link {
color: #00FF00;
font-weight: bold;
}
div#t div#add {background: transparent url(./images/toolbar.png) no-repeat -24px center}
div#t div#create {background: transparent url(./images/toolbar.png) no-repeat -48px center}
Expand Down Expand Up @@ -166,8 +167,6 @@ div#gcont div.row.Header {background: #323A46;}
#dlgProps-header {background-image: url(./images/props.gif);}
#yesnoDlg-header {background-image: url(./images/error.gif);}

div#t div#ind { background: transparent url(./images/ajax-loader.gif) no-repeat 0px center; }

span#loadimg { background: transparent url(./images/ajax-loader.gif) no-repeat center center; }

.Icon_File {background: transparent url(./images/file.gif) no-repeat left center}
Expand All @@ -180,11 +179,3 @@ span#loadimg { background: transparent url(./images/ajax-loader.gif) no-repeat c

.sthdr { color: #00FF00;}
.stval { color: #BDDBDB;}

@media (min-width: 768px) {
/* Custom rules for medium devices */
div#t .nav-link {
background-color: transparent;
border: none;
}
}
27 changes: 10 additions & 17 deletions plugins/theme/themes/Blue/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ html, body { background-color: #DFE8F6 }
--header-border-color: transparent;
--dialog-bg-color: #FAFAFA;
--dialog-border-color: #909090;

--navbar-height: 36px;
--navbar-bg-color: #181818;
--navbar-bg-image: url(../plugins/theme/themes/Blue/images/header_bg.gif);
--navbar-border-color: #333333;
--navbar-item-bg-color: linear-gradient(0deg, rgba(180,207,240,1) 0%, rgba(222,236,253,1) 100%);
--navbar-item-border-color: #8db2e3;
--loading-indicator-icon: url(../plugins/theme/themes/Blue/images/ajax-loader.gif);
--loading-indicator-side-length: 32px;
}
category-panel {
--open-background-image: url(../plugins/theme/themes/Blue/images/pnl_open.gif);
Expand All @@ -44,14 +53,7 @@ panel-label[selected] {
border-color: #D9E8FB;
}

#t {background: #181818 url(./images/header_bg.gif) repeat-x center center; border-bottom: 1px solid #333333;}
#top-menu {
background-color: #181818;
border-bottom: 1px solid #333333;
}
div#t .nav-link {
background-image: url(./images/tabs-bg.png);
border-color: #8DB2E3;
#t .nav-link {
color: #15428B;
font-weight: normal;
}
Expand Down Expand Up @@ -100,12 +102,3 @@ ul.CMenu li.menuitem hr {background-color: #E0E0E0; color: #000000; border-botto

div#stg .lm { background-color: #FAFAFA; border: 1px solid #D0D0D0; }
.lm li a.focus {background-color: #D9E8FB}

div#t div#ind {background: transparent url(./images/ajax-loader.gif) no-repeat 0px center;}

@media (min-width: 768px) {
/* Custom rules for medium devices */
div#t .nav-link {
background-image: none;
}
}
28 changes: 10 additions & 18 deletions plugins/theme/themes/Dark/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ html, body {background-color: #181818; color: #999999; }
--header-border-color: #333333;
--dialog-bg-color: #181818;
--dialog-border-color: #333333;

--navbar-height: 36px;
--navbar-bg-color: #181818;
--navbar-bg-image: url(../plugins/theme/themes/Dark/images/t_bg.png);
--navbar-border-color: #333333;
--navbar-item-bg-color: #333333;
--navbar-item-border-color: #333333;
--loading-indicator-icon: url(../plugins/theme/themes/Dark/images/ajax-loader.gif);
--loading-indicator-side-length: 32px;
}
category-panel {
--open-background-image: url(../plugins/theme/themes/Dark/images/pnl_open.gif);
Expand Down Expand Up @@ -75,18 +84,11 @@ ul.CMenu li a.sel {background: transparent url(./images/menusel.gif) no-repeat s

#sel {border: 1px dotted #555555;}

#t {background: #181818 url(./images/t_bg.png) repeat-x center center; border-bottom: 1px solid #333333;}
#top-menu {
background-color: #181818;
border-bottom: 1px solid #333333;
}
.navbar-toggler {
background-image: none;
border-color: #333333;
}
div#t .nav-link {
background-color: #333333;
border-color: #333333;
#t .nav-link {
color: #686868;
}
div#t div.TB_Separator {background-color: #333333}
Expand Down Expand Up @@ -171,19 +173,9 @@ div#dlgProps textarea#prop-trackers {background: #181818; border: 1px solid #333

div.tab {background-color: #181818}

div#t div#ind {background: transparent url(./images/ajax-loader.gif) no-repeat 0px center;}

span#loadimg {background: transparent url(./images/ajax-loader.gif) no-repeat center center; }

#StatusBar { border-top: 1px solid #333333; background-color: #181818; color: #888888 }
#st_up { background:url(./images/status_up.gif) 6px no-repeat; }
#st_down { background:url(./images/status_down.gif) 6px no-repeat; }
.statuscell {border-right: 1px solid #333333;}

@media (min-width: 768px) {
/* Custom rules for medium devices */
div#t .nav-link {
background-color: transparent;
border: none;
}
}
28 changes: 10 additions & 18 deletions plugins/theme/themes/DarkBetter/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ html, body {background-color: #181818; color: #999999; }
--header-border-color: #333333;
--dialog-bg-color: #181818;
--dialog-border-color: #333333;

--navbar-height: 36px;
--navbar-bg-color: #181818;
--navbar-bg-image: url(../plugins/theme/themes/DarkBetter/images/t_bg.png);
--navbar-border-color: #333333;
--navbar-item-bg-color: #181818;
--navbar-item-border-color: #333333;
--loading-indicator-icon: url(../plugins/theme/themes/DarkBetter/images/ajax-loader.gif);
--loading-indicator-side-length: 28px;
}
category-panel {
--open-background-image: url(../plugins/theme/themes/DarkBetter/images/pnl_open.svg);
Expand Down Expand Up @@ -207,18 +216,11 @@ ul.CMenu li ul li a.dis:hover {background-color: #181818; color: #333333}

#sel {border: 1px dotted #555555}

#t {background: #181818 url(./images/t_bg.png) repeat-x center center; border-bottom: 1px solid #333333;}
#top-menu {
background-color: #181818;
border-bottom: 1px solid #333333;
}
.navbar-toggler {
background-image: none;
border-color: #333333;
}
div#t .nav-link {
background-color: #181818;
border-color: #333333;
#t .nav-link {
color: #686868;
}
div#t div.TB_Separator {background-color: #333333}
Expand Down Expand Up @@ -329,8 +331,6 @@ div#dlgProps textarea#prop-trackers {background: #181818; border: 1px solid #333

div.tab {background-color: #181818}

div#t div#ind {background: transparent url(./images/ajax-loader.gif) no-repeat 0px center; background-size: 28px}

span#loadimg {background: transparent url(./images/ajax-loader.gif) no-repeat center center; background-size: 28px}

#StatusBar {border-top: 1px solid #333333; background-color: #181818; color: #888888}
Expand All @@ -350,11 +350,3 @@ span#loadimg {background: transparent url(./images/ajax-loader.gif) no-repeat ce
#dlgLabel-header {background-image: url(./images/label.svg);}
#dlgProps-header {background-image: url(./images/file.svg);}
#yesnoDlg-header {background-image: url(./images/yellow.svg);}

@media (min-width: 768px) {
/* Custom rules for medium devices */
div#t .nav-link {
background-color: transparent;
border: none;
}
}
14 changes: 9 additions & 5 deletions plugins/theme/themes/Excel/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ html, body { background-color: #DFE8F6; scrollbar-arrow-color: #586585; scrollba
--header-border-color: #FFFFFF;
--dialog-bg-color: #D9E8FB;
--dialog-border-color: #FFFFFF;

--navbar-height: 36px;
--navbar-bg-color: transparent;
--navbar-bg-image: url(../images/t_bg.png);
--navbar-border-color: transparent;
--navbar-item-bg-color: #f0f0f0;
--navbar-item-border-color: #a0a0a0;
--loading-indicator-icon: url(../images/ajax-loader.gif);
--loading-indicator-side-length: 32px;
}
category-panel {
--open-background-image: none;
Expand Down Expand Up @@ -46,11 +55,6 @@ panel-label[selected] {
#StatusBar { background: transparent url(./images/statbg.png) repeat-x 0 0; border-top: none; color: #034084 }
.statuscell { border-color: #9EB6CE }

#t {background: none; border: none;}
#top-menu {
background-color: #B5D5FB;
border-bottom: 1px solid #9EB6CE;
}
.navbar-toggler {
background-image: none;
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1c1975b

Please sign in to comment.