-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwindows_install_mods.bat
More file actions
61 lines (45 loc) · 1.59 KB
/
Copy pathwindows_install_mods.bat
File metadata and controls
61 lines (45 loc) · 1.59 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
:: Author: debiedowner
@echo off
REM make current directory work when run as administrator
cd "%~dp0"
set installPath=C:\Programs\Vivaldi Work\Application\
echo ## 1- Copying UserTheme folder
xcopy "UserTheme" "%installPath%UserTheme\" /E /Y
echo:
echo ## 2- Searching for window.html
echo Searching at: %installPath%
for /f "tokens=*" %%a in ('dir /a:-d /b /s "%installPath%"') do (
if "%%~nxa"=="window.html" set latestVersionFolder=%%~dpa
)
echo:
echo ## 3- Backing up window.html
if "%latestVersionFolder%"=="" (
pause & exit
) else (
echo Found latest version folder: "%latestVersionFolder%"
)
if not exist "%latestVersionFolder%\window.bak.html" (
echo Creating a backup of your original window.html file.
copy "%latestVersionFolder%\window.html" "%latestVersionFolder%\window.bak.html"
)
echo:
echo ## 4- Copying js files and Patching window.html
echo copying js files code to custom.js
type "applied-js-mods\*.js" > "%latestVersionFolder%\custom.js"
type "%latestVersionFolder%\window.bak.html" | findstr /v "</body>" | findstr /v "</html>" > "%latestVersionFolder%\window.html"
echo ^<script src="custom.js"^>^</script^> >> "%latestVersionFolder%\window.html"
echo ^</body^> >> "%latestVersionFolder%\window.html"
echo ^</html^> >> "%latestVersionFolder%\window.html"
echo:
echo ## 5- Copying css files that are in applied-js-mods folder
if exist "applied-js-mods\*.css" (
for %%f in (applied-js-mods\*.css) do (
echo Copying %%f to %latestVersionFolder%
copy "%%f" "%latestVersionFolder%"
)
) else (
echo No CSS files found in applied-js-mods/, skipping
)
echo:
echo ## Done
pause