store file with CRLF
I think there's no way to get rid of ^M but hopefully with `*.bat -text` in `.gitattributes` it shouldn't be a problem because git won't do any line conversion on check-in/out. This way the raw link as well as the file within the zip download should be in proper MSDOS CRLF format, and git status shouldn't report the file as modified either. ***fingerscrossed!!***
This commit is contained in:
parent
a1638868ea
commit
9c975b318a
216
prefsCleaner.bat
216
prefsCleaner.bat
@ -1,108 +1,108 @@
|
|||||||
@ECHO OFF & SETLOCAL DisableDelayedExpansion
|
@ECHO OFF & SETLOCAL DisableDelayedExpansion
|
||||||
TITLE prefs.js cleaner
|
TITLE prefs.js cleaner
|
||||||
|
|
||||||
REM ### prefs.js cleaner for Windows
|
REM ### prefs.js cleaner for Windows
|
||||||
REM ## author: @claustromaniac
|
REM ## author: @claustromaniac
|
||||||
REM ## version: 2.1
|
REM ## version: 2.1
|
||||||
|
|
||||||
:begin
|
:begin
|
||||||
ECHO:
|
ECHO:
|
||||||
ECHO:
|
ECHO:
|
||||||
ECHO ########################################
|
ECHO ########################################
|
||||||
ECHO #### prefs.js cleaner for Windows ####
|
ECHO #### prefs.js cleaner for Windows ####
|
||||||
ECHO #### by claustromaniac ####
|
ECHO #### by claustromaniac ####
|
||||||
ECHO #### v2.1 ####
|
ECHO #### v2.1 ####
|
||||||
ECHO ########################################
|
ECHO ########################################
|
||||||
ECHO:
|
ECHO:
|
||||||
CALL :message "This script should be run from your Firefox profile directory."
|
CALL :message "This script should be run from your Firefox profile directory."
|
||||||
ECHO It will remove any entries from prefs.js that also exist in user.js.
|
ECHO It will remove any entries from prefs.js that also exist in user.js.
|
||||||
CALL :message "This will allow inactive preferences to be reset to their default values."
|
CALL :message "This will allow inactive preferences to be reset to their default values."
|
||||||
ECHO This Firefox profile shouldn't be in use during the process.
|
ECHO This Firefox profile shouldn't be in use during the process.
|
||||||
CALL :message ""
|
CALL :message ""
|
||||||
TIMEOUT 1 /nobreak >nul
|
TIMEOUT 1 /nobreak >nul
|
||||||
CHOICE /C SHE /N /M "Start [S] Help [H] Exit [E]"
|
CHOICE /C SHE /N /M "Start [S] Help [H] Exit [E]"
|
||||||
CLS
|
CLS
|
||||||
IF ERRORLEVEL 3 (EXIT /B)
|
IF ERRORLEVEL 3 (EXIT /B)
|
||||||
IF ERRORLEVEL 2 (GOTO :showhelp)
|
IF ERRORLEVEL 2 (GOTO :showhelp)
|
||||||
IF NOT EXIST "user.js" (CALL :abort "user.js not found in the current directory." 30)
|
IF NOT EXIST "user.js" (CALL :abort "user.js not found in the current directory." 30)
|
||||||
IF NOT EXIST "prefs.js" (CALL :abort "prefs.js not found in the current directory." 30)
|
IF NOT EXIST "prefs.js" (CALL :abort "prefs.js not found in the current directory." 30)
|
||||||
CALL :FFcheck
|
CALL :FFcheck
|
||||||
CALL :message "Backing up prefs.js..."
|
CALL :message "Backing up prefs.js..."
|
||||||
SET "_time=%time: =0%"
|
SET "_time=%time: =0%"
|
||||||
COPY /B /V /Y prefs.js "prefs-backup-%date:/=-%_%_time::=.%.js"
|
COPY /B /V /Y prefs.js "prefs-backup-%date:/=-%_%_time::=.%.js"
|
||||||
CALL :message "Cleaning prefs.js..."
|
CALL :message "Cleaning prefs.js..."
|
||||||
CALL :cleanup
|
CALL :cleanup
|
||||||
CALL :message "All done!"
|
CALL :message "All done!"
|
||||||
TIMEOUT 5 >nul
|
TIMEOUT 5 >nul
|
||||||
ENDLOCAL
|
ENDLOCAL
|
||||||
EXIT /B
|
EXIT /B
|
||||||
|
|
||||||
REM ########## Abort Function ###########
|
REM ########## Abort Function ###########
|
||||||
:abort
|
:abort
|
||||||
CALL :message %1
|
CALL :message %1
|
||||||
TIMEOUT %~2 >nul
|
TIMEOUT %~2 >nul
|
||||||
EXIT
|
EXIT
|
||||||
REM ########## Message Function #########
|
REM ########## Message Function #########
|
||||||
:message
|
:message
|
||||||
ECHO:
|
ECHO:
|
||||||
ECHO: %~1
|
ECHO: %~1
|
||||||
ECHO:
|
ECHO:
|
||||||
GOTO :EOF
|
GOTO :EOF
|
||||||
REM ####### Firefox Check Function ######
|
REM ####### Firefox Check Function ######
|
||||||
:FFcheck
|
:FFcheck
|
||||||
TASKLIST /FI "IMAGENAME eq firefox.exe" 2>NUL | FIND /I /N "firefox.exe">NUL
|
TASKLIST /FI "IMAGENAME eq firefox.exe" 2>NUL | FIND /I /N "firefox.exe">NUL
|
||||||
IF NOT ERRORLEVEL 1 (
|
IF NOT ERRORLEVEL 1 (
|
||||||
CLS
|
CLS
|
||||||
CALL :message "Firefox is still running."
|
CALL :message "Firefox is still running."
|
||||||
ECHO If you're not currently using this profile you can continue, otherwise
|
ECHO If you're not currently using this profile you can continue, otherwise
|
||||||
CALL :message "close Firefox first!"
|
CALL :message "close Firefox first!"
|
||||||
ECHO:
|
ECHO:
|
||||||
PAUSE
|
PAUSE
|
||||||
CLS
|
CLS
|
||||||
CALL :message "Resuming..."
|
CALL :message "Resuming..."
|
||||||
TIMEOUT 5 /nobreak >nul
|
TIMEOUT 5 /nobreak >nul
|
||||||
)
|
)
|
||||||
GOTO :EOF
|
GOTO :EOF
|
||||||
REM ######### Cleanup Function ##########
|
REM ######### Cleanup Function ##########
|
||||||
:cleanup
|
:cleanup
|
||||||
FOR /F tokens^=2^ delims^=^'^" %%G IN ('FINDSTR /R /C:"^[^\"']*user_pref[ ]*\([ ]*[\"'][^\"']*[\"'][ ]*," user.js') DO (
|
FOR /F tokens^=2^ delims^=^'^" %%G IN ('FINDSTR /R /C:"^[^\"']*user_pref[ ]*\([ ]*[\"'][^\"']*[\"'][ ]*," user.js') DO (
|
||||||
IF NOT ""=="%%G" (SET "[%%G]=1")
|
IF NOT ""=="%%G" (SET "[%%G]=1")
|
||||||
)
|
)
|
||||||
(
|
(
|
||||||
FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" prefs.js') DO (
|
FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" prefs.js') DO (
|
||||||
IF ""=="%%H" (
|
IF ""=="%%H" (
|
||||||
ECHO:
|
ECHO:
|
||||||
) ELSE (
|
) ELSE (
|
||||||
FOR /F tokens^=1^,2^ delims^=^"^' %%I IN ("%%H") DO (
|
FOR /F tokens^=1^,2^ delims^=^"^' %%I IN ("%%H") DO (
|
||||||
IF NOT DEFINED [%%J] (ECHO:%%H)
|
IF NOT DEFINED [%%J] (ECHO:%%H)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)>tempcleanedprefs
|
)>tempcleanedprefs
|
||||||
MOVE /Y tempcleanedprefs prefs.js
|
MOVE /Y tempcleanedprefs prefs.js
|
||||||
GOTO :EOF
|
GOTO :EOF
|
||||||
REM ############### Help ##################
|
REM ############### Help ##################
|
||||||
:showhelp
|
:showhelp
|
||||||
MODE 80,34
|
MODE 80,34
|
||||||
CLS
|
CLS
|
||||||
CALL :message "This script creates a backup of your prefs.js file before doing anything."
|
CALL :message "This script creates a backup of your prefs.js file before doing anything."
|
||||||
ECHO It should be safe, but you can follow these steps if something goes wrong:
|
ECHO It should be safe, but you can follow these steps if something goes wrong:
|
||||||
ECHO:
|
ECHO:
|
||||||
CALL :message " 1. Make sure Firefox is closed."
|
CALL :message " 1. Make sure Firefox is closed."
|
||||||
ECHO 2. Delete prefs.js in your profile folder.
|
ECHO 2. Delete prefs.js in your profile folder.
|
||||||
CALL :message " 3. Delete Invalidprefs.js if you have one in the same folder."
|
CALL :message " 3. Delete Invalidprefs.js if you have one in the same folder."
|
||||||
ECHO 4. Rename or copy your latest backup to prefs.js.
|
ECHO 4. Rename or copy your latest backup to prefs.js.
|
||||||
CALL :message " 5. Run Firefox and see if you notice anything wrong with it."
|
CALL :message " 5. Run Firefox and see if you notice anything wrong with it."
|
||||||
ECHO 6. If you do notice something wrong, especially with your extensions,
|
ECHO 6. If you do notice something wrong, especially with your extensions,
|
||||||
CALL :message " and/or with the UI, go to about:support, and restart Firefox with"
|
CALL :message " and/or with the UI, go to about:support, and restart Firefox with"
|
||||||
ECHO add-ons disabled. Then, restart it again normally, and see if the
|
ECHO add-ons disabled. Then, restart it again normally, and see if the
|
||||||
CALL :message " problems were solved."
|
CALL :message " problems were solved."
|
||||||
ECHO:
|
ECHO:
|
||||||
CALL :message "If you are able to identify the cause of your issues, please bring it up"
|
CALL :message "If you are able to identify the cause of your issues, please bring it up"
|
||||||
ECHO on ghacks-user.js GitHub repository.
|
ECHO on ghacks-user.js GitHub repository.
|
||||||
ECHO:
|
ECHO:
|
||||||
ECHO:
|
ECHO:
|
||||||
PAUSE
|
PAUSE
|
||||||
CLS
|
CLS
|
||||||
GOTO :begin
|
GOTO :begin
|
||||||
REM #####################################
|
REM #####################################
|
||||||
|
Loading…
Reference in New Issue
Block a user