Open panels on mouse-over.
-
@sjudenim This shows the panel container on hover, but I think OP wants to open specific panels when hovering a panel button in the container. Maybe I understood it wrong, don't know.
-
If that's the case, @MasterLeo29 had written something like that in this thread
-
@sjudenim Oh yeah, I forgot about this. It seems to simulate the click, so nothing to do here, code already exists.
-
I apologize for needing to be handheld, but do you know which code there specifically controls the on-hover. I tried pulling the section for just the on-hover commands, but it did not work.
-
@recnamoruen I think I can do it for you. Reply to me with the exact behavior you want (small topics would be fine, since my English is not the best)
I write something for youEdit: it's 22:40 here. If I don't reply now, I will at 9:00
-
@masterleo29 When I hover over these icons, I would like that panel to open.
Thanks!
-
@recnamoruen Hope you like it.
setTimeout(function wait() { var adr = document.querySelector(".toolbar-addressbar.toolbar"); if (adr != null) { var switchS = document.getElementById('switch'); var panel = 0; var show_token; for (let index = 0; index < switchS.getElementsByTagName('button').length - 2; 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); }; } } else { setTimeout(wait, 300); } }, 300);
-
@masterleo29 Works perfectly
Would be useful the mouse-over delay as the overlay mod has - to avoid mis-activating panel (I have both tab/panel on right).
Or I just have to change thetimeout
? -
@hadden89 If i remember correctly (working atm, can't test freely), you just need to adjust the timeout saved on "show_token" (in the code is set as '100')
-
@masterleo29 Thank you for your help. Do you know why it would not work on webpanels, and only open the top panel instead of the one I hover over?
-
@recnamoruen You're welcome. To answer that, I would need to see exactly the code you tried before (perhaps you didn't copy the full section of it or forgot to call some function, just guesses)
-
@recnamoruen You have to change this line
for (let index = 0; index < switchS.getElementsByTagName('button').length - 3; index++)
to this
for (let index = 0; index < switchS.getElementsByTagName('button').length - 2; index++)
I haven't tested any of this, but it's likely the cause of the problem. -
@luetage You're right! This code is reused from my version of Overlay Panels, so it takes into account the "toggle "button. I will edit my response
-
@MasterLeo29 Works perfectly with this fix. Thank you its very appreciated. @luetage You also. Thank you.
-
This post is deleted! -
@masterleo29 Hi, i'm trying it out and it works well.
Could you make a small change to the behavior? In addition to opening the panels by passing over them with the mouse make them open even by dragging a tab to save it in the bookmarks, it is something that i do very often.
Actually it already works with this behavior but it is not repetitive, sometimes it opens (very few times) and sometimes it stays closed and sometimes it has abnormal behaviors.Always if you have time, desire and that it is possible. Already so you have done however a great job.
PS: I've enabled "Floating Panel" and "Auto-Close Inactive Panel".
-
@folgore101 You sir are in luck, I got some free time today!
See if this changes work for you (I tested the old version and you were right, there were some misses here and there)setTimeout(function wait() { var adr = document.querySelector(".toolbar-addressbar.toolbar"); if (adr != null) { var switchS = document.getElementById('switch'); var show_token; for (let index = 0; index < switchS.getElementsByTagName('button').length - 2; 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); } switchS.getElementsByTagName('button')[index].ondragover = function() { if (!switchS.getElementsByTagName('button')[index].getAttribute('class').includes("active")) { switchS.getElementsByTagName('button')[index].click(); panel = index; } } } } else { setTimeout(wait, 300); } }, 300);
-
@masterleo29 I'm testing, it's good, very good.
-
@MasterLeo29 thanks for your excellent script!
I made a few small modifications
- Auto-close when you mouse over to body
- Don't open if mouse exits screen before timeout period
- Unique delays based on situation
function panelMouseOver(autoHide, delay_show, delay_change, delay_hide) { var buttons = document.getElementById('switch').getElementsByTagName('button'); var show_token = null; var activeButton = null; /* Stop timer if mouse exits screen */ document.addEventListener("mouseout", function(e) { clearTimeout(show_token); }); /* Do auto-hide if applicable */ if (autoHide) { var content = document.getElementById("webview-container").onmouseover = function() { if (!document.getElementById("panels-container").getAttribute('class').includes("icons")) { clearTimeout(show_token); setTimeout(function() { if (activeButton && (activeButton.getAttribute('class').includes("active"))) { activeButton.click(); activeButton = null; } }, delay_hide); } }; } function activeButtonIndex() { for (let i = 0; i < buttons.length - 2; i++) { if (buttons[i].getAttribute('class').includes('active')) { return i; } } return -1; } function setActive(index, doDelay) { clearTimeout(show_token); var delay = 0; if (doDelay) { delay = (activeButtonIndex() < 0) ? delay_show : delay_change; } show_token = setTimeout(function() { var newButton = buttons[index]; if (!newButton.getAttribute('class').includes('active')) { activeButton = newButton; activeButton.click(); panel = index; } }, delay); } function setListeners() { for (let index = 0; index < buttons.length - 2; index++) { buttons[index].onmouseover = function() {setActive(index, true);}; buttons[index].onmouseout = function() {clearTimeout(show_token);}; buttons[index].ondragover = function() {setActive(index, false);}; } } setListeners(); } setTimeout(function wait() { var adr = document.querySelector(".toolbar-addressbar.toolbar"); if (adr != null) { panelMouseOver(true, 100, 50, 250); } else { setTimeout(wait, 300); } }, 300);
-
So I'm using this new script that auto hides but I have also used Leo's original script for some time now and I keep running into an issue where if this script is running Javascript prompts get cut off and I cannot see the allow or deny prompts. If I remove the script it starts working properly after a reinstall. Does anyone know what could be causing this?