mirror of
https://github.com/arkenfox/user.js.git
synced 2025-05-08 01:43:51 +02:00
v1.0b7
This commit is contained in:
parent
46123f4d23
commit
89e603d7da
1 changed files with 6 additions and 8 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## prefs.js cleaner for Linux/Mac
|
## prefs.js cleaner for Linux/Mac
|
||||||
## author: @claustromaniac
|
## author: @claustromaniac
|
||||||
## version: 1.0b6
|
## version: 1.0b7
|
||||||
|
|
||||||
## special thanks to @overdodactyl and @earthlng for a few snippets that I stol..*cough* borrowed from the updater.sh
|
## special thanks to @overdodactyl and @earthlng for a few snippets that I stol..*cough* borrowed from the updater.sh
|
||||||
|
|
||||||
|
@ -37,13 +37,14 @@ fClean() {
|
||||||
# the magic happens here
|
# the magic happens here
|
||||||
prefs="@@"
|
prefs="@@"
|
||||||
prefexp="user_pref[ ]*\([ ]*[\"']([^\"']*)[\"'][ ]*,"
|
prefexp="user_pref[ ]*\([ ]*[\"']([^\"']*)[\"'][ ]*,"
|
||||||
while read -r line || [[ -n "$line" ]]; do
|
grep -E "${prefexp}" user.js >/tmp/userjs_updater_temp.dat
|
||||||
|
while read line; do
|
||||||
if [[ "$line" =~ $prefexp ]]; then
|
if [[ "$line" =~ $prefexp ]]; then
|
||||||
if [[ $prefs != *"@@${BASH_REMATCH[1]}@@"* ]]; then
|
if [[ $prefs != *"@@${BASH_REMATCH[1]}@@"* ]]; then
|
||||||
prefs="${prefs}${BASH_REMATCH[1]}@@"
|
prefs="${prefs}${BASH_REMATCH[1]}@@"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done <<< $(grep -E "${prefexp}" user.js)
|
done < /tmp/userjs_updater_temp.dat
|
||||||
|
|
||||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||||
if [[ "$line" =~ ^$prefexp ]]; then
|
if [[ "$line" =~ ^$prefexp ]]; then
|
||||||
|
@ -60,7 +61,7 @@ echo -e "\n\n"
|
||||||
echo " ╔══════════════════════════╗"
|
echo " ╔══════════════════════════╗"
|
||||||
echo " ║ prefs.js cleaner ║"
|
echo " ║ prefs.js cleaner ║"
|
||||||
echo " ║ by claustromaniac ║"
|
echo " ║ by claustromaniac ║"
|
||||||
echo " ║ v1.0b6 ║"
|
echo " ║ v1.0b7 ║"
|
||||||
echo " ╚══════════════════════════╝"
|
echo " ╚══════════════════════════╝"
|
||||||
echo -e "\nThis script should be run from your Firefox profile directory.\n"
|
echo -e "\nThis script should be run from your Firefox profile directory.\n"
|
||||||
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."
|
||||||
|
@ -79,10 +80,7 @@ select option in Start Help Exit; do
|
||||||
## create backup folder if it doesn't exist
|
## create backup folder if it doesn't exist
|
||||||
mkdir -p userjs_backups;
|
mkdir -p userjs_backups;
|
||||||
bakfile="userjs_backups/prefs.js.backup.$(date +"%Y-%m-%d_%H%M")"
|
bakfile="userjs_backups/prefs.js.backup.$(date +"%Y-%m-%d_%H%M")"
|
||||||
mv prefs.js "${bakfile}"
|
mv prefs.js "${bakfile}" || fQuit 1 "Operation aborted.\nReason: Could not create backup file $bakfile"
|
||||||
if [ ! $? ]; then
|
|
||||||
fQuit 1 "Operation aborted.\nReason: Could not create backup file $bakfile"
|
|
||||||
fi
|
|
||||||
echo -e "\nprefs.js backed up: $bakfile"
|
echo -e "\nprefs.js backed up: $bakfile"
|
||||||
echo "Cleaning prefs.js..."
|
echo "Cleaning prefs.js..."
|
||||||
fClean "$bakfile"
|
fClean "$bakfile"
|
||||||
|
|
Loading…
Add table
Reference in a new issue