From b9266bba1d178194dcc41e587562dfde26ef5df3 Mon Sep 17 00:00:00 2001 From: claustromaniac <20734810+claustromaniac@users.noreply.github.com> Date: Sun, 24 Dec 2017 16:49:33 +0000 Subject: [PATCH 1/8] 4.1 - added missing -unattended switch to the list of switches - other minor changes --- updater.bat | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/updater.bat b/updater.bat index 579170d..0d995ca 100644 --- a/updater.bat +++ b/updater.bat @@ -1,9 +1,10 @@ @ECHO OFF & SETLOCAL EnableDelayedExpansion TITLE ghacks user.js updater -REM ### ghacks-user.js updater for Windows +REM ## ghacks-user.js updater for Windows REM ## author: @claustromaniac -REM ## version: 4.0 +REM ## version: 4.1 +REM ## instructions: https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.3-Updater-Scripts SET _myname=%~n0 SET _myparams=%* @@ -75,7 +76,7 @@ ECHO: ECHO: ######################################## ECHO: #### user.js Updater for Windows #### ECHO: #### by claustromaniac #### -ECHO: #### v4.0 #### +ECHO: #### v4.1 #### ECHO: ######################################## ECHO: SET /A "_line=0" @@ -230,26 +231,29 @@ ENDLOCAL GOTO :EOF REM ############### Help ################## :showhelp -MODE 80,38 +MODE 80,43 CLS -CALL :message "Available switches (case-insensitive):" +CALL :message "Available arguments (case-insensitive):" CALL :message " -log" ECHO: Writes the console output to a logfile (user.js-update-log.txt) CALL :message " -logP" ECHO: Like log, but also opens the logfile after updating. CALL :message " -merge" -ECHO: Merges overrides instead of appending them. Comments and _user.js.parrot -ECHO: lines are appended normally. Overrides for inactive (commented out) +ECHO: Merges overrides instead of appending them. One-line comments and +ECHO: _user.js.parrot lines are appended normally. Overrides for inactive ECHO: user.js prefs will be appended. When -Merge and -MultiOverrides are used ECHO: together, a user-overrides-merged.js file is also generated in the root ECHO: directory for quick reference. It contains only the merged data from ECHO: override files and can be safely discarded after updating, or used as the ECHO: new user-overrides.js. When there are conflicting records for the same -ECHO: pref, the value of the last one declared will be used. +ECHO: pref, the value of the last one declared will be used. Visit the GitHub +ECHO: repository for usage examples and more detailed information. CALL :message " -multiOverrides" -ECHO: uses any and all .js files in a user.js-overrides sub-folder as overrides +ECHO: Uses any and all .js files in a user.js-overrides sub-folder as overrides ECHO: instead of the default user-overrides.js file. Files are appended in ECHO: alphabetical order. +CALL :message " -unattended" +ECHO: Skips user input. CALL :message " -updatebatch" ECHO: The script will update itself on execution. CALL :message "" From 94bbb6bab400c734226664dafe831554471fc505 Mon Sep 17 00:00:00 2001 From: claustromaniac <20734810+claustromaniac@users.noreply.github.com> Date: Sun, 24 Dec 2017 16:55:17 +0000 Subject: [PATCH 2/8] minor change --- updater.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/updater.bat b/updater.bat index 0d995ca..f9a00f8 100644 --- a/updater.bat +++ b/updater.bat @@ -246,8 +246,8 @@ ECHO: together, a user-overrides-merged.js file is also generated in the roo ECHO: directory for quick reference. It contains only the merged data from ECHO: override files and can be safely discarded after updating, or used as the ECHO: new user-overrides.js. When there are conflicting records for the same -ECHO: pref, the value of the last one declared will be used. Visit the GitHub -ECHO: repository for usage examples and more detailed information. +ECHO: pref, the value of the last one declared will be used. Visit the wiki +ECHO: for usage examples and more detailed information. CALL :message " -multiOverrides" ECHO: Uses any and all .js files in a user.js-overrides sub-folder as overrides ECHO: instead of the default user-overrides.js file. Files are appended in From 4f22afac7faf31035ed67b11464c400a389b0c03 Mon Sep 17 00:00:00 2001 From: claustromaniac <20734810+claustromaniac@users.noreply.github.com> Date: Mon, 25 Dec 2017 00:51:56 +0000 Subject: [PATCH 3/8] rewording --- updater.bat | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/updater.bat b/updater.bat index f9a00f8..ba49a4b 100644 --- a/updater.bat +++ b/updater.bat @@ -235,11 +235,11 @@ MODE 80,43 CLS CALL :message "Available arguments (case-insensitive):" CALL :message " -log" -ECHO: Writes the console output to a logfile (user.js-update-log.txt) +ECHO: Write the console output to a logfile (user.js-update-log.txt) CALL :message " -logP" -ECHO: Like log, but also opens the logfile after updating. +ECHO: Like -log, but also open the logfile after updating. CALL :message " -merge" -ECHO: Merges overrides instead of appending them. One-line comments and +ECHO: Merge overrides instead of appending them. One-line comments and ECHO: _user.js.parrot lines are appended normally. Overrides for inactive ECHO: user.js prefs will be appended. When -Merge and -MultiOverrides are used ECHO: together, a user-overrides-merged.js file is also generated in the root @@ -249,13 +249,13 @@ ECHO: new user-overrides.js. When there are conflicting records for the same ECHO: pref, the value of the last one declared will be used. Visit the wiki ECHO: for usage examples and more detailed information. CALL :message " -multiOverrides" -ECHO: Uses any and all .js files in a user.js-overrides sub-folder as overrides +ECHO: Use any and all .js files in a user.js-overrides sub-folder as overrides ECHO: instead of the default user-overrides.js file. Files are appended in ECHO: alphabetical order. CALL :message " -unattended" -ECHO: Skips user input. +ECHO: Run without user input. CALL :message " -updatebatch" -ECHO: The script will update itself on execution. +ECHO: Update the script itself on execution, before the normal routine. CALL :message "" PAUSE CLS From 018fb2a321dc0f5201efcdbed5245d6e70de7526 Mon Sep 17 00:00:00 2001 From: claustromaniac <20734810+claustromaniac@users.noreply.github.com> Date: Mon, 25 Dec 2017 03:33:36 +0000 Subject: [PATCH 4/8] cosmetic stuff --- updater.bat | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/updater.bat b/updater.bat index ba49a4b..4ecc7fa 100644 --- a/updater.bat +++ b/updater.bat @@ -165,7 +165,6 @@ IF EXIST user.js ( IF EXIST user.js.bak ( FC user.js.bak user.js >nul && SET "changed=false" || SET "changed=true" ) - ECHO: IF "!changed!"=="true" ( IF EXIST user.js.old.bak DEL /F user.js.old.bak CALL :message "Update complete." @@ -181,7 +180,7 @@ IF EXIST user.js ( IF EXIST user.js.bak ( REN user.js.bak user.js ) IF EXIST user.js.old.bak ( REN user.js.old.bak user.js.bak ) CALL :message "Update failed. Make sure PowerShell is allowed internet access." - CALL :message "No changes were made." + ECHO: No changes were made. ) IF NOT DEFINED _log ( IF NOT DEFINED _ua ( PAUSE ) @@ -191,9 +190,9 @@ EXIT /B REM ########### Message Function ########### :message SETLOCAL DisableDelayedExpansion -ECHO: +IF NOT DEFINED _log (ECHO:) ECHO: %~1 -ECHO: +IF NOT DEFINED _log (ECHO:) ENDLOCAL GOTO :EOF REM ############ Merge function ############ From daff5f6fa6732f9eec5c6f2fc0262e33e0a80941 Mon Sep 17 00:00:00 2001 From: claustromaniac <20734810+claustromaniac@users.noreply.github.com> Date: Mon, 25 Dec 2017 03:48:39 +0000 Subject: [PATCH 5/8] cosmetic fix + formatting the fix in question just removes the extra space in the version + date output (line 91) --- updater.bat | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/updater.bat b/updater.bat index 4ecc7fa..1307958 100644 --- a/updater.bat +++ b/updater.bat @@ -9,13 +9,13 @@ REM ## instructions: https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.3-Upd SET _myname=%~n0 SET _myparams=%* :parse -IF "%~1"=="" ( GOTO endparse ) -IF /I "%~1"=="-unattended" ( SET _ua=1 ) -IF /I "%~1"=="-log" ( SET _log=1 ) -IF /I "%~1"=="-logp" ( SET _log=1 & SET _logp=1 ) -IF /I "%~1"=="-multioverrides" ( SET _multi=1 ) -IF /I "%~1"=="-merge" ( SET _merge=1 ) -IF /I "%~1"=="-updatebatch" ( SET _updateb=1 ) +IF "%~1"=="" (GOTO endparse) +IF /I "%~1"=="-unattended" (SET _ua=1) +IF /I "%~1"=="-log" (SET _log=1) +IF /I "%~1"=="-logp" (SET _log=1 & SET _logp=1) +IF /I "%~1"=="-multioverrides" (SET _multi=1) +IF /I "%~1"=="-merge" (SET _merge=1) +IF /I "%~1"=="-updatebatch" (SET _updateb=1) SHIFT GOTO parse :endparse @@ -85,10 +85,10 @@ IF NOT EXIST user.js ( ) ELSE ( FOR /F "skip=1 tokens=1,2 delims=:" %%G IN (user.js) DO ( SET /A "_line+=1" - IF !_line! GEQ 4 ( GOTO exitloop ) - IF !_line! EQU 1 ( SET _name=%%H ) - IF !_line! EQU 2 ( SET _date=%%H ) - IF !_line! EQU 3 ( SET _version=%%G ) + IF !_line! GEQ 4 (GOTO exitloop) + IF !_line! EQU 1 (SET _name=%%H) + IF !_line! EQU 2 (SET _date=%%H) + IF !_line! EQU 3 (SET _version=%%G) ) :exitloop IF !_line! GEQ 4 ( @@ -111,20 +111,20 @@ IF NOT DEFINED _ua ( TIMEOUT 1 /nobreak >nul CHOICE /C SHE /N /M "Start [S] Help [H] Exit [E]" CLS - IF ERRORLEVEL 3 ( EXIT /B ) - IF ERRORLEVEL 2 ( GOTO :showhelp ) + IF ERRORLEVEL 3 (EXIT /B) + IF ERRORLEVEL 2 (GOTO :showhelp) ) IF DEFINED _log ( CALL :log >>user.js-update-log.txt 2>&1 - IF DEFINED _logp ( START user.js-update-log.txt ) + IF DEFINED _logp (START user.js-update-log.txt) EXIT /B :log ECHO:################################################################## CALL :message "%date%, %time%" ) -IF EXIST user.js.old.bak ( DEL /F user.js.old.bak ) +IF EXIST user.js.old.bak (DEL /F user.js.old.bak) IF EXIST user.js ( - IF EXIST user.js.bak ( REN user.js.bak user.js.old.bak ) + IF EXIST user.js.bak (REN user.js.bak user.js.old.bak) REN user.js user.js.bak CALL :message "Current user.js file backed up." ) @@ -146,7 +146,7 @@ IF EXIST user.js ( CALL :message "Appending..." COPY /B /V /Y user.js+"user.js-overrides\*.js" user.js ) - ) ELSE ( CALL :message "No override files found." ) + ) ELSE (CALL :message "No override files found.") ECHO: ) ELSE ( IF EXIST "user-overrides.js" ( @@ -157,7 +157,7 @@ IF EXIST user.js ( ) ELSE ( CALL :message "user-overrides.js appended." ) - ) ELSE ( CALL :message "user-overrides.js not found." ) + ) ELSE (CALL :message "user-overrides.js not found.") ECHO: ) CALL :message "Handling backups..." @@ -173,17 +173,17 @@ IF EXIST user.js ( DEL /F user.js.bak IF EXIST user.js.old.bak REN user.js.old.bak user.js.bak CALL :message "Update completed without changes." - ) ELSE ( CALL :message "Update complete." ) + ) ELSE (CALL :message "Update complete.") ) ECHO: ) ELSE ( - IF EXIST user.js.bak ( REN user.js.bak user.js ) - IF EXIST user.js.old.bak ( REN user.js.old.bak user.js.bak ) + IF EXIST user.js.bak (REN user.js.bak user.js) + IF EXIST user.js.old.bak (REN user.js.old.bak user.js.bak) CALL :message "Update failed. Make sure PowerShell is allowed internet access." ECHO: No changes were made. ) IF NOT DEFINED _log ( - IF NOT DEFINED _ua ( PAUSE ) + IF NOT DEFINED _ua (PAUSE) ) EXIT /B From 05ac6dd0ecdd7511285456e3b95c0bb78bf957c7 Mon Sep 17 00:00:00 2001 From: claustromaniac <20734810+claustromaniac@users.noreply.github.com> Date: Mon, 25 Dec 2017 08:18:41 +0000 Subject: [PATCH 6/8] autoparrot --- updater.bat | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/updater.bat b/updater.bat index 1307958..fc7a0e7 100644 --- a/updater.bat +++ b/updater.bat @@ -146,6 +146,10 @@ IF EXIST user.js ( CALL :message "Appending..." COPY /B /V /Y user.js+"user.js-overrides\*.js" user.js ) + ( + ECHO: + ECHO:user_pref("_user-overrides.js.parrot", "Parrot successfully overridden"); + )>>user.js ) ELSE (CALL :message "No override files found.") ECHO: ) ELSE ( @@ -157,6 +161,10 @@ IF EXIST user.js ( ) ELSE ( CALL :message "user-overrides.js appended." ) + ( + ECHO: + ECHO:user_pref("_user-overrides.js.parrot", "Parrot successfully overridden"); + )>>user.js ) ELSE (CALL :message "user-overrides.js not found.") ECHO: ) From 643206a3da61e8bfcb12eca40db3f5aebf7156ca Mon Sep 17 00:00:00 2001 From: claustromaniac <20734810+claustromaniac@users.noreply.github.com> Date: Mon, 25 Dec 2017 15:30:09 +0000 Subject: [PATCH 7/8] autoparrot - second try --- updater.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/updater.bat b/updater.bat index fc7a0e7..4cba82e 100644 --- a/updater.bat +++ b/updater.bat @@ -148,7 +148,7 @@ IF EXIST user.js ( ) ( ECHO: - ECHO:user_pref("_user-overrides.js.parrot", "Parrot successfully overridden"); + ECHO:user_pref("_user.js.parrot", "Parrot successfully overridden"); )>>user.js ) ELSE (CALL :message "No override files found.") ECHO: @@ -163,7 +163,7 @@ IF EXIST user.js ( ) ( ECHO: - ECHO:user_pref("_user-overrides.js.parrot", "Parrot successfully overridden"); + ECHO:user_pref("_user.js.parrot", "Parrot successfully overridden"); )>>user.js ) ELSE (CALL :message "user-overrides.js not found.") ECHO: From 65b64f44b61130a288aaef5989fdace96880eb18 Mon Sep 17 00:00:00 2001 From: earthlng Date: Tue, 26 Dec 2017 00:16:27 +0100 Subject: [PATCH 8/8] Update updater.bat --- updater.bat | 8 -------- 1 file changed, 8 deletions(-) diff --git a/updater.bat b/updater.bat index 4cba82e..1307958 100644 --- a/updater.bat +++ b/updater.bat @@ -146,10 +146,6 @@ IF EXIST user.js ( CALL :message "Appending..." COPY /B /V /Y user.js+"user.js-overrides\*.js" user.js ) - ( - ECHO: - ECHO:user_pref("_user.js.parrot", "Parrot successfully overridden"); - )>>user.js ) ELSE (CALL :message "No override files found.") ECHO: ) ELSE ( @@ -161,10 +157,6 @@ IF EXIST user.js ( ) ELSE ( CALL :message "user-overrides.js appended." ) - ( - ECHO: - ECHO:user_pref("_user.js.parrot", "Parrot successfully overridden"); - )>>user.js ) ELSE (CALL :message "user-overrides.js not found.") ECHO: )