All Projects → claustromaniac → Compare-UserJS

claustromaniac / Compare-UserJS

Licence: MIT license
PowerShell script for comparing user.js (or prefs.js) files.

Programming Languages

powershell
5483 projects
javascript
184084 projects - #8 most used programming language
Batchfile
5799 projects

Projects that are alternatives of or similar to Compare-UserJS

vscode-diff
Compare two folders in Visual Studio Code
Stars: ✭ 66 (-16.46%)
Mutual labels:  diff, compare, compare-files
npmfs
javascript package inspector
Stars: ✭ 90 (+13.92%)
Mutual labels:  diff, compare
pg-diff
PostgreSQL schema and data comparing tool
Stars: ✭ 39 (-50.63%)
Mutual labels:  diff, compare
array-diff-multidimensional
Compare the difference between two multidimensional arrays in PHP
Stars: ✭ 60 (-24.05%)
Mutual labels:  diff, compare
Diff Match Patch
Diff Match Patch is a high-performance library in multiple languages that manipulates plain text.
Stars: ✭ 4,910 (+6115.19%)
Mutual labels:  diff, text-processing
VS.DiffAllFiles
Visual Studio Extension to make comparing files before and after committing them to Git and TFS faster and easier.
Stars: ✭ 26 (-67.09%)
Mutual labels:  diff, compare-files
HandySub
Download Subtitle from Subscene and other sources
Stars: ✭ 42 (-46.84%)
Mutual labels:  diff, compare
diff2HtmlCompare
Side-by-side diff shown in HTML
Stars: ✭ 103 (+30.38%)
Mutual labels:  diff, compare-files
Winmerge
WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.
Stars: ✭ 2,358 (+2884.81%)
Mutual labels:  diff, compare-files
dif
'dif' is a Linux preprocessing front end to gvimdiff/meld/kompare
Stars: ✭ 18 (-77.22%)
Mutual labels:  diff, text-processing
cinje
A Pythonic and ultra fast template engine DSL.
Stars: ✭ 26 (-67.09%)
Mutual labels:  text-processing
Recorder
A browser extension that generates Cypress, Playwright and Puppeteer test scripts from your interactions 🖱 ⌨
Stars: ✭ 277 (+250.63%)
Mutual labels:  firefox
Create-EXEFromPS1
Takes one PowerShell script and any number of supplementary files or even a directory and creates an exe using Windows's built in iexpress program. The exe will run on any machine with PowerShell 2.0+.
Stars: ✭ 81 (+2.53%)
Mutual labels:  powershell-script
Binary-Calculator-JavaScript
📱 A handy Calculator for Binary operations, that works on all Devices 📱 💻 🖥 | ⛓ https://play.google.com/store/apps/details?id=com.binarycalculator.ayidouble.binarycalculator.app ⛓
Stars: ✭ 45 (-43.04%)
Mutual labels:  firefox
wd
Comparing strings on a word per word basis and generating a coloured diff. This repository has migrated to https://gitlab.com/opennota/wd
Stars: ✭ 16 (-79.75%)
Mutual labels:  diff
lingua-go
👄 The most accurate natural language detection library for Go, suitable for long and short text alike
Stars: ✭ 684 (+765.82%)
Mutual labels:  text-processing
JabRef-Browser-Extension
Browser extension for JabRef to allow importing of new items directly from the browser.
Stars: ✭ 73 (-7.59%)
Mutual labels:  firefox
Geolocate-IP-Browser-Extension
A browser extension, which shows you the origin of your IP address.
Stars: ✭ 21 (-73.42%)
Mutual labels:  firefox
Better-Fox
An up-to-date user.js to speed up and secure Firefox
Stars: ✭ 158 (+100%)
Mutual labels:  firefox
yet-another-pinboard-extension
Manage your Pinboard bookmarks in your browser.
Stars: ✭ 27 (-65.82%)
Mutual labels:  firefox

Compare-UserJS


