Go Button, Search Button, Paste and Go/Search buttons
-
I've been using Vivaldi a bit more to compliment Waterfox Classic. Back in August 2021 I managed to (actually) customize the browser and move things to where they needed to be: https://forum.vivaldi.net/topic/63264/executing-javascript-to-fix-gui-components-incorrect-nesting/12
That being said there are four missing buttons that I need to create and would like some help with please:
- Go button
- Paste and Go button
- Search button
- Paste and Search button
I use the go button to imagine this: go to the URL in the address bar. It's more useful than the Reload button as browsers will often ask if a form should be resubmitted; pressing the Go button avoids that and I use it for other reasons.
The Paste and Go button is a single click button as well. "Why don't you just do multiple actions?" Because a single-click is more efficient and streamlined that two or more clicks plus not everyone is sitting in front of a 15 inch CRT with an 800x600 screen resolution, some of us have resolution and know how to use it.
The Search and Paste and Search buttons should be blatantly obvious what they do for anyone who just read the past two micro-paragraphs.
I did some searching and I want to be explicit about what a Go button is and what it is not. A go button is a dedicated button that you click left-click once, one action, done! It is explicitly not this: https://forum.vivaldi.net/topic/59655/add-go-button-at-address-bar
I can create and add the HTML code, the real question is what is the code needed to paste and activate the address bar and search bar?
-
So I've had to create and insert my own Go button HTML code:
xml_add('inside', document.querySelectorAll('[class="UrlBar-AddressField button-textonly below"]')[0], '<div class="button-toolbar" xmlns="http://www.w3.org/1999/xhtml"><button class="button" tabindex="0" title="Go to address" style="background-color: #606; width: 34px;"><span>▶ Go</span></button></div>');
Now that I've got an HTML button to work with I'm working on deciphering the... event listener attached to the not-a-Go-button...button via:
getEventListeners(document.querySelectorAll('[title="Go to address"]')[0])
This has led me to:
C:\MEDIA\INTERNET\Vivaldi\4.0\Application\5.6.2867.50\resources\vivaldi\vendor-bundle.js"function"==typeof o.onClick&&(r.onclick=Qr)}
I've added:
<button onclick="Qr();"
Which does not work. I have tried other things such as using
window.open
with_self
to no avail.So there are some very specific ...contexts to Vivaldi's code that I'm not aware of and I also code...differently. I'm pretty close though could really use a developer to make a clarification please on how to emulate the psuedo-Go button's event listener. Perhaps the internal JavaScript functions are child functions or segregated in some fashion that I'm not aware of? Using typeof Qr == 'undefined' so, help, please?
-
@jabcreations Tapping into the default listeners isn't something anyone has figured out, as far as I know. You can simulate clicks on some elements, but it doesn't work on everything.
Your best bet would be to use Command Chains. They can be placed as buttons in the UI and with the most recent Snapshot version, you can even natively change the icon without a mod.
You would then want to look into seeing if JS bookmarklets can accomplish what you want to do. You can look at this forum thread to get some inspiration for what is possible: Command Chain Recipes
-
@nomadic I appreciate the suggestion. Unfortunately the closest thing I found was Paste and Go does nothing (made sure that I had a valid URL in the clipboard of course) when I click on the "Test Chain" button. I don't see how to add the command to the GUI toolbars as dragging the title on the left panel or right clicking on everything doesn't reveal any relevant options.
I did have another command working though it kept opening links in a new tab. I suppose if there is a copy option I could use that with paste and a go command...if those options existed...
-
@jabcreations Ok, for
Paste and Go
, I based it off of this: https://forum.vivaldi.net/post/509251- Focus Address Field
- Delay
Parameter:100
- Paste and Go
Then to add it as a button, you follow these steps: https://help.vivaldi.com/desktop/appearance-customization/edit-toolbars/#Customize_toolbars
You won't be able to change the icon yet unless you are using the Snapshot version. You can use a CSS mod to change the icon while you wait for the change to make it to Stable.
https://forum.vivaldi.net/topic/20227/changing-icons-with-css-part-ii
Sorry for mostly just providing links to things. Would rather point you in the right direction and give you an opportunity to learn more about the official sanctioned ways of modding Vivaldi instead of giving you the answers outright.
That way you can come up with some even more cool stuff and share it with everyone.
-
@nomadic GLORIOUS! Thank you!
I've got two of the buttons working and some trouble with the Search, though the two working buttons first:
Go Button:
- Focus Address Field
- Delay, 20
- Copy
- Paste and Go
Paste and Go Button:
- New Tab
- Delay, 20
- Focus Address Field
- Paste and Go
So I'm working on the Paste and Search button and so far I've got:
- New Tab
- Delay, 20
- Focus Search Field
- Paste
However there is no "search" command and the four items for "search" all paste the text to the end of whatever is in the address bar. Since Paste and Search isn't working I'll wait to see if you have anything useful on executing / triggering the search command somehow.
Thank you very much for your help thus far!
-
I use a keyboard shortcut in vimium-c for that.
-
@Truemotion Okay...I'm not interested in keyboard shortcuts, I'm working to clean up the browser's GUI; thank you though.
-
I can understand that. But as I played before and wasted a lot of time with the GUI, I have realized that the most efficient way is the cleanest one with decent key mappings. It is like music, when with a press of a single key you perform what you want without extra movements. Sorry for my IMHO
But why do you need a "paste and go button" in GUI, when you can press one key on your keyboard and voilà.
More GUI objects = more clutter = more distraction.