-
Notifications
You must be signed in to change notification settings - Fork 0
/
installJS.bat
34 lines (26 loc) · 1.1 KB
/
installJS.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
:: Author: debiedowner
@echo off
REM make current directory work when run as administrator
cd "%~dp0"
set installPath="%localappdata%\Vivaldi\Application\"
echo Searching at: %installPath%
for /f "tokens=*" %%a in ('dir /a:-d /b /s %installPath%') do (
if "%%~nxa"=="browser.html" set latestVersionFolder=%%~dpa
)
if "%latestVersionFolder%"=="" (
pause & exit
) else (
echo Found latest version folder: "%latestVersionFolder%"
)
if not exist "%latestVersionFolder%\browser.bak.html" (
echo Creating a backup of your original browser.html file.
copy "%latestVersionFolder%\browser.html" "%latestVersionFolder%\browser.bak.html"
)
echo copying js files to custom.js
type *.js > "%latestVersionFolder%\custom.js"
echo patching browser.html file
type "%latestVersionFolder%\browser.bak.html" | findstr /v "</body>" | findstr /v "</html>" > "%latestVersionFolder%\browser.html"
echo ^<script src="custom.js"^>^</script^> >> "%latestVersionFolder%\browser.html"
echo ^</body^> >> "%latestVersionFolder%\browser.html"
echo ^</html^> >> "%latestVersionFolder%\browser.html"
pause