Patching Vivaldi with batch scripts
-
-
@Pathduck The spaces are escaped in the original script and there is no way to work around that.
@hlehyaric So does the script still work from a fresh install? If so, no further action is required.
-
@luetage Yes, it still works from a fresh install.
-
I've updated the .bat to work with latest Vivaldi related to: Massive code refactoring. As @luetage mentioned the changes have to be applied to the
window.html
file.In my version the .bat also closes all running instances of Vivaldi before patching.
:: end Vivaldi :: taskkill /F /IM vivaldi.exe /T @echo off setlocal enabledelayedexpansion :: This is a list of your Vivaldi installations' Application folders (you can use the Vivaldi folder, too, but it takes longer to find the file): set installPaths="D:\Programme\Vivaldi\Application\" :: Don't alter anything below this point ;) set nrOfInstalls=0 set "SuccessfulPatched=Couldn't Patch :^(" for %%i in (%installPaths%) do ( <NUL set /p=Searching for newest window.html in %%~dpi... set /a nrOfInstalls=nrOfInstalls+1 set installPath=%%~dpi set latestVersionFolder= for /f "tokens=*" %%a in ('dir /a:-d /b /s "!installPath!"') do ( if "%%~nxa"=="window.html" set latestVersionFolder=%%~dpa ) if not defined latestVersionFolder ( set cnt=any echo. echo Couldn't find it. :( echo Is !installPath! the correct Vivaldi Application folder? echo. ) else ( echo Found it. echo. if exist !latestVersionFolder!\window.bak.html ( echo Backup is already in place. ) else ( echo Creating a backup of your original window.html file. copy /y "!latestVersionFolder!\window.html" "!latestVersionFolder!\window.bak.html" ) echo. ) ) findstr /v Compiled_User_JS.js "!latestVersionFolder!\window.html" > temp0.txt setlocal disabledelayedexpansion ( FOR /F "tokens=*" %%A IN (temp0.txt) DO ( ECHO %%A IF "%%A" EQU "</body>" ( echo ^<script src="Compiled_User_JS.js"^>^</script^> ) ) ) >temp.txt setlocal enabledelayedexpansion type *.js > !latestVersionFolder!\Compiled_User_JS.js move /Y temp.txt "!latestVersionFolder!window.html" del temp0.txt echo. echo Copied files^^! set cnt=0 for %%A in (*.js) do set /a cnt+=1 set "SuccessfulPatched=Succesfully Patched" echo. echo. echo All done^^! :) !SuccessfulPatched! !cnt! .js files^^! echo. echo. :: Start Vivaldi :: echo Start Vivaldi^^! cd .. cd Application start vivaldi.exe timeout 5 exit
-
Seems like adding something to the window.html file prevents Vivaldi from opening a new window correctly. Can this be confirmed by some one?
-
@oudstand No, opening new windows should work as expected.
-
If
<script src="Compiled_User_JS.js"></script>
is added to thewindow.html
, I can't open another window. Even ifCompiled_User_JS.js
is empty. -
@oudstand Can you show the whole file, please? And maybe try with another filename, for example
test.js
—no uppercase and underscore, just for a sanity check. -
@luetage I tried like this with
test.js
but the result is the same.<!-- Vivaldi window document --> <!DOCTYPE html> <html> <head> <!-- Keep the styling in sync with ./browser.html --> <meta charset="UTF-8" /> <title>Vivaldi</title> <link rel="stylesheet" href="style/common.css" /> <link rel="stylesheet" href="chrome://vivaldi-data/css-mods/css" /> <script src="test.js"></script> </head> <body> </body> </html>
-
That’s the mistake, the script tags have to go into the body tag, as described in the first post.
-
@luetage said in Patching Vivaldi with batch scripts:
That’s the mistake, the script tags have to go into the body tag, as described in the first post.
Oh my bad
I've updated my previous code. It now adds the script before</body>
Wasn't it in the previous version also in the
HEAD
? -
-
@luetage i found out myself:
<!-- Vivaldi window document --> <!DOCTYPE html> <html> <head> <!-- Keep the styling in sync with ./browser.html --> <meta charset="UTF-8" /> <title>Vivaldi</title> <link rel="stylesheet" href="style/common.css" /> <link rel="stylesheet" href="chrome://vivaldi-data/css-mods/css" /> </head> <body> </body> <script src="custom.js"></script> </html>
I am very happy about that.
-
@stardepp As custom mods are not "offically supported" by Vivaldi, I have moved your posts here, hope that's OK
-
@Pathduck said in Patching Vivaldi with batch scripts:
@stardepp As custom mods are not "offically supported" by Vivaldi, I have moved your posts here, hope that's OK
Yes, you got that so right.
-
@stardepp
Good job! -
I don't see the difference. Please clarify.
This is my window.html file:
<!-- Vivaldi window document --> <!DOCTYPE html> <html> <head> <!-- Keep the styling in sync with ./browser.html --> <meta charset="UTF-8" /> <title>Vivaldi</title> <link rel="stylesheet" href="style/common.css" /> <link rel="stylesheet" href="chrome://vivaldi-data/css-mods/css" /> </head> <body> </body> <script src="custom.js"></script> </html>
Is it Ok?
-
@barbudo2005 Just copy my code and use it.
-
@stardepp The
script
element is not allowed inside thehtml
element. It needs to go inside thebody
element. What you're doing is not valid HTML code.It might work (browsers do some "fool proofing", but is not the correct way to add scripts
-
So mine is Ok?