Backup Search Engines
-
Hello @luetage and thanks a lot for your numerous scripts and css's.
I just have one problem:
Despite of having modded the browser.html and copied the "custom.js" (to be precise: backup-search-engines.js) alongside the modded browser.html, there's no change in the UI (no additional buttons). Neither on Windows or Linux.
Any idea? Anyone?My Vivaldi Version is:
3.3.2022.45 (Stable channel) (64-Bit) -
@maze If you want to check whether the mod triggers at all yourself, you can insert a console.log in the code and fire up devtools. You can also paste a copy of the content of your
browser.html
file here, or on any other site (e.g. pastebin) and I'll take a look. Make sure that the filename of your js file is the same name you use inbrowser.html
. -
Here's my browser.html:
https://is.gd/Sfc4JAAnd here's a snap of the Vivaldi folder in question:
-
@maze Looks fine. The thing is the mod should work on latest stable and it definitely works on latest snapshot. Please check whether you can see an error in console concerning the mod while inspecting UI. Are you running other
js
mods? Different mods can sometimes interfere with each other. -
@luetage Not sure if I understood you correctly, but here's a snap of the console after starting up Vivaldi, then inspecting the speed dial:
I'm not running any other mods. I have no idea why the first three .js's are missing and if they are needed in the first place. The browser.html error looks odd.
-
@maze These errors are normal, everyone sees them. Are you trying to view search engines in the “Display All” category. If so, go instead to the “Search” section directly and click once at bottom on an empty part of the page. The additional buttons should load then.
-
@luetage I think got it! Sorry if this was said before and I skipped it accidentally, but the buttons only appear when using the site vivaldi://settings/search/ directly, then clicking some empty part.
The mistake was, I was entering the settings via ctrl+F12. I'm a fan of shortcuts.
But the pop-up settings doesn't seem to work with this.Thank you!
-
@maze Yeah, if you visit search settings directly, the mod has no chance to trigger. I might rework that. Honestly, I thought that both search and theme syncing would have been integrated native at this point and that’s why I haven’t really tried to improve on it over the last months. Seems like this isn’t going to be the case in the near future.
-
@luetage Okay, no problem. Now that I figured that out I'm just happy it works now.
Cheers!
-
If you are not using the settings page as a tab, this mod will need to be added to the
window.html
(same as the theme import/export one) instead. You will find it in the same location asbrowser.html
-
I reworked this mod, updated original post. Will only work with settings in a tab and by directly visiting
vivaldi://settings/search
. The overviewvivaldi://settings/all
won't trigger the mod. -
@maze The new mod should theoretically work with your shortcut directly, try it out.
edit: oh, you opened the popup with the shortcut, that will not work. What works is generating a bookmark forvivaldi://settings/search
and opening that in a tab. -
@sjudenim I tried that by adding the script to the body of window.html, but it didn't work on the settings pop-up.
-
@luetage Thanks, when I open the settings via vivaldi://settings/search/ the buttons are already there, no need to click anywhere anymore. Nice!
-
It used to work, but it seems that it no longer does with the update from yesterday.
-
@sjudenim Yeah, as mentioned in the original post, you gotta use a tab for the new version. The reason is that the chrome api in use doesn’t trigger on popup windows. The old version will continue to work in the popup with your trick of applying it to window, because it checks for elements on click. There is the possibility to make it work both in tabs and windows and also in
settings/all
, but that would require additional independent checks and likely the use of language specific attributes. It’s far less overhead with the restrictions in place—and backups or restoring isn’t usually done on a daily basis, so I figured users can just switch to the tab version for the backup, while otherwise using the popup. -
@luetage as long as Vivaldi doesn't get this implemented as a built-in feature, the workaround is okay, as long as we know how to use it.
A bit OT: I always wondered why Vivaldi has no proper backup function, would be a major pro for Vivaldi if you could just click and backup/restore all of the customizations we've made. Sometimes I'm starting from scratch to get rid of some orphaned stuff that accumulates over time, and a backup of just what I customized would come in very handy then. Now it's a PITA to set it up all again. On several machines Win/Lin it takes some time to get it all back like I want it to be.
So, thanks for your scripts! Makes things a tad easier for me.
-
@maze Yeah, I wished Vivaldi would do it all native and automatic, including our modifications. While CSS can be enabled with an experiment nowadays, the file doesn’t sync to other devices/new installs, just like many other inbuilt settings and adjustments, like startpage background and dials, patterns, &c. All of it is being saved outside the profile. Javascript mods are an afterthought and I doubt they will ever find proper support from the team. Syncing themes and engines is a different story, these are preferences within Vivaldi and could be synced with just a few lines of code. It puzzles me why this hasn’t happened yet.
-
Is there any way to do this without directly modifying the browser.html?
I'm on NixOS and the application files are all read-only, inside the system's /nix store directory, for security/that's just how nixos works. I know there are ways to modify the installation so I can inject changes in that file & drop in the custom.js or whatever, but I'd much rather just use something local, inside ~/.config/vivaldi/Default or similar.
I saw this thread, and tried just renaming custom.js to
.user.js
and dragging it into the vivaldi://extensions/ window, and it did apparently install as a custom extension. But it doesn't seem to do anything at all when I directly visit vivaldi://settings/search; confirmed by watching the console in Devtools and reloading the page.I'd welcome even a temporary, ugly hack, as long as it meant I could still grab a plaintext backup of the search engines in some form, and without all the permissions needed to modify the actual application files. Even if it required some hellish setup that broke everything temporarily and took 10 minutes to configure, I'd be fine with that as I'd just want to back up search engines one single time before hopping to a new OS (re)installation. I even tried looking in the .log files where vivaldi actually does encode the search engines' data, but WOW HOLY CRAP what an absolute clusterf**k, I've never seen any data storage structure as ridiculously and unnecessarily complicated as those things. It looks like it keeps the full history of all the changes you make to your search engines forever, in a pure, 100% disorganized, totally minified/non-pretty-printed, chronological mass of sprawling JSON replete with arcane unicode characters and... what the actual f**k. Because of the extra non-ascii chars, it technically gets read by Linux as a binary file so I couldn't even reliably use jq with it to try & restore some order to the formatting.
-
@jdally987 You can just run the code from the browser devtools console…
Or just take&modify the necessary part to get the backup directly, w/o even having to go to settings & clicking a button:
chrome.storage.local.get({'SEARCH_ENGINE_COLLECTION': ''}, function(back) { const engines = back.SEARCH_ENGINE_COLLECTION; const engineCode = JSON.stringify(engines); console.log(engineCode); })