How to understand and modify bundle.js?

  • I requested a small feature about improving "find in page" method. I decided to implement it, so I can start to be familiar with modifying.

    If I'm right, I have to touch the so called bundle.js. Since it's a huge, minified file, I had to make it readable by code formater. After I did this, Vivaldi didn't started, but freezed on loading (only the logo showed instead of the browser). I think (and hope) if I will minify it again, it gets solved.

    My question is that this is the common way to mod bundle.js?

    • Prettify with code formater
    • Extend/modify the code
    • Minify it again

    Or should I override the methods somehow in custom.js (which I don't know how to do in the case of modifying an existing behaviour instead of extending with a new one)?

    Thanks for your help!

  • @bimlas I think it's just not practical modifying system files directly. You would have to reimplement the mod on every update. Which is easy, if the underlying code stays the same, but what if they update bundle.js? You'd start from scratch every time.

  • @luetage Well OK, it's better to use a separate file for extension, but how can I view what's going under the hood? Maybe I can find a better solution to implement my ideas than observing elements of the window. If I know what's functions called by "find in page" (for example) then I can call those functions too if I need it. Looking at bundle.js code is not a good practice?

  • Looking at the bundle.js might not be very helpful, as it's liable to change a lot on each release of vivaldi. I would imagine the layout of the main browser window would be more consistent.

    Also, there's the fact that it's not very easy to read through code that is intended to be minified. It's sometimes possible to read names of parts of the code, but even then the structure of the code itself is likely to have been changed a lot.

  • @lonm Yeah, it's a nightmare. I wanted to find out what triggers the find bar for example, but I never managed.

  • I just created my first mod: "Find in window" visual alert on starting the search over again

    It's a bit long because of mutation observers. If I would know how bundle.js works, then the script could be half that log. This is why I asking about bundle.js.

    So my opinion is Vivaldi is really cool, you can modify (almost) whatever you want, but it needs some boilerplate and hacky solutions because of lack of knowing bundle.js: it's halfly open for modifications. Making it more modification-friendly is planed? Implementing the features would be a help for the official developers too.


Looks like your connection to Vivaldi Forum was lost, please wait while we try to reconnect.