We will be doing maintenance work on Vivaldi Translate on the 11th of May starting at 03:00 (UTC) (see the time in your time zone).
Some downtime and service disruptions may be experienced.
Thanks in advance for your patience.
How to prevent overwriting browser.html on update?
-
I have a
custom.js
and I don't want to fixbrowser.html
that is overwritten on every update.
How to do this? -
@dancer18 Hi - you can't.
As I'm sure you're aware, during update the whole
Vivaldi\Application\<version>\resources\vivaldi
folder gets replaced. So you can't make it read-only either, and that would probably cause a crash during update anyway.Your best bet is probably making a script that does what you want and just run it after update.
-
@pathduck Yes that would do it. However, I have no idea how to set it up.
Could you help? Or is there already a script as some other users might already need it for same reason? -
@dancer18 You are on Linux are you not? I thought all Linux users were shell-scripting experts?
Have a look here:
https://forum.vivaldi.net/topic/10592/patching-vivaldi-with-batch-scripts -
@pathduck Of course we are, all of us. It’s not like we copy/paste our code piecewise from dubious sources and build our very own Frankencode which we then share proudly with everyone else. That would be silly.
-
@pathduck said:
As I'm sure you're aware, during update the whole
Vivaldi\Application\<version>\resources\vivaldi
folder gets replaced.[a post later]
You are on Linux are you not?
these two things don’t seem right when combined; there’s no
\
or<version>
. -
@potmeklecbohdan Here - Linux - it is
/opt/vivaldi/resources/vivaldi
-
Is this maybe an option:
https://forum.vivaldi.net/topic/42039/vivaldi-boot-screen-not-dark/14Briefly:
Go to the url vivaldi://experiments/ (you need to paste it into the url bar)
Enable the "Allow for CSS modifications" option
Go to Settings > Appearance and find "Custom UI modifications"
Browse for the folder you chose for your mods:
Like: C:\Users\loren\Documents\Backup Items\Vivaldi\Vivaldi Mods\LiveCSSI put my 'bottom location for search bar' mods there, and haven't thought about them for a couple of years now. Or maybe the default Vivaldi adopted them?
Oh, I guess the "Live" thing doesn't mod .js files, or at least didn't two years ago. And that was the original question here.
-
@lorenamelang Yes, no problem with
custom.css
that is stored somewhere in profile folder.But
custom.js
has to be integrated into thebrowser.html
in the program directory. -
@luetage Maybe you have an answer to my question?
-
@dancer18 I already shared my batch scripts, feel free to use them ☛ https://forum.vivaldi.net/topic/10592/patching-vivaldi-with-batch-scripts/72
You just have to change the path to the modding directory and use your own username. -
@luetage said in How to prevent overwriting browser.html on update?:
use your own username.
or create a
vivmod
group -
@luetage Thank you! I thought you provided that somewhere but I couldn't find it.
However, something went wrong. I created a file
Vivaldi-snapshot-batch.sh
, made it executable and clicked on it - without an effect.Might be a false code-line? My
custom.js
is in the same directory asbrowser.html
.#!/bin/bash snapshot=/opt/vivaldi-snapshot/resources/vivaldi moddir=/opt/vivaldi-snapshot/resources/vivaldi sudo cp $moddir/custom.js $snapshot sudo sed -i -e 's/<\/body>/ <script src="uimod.js"><\/script>\n <\/body>/' "$snapshot/browser.html" sudo chgrp rainer $snapshot/custom.js sudo chmod g+rw $snapshot/custom.js echo "vivaldi patched"
-
@dancer18 I think you should put your
custom.js
file outside V application. -
@dancer18 firstly, there’s some probability of you losing the js due to using that location, though it ain’t high. secondly, if you wanna keep it there, you should only need the
browser.html
-patching line (+ the variable). -
@hlehyaric Maybe. However, up to now that file remains there when updating Snapshot (or Stable).
Using the code and filling in the changed path it still doesn't work:
#!/bin/bash snapshot=/opt/vivaldi-snapshot/resources/vivaldi moddir=$HOME/rainer sudo cp $moddir/custom.js $snapshot sudo cp $moddir/Page_Action.js $snapshot/user_files sudo sed -i -e 's/<\/body>/ <script src="uimod.js"><\/script>\n <\/body>/' "$snapshot/browser.html" sudo chgrp username $snapshot/custom.js sudo chmod g+rw $snapshot/custom.js echo "vivaldi patched"
Is the 3rd line correct? I put the
custom.js
file directly into my home directory. -
@dancer18 do you know what
$HOME
is when the script is run? you most likely want/home/rainer
. -
@potmeklecbohdan no I don't. And yes: I want
/home/rainer
.
So just ignore$HOME
?To avoid any further mistakes please give me the right code.
-
@dancer18 does a hand-written attempt on a diff suffice?
- moddir=$HOME/rainer + moddir=/home/rainer
also, i don’t know if this is the right code, i can just fix the mistake that i see atm.
-
@potmeklecbohdan Doesn't work either.