This script parses user.js files and compares them, logging the results to userJS_diff.log.

Information provided by this script:

  • matching prefs, both value and state.
  • prefs with different values but matching state.
  • prefs declared in file A but not in file B, and vice versa.
  • inactive in A but active in B, and vice versa.
  • duplicates in each of the two source files.

Additionally, it can catch one type of syntax error (for now), and includes that information in the report.

You can see an example of what the output looks like here.

🔹 Requirements

PowerShell version 2 (or newer) and .NET 3.5 (or newer), both of which come as standard components of Windows 7, but the script also runs fine on Unix-like systems. You can download the latest version of PowerShell and its dependencies from the official PowerShell repository.

🔹 Instructions

Compare-UserJS requires two parameters: the paths of the two files to be compared. You can pass them directly from the console/terminal, but that is not strictly necessary because the script will prompt you to enter them during execution if you don't.

If you're on *nix you can just skip to the examples.

On Windows you can:

  1. Download copies of both Compare-UserJS.bat and Compare-UserJS.ps1.
  2. Place them in the same folder.
  3. Drag and drop the two files that you want to compare on the Compare-UserJS.bat, simultaneously.

The Compare-UserJS.bat works as a launcher that makes it easier to run the PowerShell script. If you don't want to use said batchfile, you will first have to either:

...relax the execution policy:

# pick one or the other
Set-ExecutionPolicy RemoteSigned
Set-ExecutionPolicy Unrestricted

...or call the script like this:

PowerShell -ExecutionPolicy Bypass -File Compare-UserJS.ps1 <params>

🔝

🔹 Parameters

Index Name Required? Default Description
0 filePath_A Yes Path to the first file to compare. (1)
1 filePath_B Yes Path to the second file to compare.
2 ouputFile No userJS_diff.log Path to the file where the report will be dumped.
3 append No false Append the report to the end of the file if it already exists.
4 noCommentsA No false Parse JS comments in file A as code. (deprecated)
5 noCommentsB No false Parse JS comments in file B as code.
6 hideMask No 0 Bitmask value for hiding parts of the report selectively. (2)
7 inJS No false Get the report written in JavaScript. (3)

1 - All path parameters can be absolute or relative.
2 - See the embedded help info for details.
3 - It will be written to userJS_diff.js unless the -outputFile parameter is also specified.

🔝

🔹 Examples and tips

See the embedded help info:

Get-Help .\Compare-UserJS -full

Or just read it from the file, but that's less thrilling.

If you encounter any sort of issues with this script in a version of PowerShell higher than v2, try forcing the use of PSv2 like this:

PowerShell -Version 2 -File Compare-UserJS.ps1 <params>
# if you have PowerShell Core, use "pwsh" instead of "PowerShell", like this:
pwsh -Version 2 -File Compare-UserJS.ps1 <params>

Comparing fileA to fileB:

.\Compare-UserJS.ps1 "C:\absolute\path\to\fileA" "..\relative\path\to\fileB"

Comparing fileA.js to fileB.js, and saving the report to report.txt, appending to the end of the file:

.\Compare-UserJS.ps1 "fileA.js" "fileB.js" -outputFile "report.txt" -append

This tool can help you make manual cleanups of your prefs.js too!

.\Compare-UserJS.ps1 prefs.js user.js -hideMask 502 -inJS

Passing any parameters to the BAT is the same, except that you don't need the .\

Compare-UserJS.bat "fileA.js" "fileB.js" -outputFile diff.txt

🔝

🔹 Acknowledgments

Thanks to Thorin-Oakenpants and earthlng for their valuable feedback on the initial stages of this little project.

🔹 Glossary

  • State: Whether a pref was declared within the context of a JavaScript comment (inactive) or not (active).
  • user.js: Configuration file used by Firefox. You can find more information here and here. In the context of this project, this refers (to a limited extent) to all configuration files sharing the same syntax, including prefs.js and all.js. I recommend you to check out the ghacks user.js if you haven't already.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].