Overlay panels
-
Not sure if this helps anyone but here's the code I'm using and it seems to do what you want.
I suppose it's worth noting that I'm only using pure css since I don't care about the toggle functionality.
#main .inner { position: relative; } #panels-container { position: absolute; z-index: 1; top: 0; bottom: 0; background-color: var(--colorBg); opacity: 0.9; } .address-top.bookmark-bar-bottom #panels-container, .address-top.bookmark-bar-off #panels-container { top: 1px; } #panels-container.right { right: 0; } #panels-container.left + #webview-container, #panels-container.left ~ #tabs-container.left { margin-left: 34px; } #panels-container.right ~ #webview-container, #panels-container.right ~ #tabs-container.right { margin-right: 34px; } #browser.tabs-right #webview-container { margin-right: 0; } #panels-container.left.switcher + #webview-container, #panels-container.left.switcher ~ #tabs-container.left { margin-left: 0; } #panels-container.right.switcher ~ #webview-container, #panels-container.right.switcher ~ #tabs-container.right { margin-right: 0; } #browser.tabs-right #webview-container { margin-right: 0; } #browser.fullscreen #webview-container, #browser.fullscreen #tabs-container { margin-left: 0 !important; margin-right: 0 !important; } #browser.fullscreen #panels-container { position: relative; } @keyframes show-panel { 0% { max-width: 34px; } 100% { max-width: 500px; } } @keyframes hide-panel { 0% { max-width: 500px; } 100% { max-width: 34px; } } #panels-container /*.panels .panel-group*/ { animation: hide-panel 2s ease forwards !important; animation-delay: 1s !important; } #panels-container:hover /*.panels .panel-group*/, #panels-container:focus-within /*.panels .panel-group*/ { animation: show-panel 0s ease forwards !important; } #panels-container:after { background-color: transparent !important; }
Oh and also this is for panel on the right not the left. You can use it as is on the left but the animations don't look as nice.
-
@narsis Thanks for your cooperation. Does this support mouse hover opening panel function?
-
@kallon As far as I know yes.
-
I've tested a few ideias out here, but none worked (for me) that well, so i sorta put together my alternative for this mod. It allows to toggle between normal mode (default), overlay mode (on click) and overlay mode with on hover trigger (open panels by hover. closed when no longer 'in the area')
Feedback would be appreciated ^^/** * Author: Leonardo Domingues * * #Web panel display enhancer * Toggle between * - Resize (Original) * - Overlay -> Click * - Overlay -> Hover */ setTimeout(function wait() { var adr = document.querySelector(".toolbar-addressbar.toolbar"); if (adr != null) { // Panel Overlay Toggle var switchS = document.getElementById('switch'); var btnS = document.createElement('button'); var svgS = document.createElementNS("http://www.w3.org/2000/svg", "svg"); var pathS = document.createElementNS("http://www.w3.org/2000/svg", "path"); var circTarget = "d: path('M 13 13m -6, 0a 6,6 0 1,0 12,0a 6,6 0 1,0 -12,0 M 13 13m -4, 0a 4,4 0 1,0 8,0a 4,4 0 1,0 -8,0 M 13 13m -2, 0a 2,2 0 1,0 4,0a 2,2 0 1,0 -4,0'); fill-rule: evenodd"; var circEye = "d: path('M 13 13m -5.5, 0a 5.5,5.5 0 1,0 11,0a 5.5,5.5 0 1,0 -11,0 M 13 13m -2, 0a 2,2 0 1,0 4,0a 2,2 0 1,0 -4,0'); fill-rule: evenodd"; var cirdRing = "d: path('M 13 13m -4, 0a 4,4 0 1,0 8,0a 4,4 0 1,0 -8,0 M 13 13m -2, 0a 2,2 0 1,0 4,0a 2,2 0 1,0 -4,0'); fill-rule: evenodd"; //on click var csso_overlay = '#main .inner { position: relative; }/* Overlay */ #panels-container { position: absolute; z-index: 1; top: 0px; bottom: 0; }#panels-container.right {right: 0; }/* Overlay - Sides */ #main.left #webview-container { margin-left: 0px;} #main.right #webview-container { margin-right: 0px;} /* Fullscreen */ #browser.fullscreen #webview-container { margin-left: 0; margin-right: 0; } #browser.fullscreen #panels-container { position: relative; }'; btnS.classList.add('preferences'); btnS.id = 'overlay'; btnS.setAttribute("tabindex", "-1"); svgS.setAttributeNS(null, "width", "26"); svgS.setAttributeNS(null, "height", "26"); svgS.setAttributeNS(null, "viewBox", "0 0 26 26"); switchS.lastChild.style = "margin-top: 0px"; switchS.insertBefore(btnS,switchS.lastChild); btnS.appendChild(svgS); svgS.appendChild(pathS); // startup in normal mode var styleS = document.createElement('style'); styleS.type = 'text/css'; styleS.innerHTML = ''; document.getElementsByTagName('head')[0].appendChild(styleS); btnS.setAttribute("title", "Sobreposição"); pathS.style = cirdRing; var mode = 0; var panel = 0; // toggle logic document.getElementById('overlay').addEventListener('click', function() { if (mode == 0) { styleS.innerHTML = csso_overlay; btnS.setAttribute("title", "Sobreposição 2"); pathS.style = circEye; mode = 1; }else if (mode == 1) { styleS.innerHTML = csso_overlay; btnS.setAttribute("title", "Encaixe"); pathS.style = circTarget; mode = 2 for (let index = 0; index < switchS.getElementsByTagName('button').length - 3; index++) { switchS.getElementsByTagName('button')[index].onmouseover = function(){ if (!switchS.getElementsByTagName('button')[index].getAttribute('class').includes("active")) { switchS.getElementsByTagName('button')[index].click(); panel = index; } }; } document.getElementById('panels-container').onmouseleave = function(){ if (switchS.getElementsByTagName('button')[panel].getAttribute('class').includes("active")) { switchS.getElementsByTagName('button')[panel].click() } }; }else { for (let index = 0; index < switchS.getElementsByTagName('button').length - 3; index++) { switchS.getElementsByTagName('button')[index].onmouseover = ''; } document.getElementById('panels-container').onmouseleave = ''; styleS.innerHTML = ''; btnS.setAttribute("title", "Sobreposição"); pathS.style = cirdRing; mode = 0; } }); } else { setTimeout(wait, 300); } }, 300);
-
Works as expected, good job.
The only thing I would add (and this is just personal preference) would be a transition. It can reduce accidental triggers with a delay and look nicer too. And even if it does get unwittingly triggered, the transition will bring a portion of the panel into view instead and then retract rather than having the whole thing popping out over the page.
hmm, upon further testing, for me the hover effect makes the panels themselves too sensitive, it's too easy to unintentionally switch from notes to bookmarks, etc.
-
@sjudenim First of all, thanks for the compliment.
I think I can give a try and work on the transition effect (and perhaps adjust the hover effect to trigger after a few ms, to smooth it a bit) on my spare time, will update you if I'm successful.
-
@sjudenim Not sure if it was what u referred to, but I changed it a little bit (trick: settimeout everywhere xD)
/** * Author: Leonardo Domingues * * #Web panel display enhancer * Toggle between * - Resize (Original) * - Overlay -> Click * - Overlay -> Hover */ setTimeout(function wait() { var adr = document.querySelector(".toolbar-addressbar.toolbar"); if (adr != null) { // Panel Overlay Toggle var switchS = document.getElementById('switch'); var btnS = document.createElement('button'); var svgS = document.createElementNS("http://www.w3.org/2000/svg", "svg"); var pathS = document.createElementNS("http://www.w3.org/2000/svg", "path"); var circTarget = "d: path('M 13 13m -6, 0a 6,6 0 1,0 12,0a 6,6 0 1,0 -12,0 M 13 13m -4, 0a 4,4 0 1,0 8,0a 4,4 0 1,0 -8,0 M 13 13m -2, 0a 2,2 0 1,0 4,0a 2,2 0 1,0 -4,0'); fill-rule: evenodd"; var circEye = "d: path('M 13 13m -5.5, 0a 5.5,5.5 0 1,0 11,0a 5.5,5.5 0 1,0 -11,0 M 13 13m -2, 0a 2,2 0 1,0 4,0a 2,2 0 1,0 -4,0'); fill-rule: evenodd"; var cirdRing = "d: path('M 13 13m -4, 0a 4,4 0 1,0 8,0a 4,4 0 1,0 -8,0 M 13 13m -2, 0a 2,2 0 1,0 4,0a 2,2 0 1,0 -4,0'); fill-rule: evenodd"; //on click var csso_overlay = '/* Overlay */ #panels-container { position: absolute; z-index: 1; top: 0px; bottom: 0; }#panels-container.right {right: 0; }/* Overlay - Sides */ #main.left #webview-container { margin-left: 0px;} #main.right #webview-container { margin-right: 0px;} /* Fullscreen */ #browser.fullscreen #webview-container { margin-left: 0; margin-right: 0; } #browser.fullscreen #panels-container { position: relative; }'; // transition: width 0.2s linear 0.2s; btnS.classList.add('preferences'); btnS.id = 'toggle'; btnS.setAttribute("tabindex", "-1"); svgS.setAttributeNS(null, "width", "26"); svgS.setAttributeNS(null, "height", "26"); svgS.setAttributeNS(null, "viewBox", "0 0 26 26"); switchS.lastChild.style = "margin-top: 0px"; switchS.insertBefore(btnS,switchS.lastChild); btnS.appendChild(svgS); svgS.appendChild(pathS); // startup in normal mode var styleS = document.createElement('style'); styleS.type = 'text/css'; styleS.innerHTML = ''; document.getElementsByTagName('head')[0].appendChild(styleS); btnS.setAttribute("title", "Sobreposição"); pathS.style = cirdRing; var mode = 0; var panel = 0; var toggle_token; // toggle logic document.getElementById('toggle').addEventListener('click', function() { clearTimeout(toggle_token); toggle_token = setTimeout(function() { if (mode == 0) { styleS.innerHTML = csso_overlay; btnS.setAttribute("title", "Sobreposição 2"); pathS.style = circEye; mode = 1; }else if (mode == 1) { styleS.innerHTML = csso_overlay; btnS.setAttribute("title", "Encaixe"); pathS.style = circTarget; mode = 2 var show_token; for (let index = 0; index < switchS.getElementsByTagName('button').length - 3; index++) { switchS.getElementsByTagName('button')[index].onmouseover = function() { clearTimeout(show_token); show_token = setTimeout(function() { if (!switchS.getElementsByTagName('button')[index].getAttribute('class').includes("active")) { switchS.getElementsByTagName('button')[index].click(); panel = index; } }, 100); }; } var hide_token; document.getElementById('panels-container').onmouseleave = function() { hide_token = setTimeout(function() { if (switchS.getElementsByTagName('button')[panel].getAttribute('class').includes("active")) { switchS.getElementsByTagName('button')[panel].click() } }, 400); }; document.getElementById('panels-container').onmouseenter = function() { clearTimeout(hide_token); }; }else { for (let index = 0; index < switchS.getElementsByTagName('button').length - 3; index++) { switchS.getElementsByTagName('button')[index].onmouseover = ''; } document.getElementById('panels-container').onmouseleave = ''; document.getElementById('panels-container').onmouseenter = ''; styleS.innerHTML = ''; btnS.setAttribute("title", "Sobreposição"); pathS.style = cirdRing; mode = 0; } }, 100); }); } else { setTimeout(wait, 300); } }, 300);
-
@masterleo29 said in Overlay panels:
trick: settimeout everywhere xD
That's not a trick, that's a workaround. I think what @sjudenim meant was introducing real css transitions.
-
@luetage Sorry for the confusion, english is not my main language. Yes, it's the workaround i found to make it work 'smoother'
I'm not as good with css overall (i can work some stuff, but never did nothing too complex with transitions), so I can't do it right now (might be able, in the future)
Edit: If i'm able to work on a good transition, will post the result
-
@luetage is correct, that was what I was getting at. But as I said, it's just a personal preference
-
@sjudenim Still not pure css, but I believe this is the effect you talked about. Try this piece inside the 'click' event for the "toggle" button, before the "if" logic I have there (right next to 'document.getElementById('toggle').addEventListener('click', function(){')
var painel = document.getElementById('panels-container'); var curr_width = painel.style.width; if (curr_width != "34px") { //In painel.style.transition = 'width 0.3s'; painel.style.width = "34px"; //Out setTimeout(function() { painel.style.width = curr_width; }, 350); setTimeout(function() { painel.style.transition = ''; }, 700); }
EDIT: (had this on my another mod) For a 'smoother' experience, add this to your custom css
#main.left #webview-container{ transition: flex 0.2s linear 0.2s; } #main.right #webview-container{ transition: flex 0.2s linear 0.2s; } #browser.fullscreen #webview-container{ transition: flex 0.2s linear 0.2s; }
-
Still this happening (look at vivaldi logo)
-
@kallon If you're using mode 2 or 3, that's intended. The overlay is for the panel container, both the content and the switch bar.
-
@masterleo29 Why would you want to cut a piece of all pages at all times? I think the overlay functionality should be only when hovering or clicking, doesn't it make sense? Thanks for contributing!
-
@kallon Well, I adjusted this mod to my needs, and I usually hide everything using the shorkey 'F4', so it doesn't affect me. But yes, if you're used to always show the sidebar, even with the panel hidden, it is annoying. I think I can adjust it a bit for your scecnario
-
-
-
@kallon I'm out of time today, when I get it perfectly I reply to you again
-
Based on the version from MasterLeo29, I found a simple way for options 2 and 3 so that the side bar does not overlay the webpage while the hover opens as temporary overlay. All that's needed is to give the #webview-container a left margin of 34 pixels, so the code should be:
var csso_overlay = '/* Overlay */ #panels-container { position: absolute; z-index: 1; top: 0px; bottom: 0; }#panels-container.right {right: 0; }/* Overlay - Sides */ #main.left #webview-container { margin-left: 34px;} #main.right #webview-container { margin-right: 0px;} /* Fullscreen */ #browser.fullscreen #webview-container { margin-left: 0; margin-right: 0; } #browser.fullscreen #panels-container { position: relative; }';
-
@knoelli This works if you keep the side bar always open and just open/close panels. If you try to hide all, it will leave behind the 34px border. Good job tho, not a perfect solution but a good solution for this case