Patching Vivaldi with batch scripts
-
@barbudo2005 No, yours is the exact same code
-
@barbudo2005 your file has to look like this:
<!-- 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>
-
@Pathduck But for me all JavaScript modifications work like this with this code.
-
@oudstand said in Patching Vivaldi with batch scripts:
<body></body>
<script src="custom.js"></script>
</html>Does it really work? Placing your
<script>
element like that is not valid HTML - it should go inside the body as stated in the guide.https://forum.vivaldi.net/topic/10549/modding-vivaldi#:~:text=inside the body element
But if it works, I guess it's fine ...
-
@barbudo2005 Itโs not. Your script is below the body closing tag
</body>
-
-
<body><script src="test.js"></script></body>
You should look into HTML basics. Will only take you 20 minutes, it is useful to know a little about it.
-
Don't be a bad person, give me the whole bar of chocolate, not just a square. LOL.
Please post the complete file detail.
-
-
-
@Pathduck No, thatโs wrong. It was something like: โGive a fish a stick and it can eat itself; throw the fish into a forest and it will lose its desire for sticks.โ
edit: but I canโt recall whether the fish will make any sound when landing in the shrubbery. Thatโs something to consider.
-
@Pathduck It does work, but you're right. I didn't noticed that the script wasn't inside of the
body
-
Now this is the code to patch Vivaldi correctly:
:: 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:\Anwendungen\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 custom.js "!latestVersionFolder!\window.html" > temp0.txt setlocal disabledelayedexpansion ( FOR /F "tokens=*" %%A IN (temp0.txt) DO ( IF "%%A" EQU "</body>" ( echo ^<script src="custom.js"^>^</script^> ) ECHO %%A ) ) >temp.txt setlocal enabledelayedexpansion type *.js > !latestVersionFolder!\custom.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
The result looks like this:
<!-- 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> <script src="custom.js"></script> </body> </html>
-
Be the only good person in this forum (you know who I mean) and post the details of the two files.
-
@barbudo2005 Sorry, we are cruel with our hints... Does this help?
$ tidy <!-- 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>line 11 column 3 - Warning: content occurs after end of body <!-- 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> <script src="custom.js"></script> </body> </html>
-
@barbudo2005 What do you mean? The first block of code is the updated version of the patch.bat file from the first post. The second code block is the correct result, where the custom code is inside of
<body> ... </body>
-
Thanks, my post crossed with yours.
-
You have redeemed yourself "in time". The other character will remain on the blacklist for quite some time.
-
-
@barbudo2005 You don't have to change
browser.html
butwindow.html