{"id":13478675,"url":"https://github.com/claustromaniac/Compare-UserJS","last_synced_at":"2025-03-27T08:30:50.074Z","repository":{"id":134475731,"uuid":"140101995","full_name":"claustromaniac/Compare-UserJS","owner":"claustromaniac","description":"PowerShell script for comparing user.js (or prefs.js) files.","archived":false,"fork":false,"pushed_at":"2019-05-18T11:35:38.000Z","size":140,"stargazers_count":108,"open_issues_count":4,"forks_count":10,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-23T04:01:48.434Z","etag":null,"topics":["compare","compare-files","comparison-tool","diff","firefox","powershell","powershell-script","text-processing"],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/claustromaniac.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-07-07T16:58:52.000Z","updated_at":"2025-03-16T17:27:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"b9f3aa8d-dd1e-4c70-9fb6-241774991213","html_url":"https://github.com/claustromaniac/Compare-UserJS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claustromaniac%2FCompare-UserJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claustromaniac%2FCompare-UserJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claustromaniac%2FCompare-UserJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claustromaniac%2FCompare-UserJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/claustromaniac","download_url":"https://codeload.github.com/claustromaniac/Compare-UserJS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245809652,"owners_count":20676027,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compare","compare-files","comparison-tool","diff","firefox","powershell","powershell-script","text-processing"],"created_at":"2024-07-31T16:02:00.552Z","updated_at":"2025-03-27T08:30:49.741Z","avatar_url":"https://github.com/claustromaniac.png","language":"PowerShell","readme":" Compare-UserJS\n----------------\n\n- [Requirements][2]\n- [Instructions][3]\n- [Parameters][4]\n- [Examples and tips][5]\n- [Acknowledgments][6]\n- [Glossary][7]\n---\n\nThis script parses [*user.js* files][7] and compares them, logging the results to *userJS_diff.log*.\n\nInformation provided by this script:\n\n- matching prefs, both value and [state][7].\n- prefs with different values but matching state.\n- prefs declared in file A but not in file B, and vice versa.\n- inactive in A but active in B, and vice versa.\n- duplicates in each of the two source files.\n\nAdditionally, it can catch one type of syntax error (for now), and includes that information in the report.\n\nYou can see an example of what the output looks like [here][example].\n\n\n🔹 Requirements\n---------------\n\nPowerShell 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][ps].\n\n🔹 Instructions\n---------------\n\nCompare-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.\n\nIf you're on *nix you can just skip to the [examples][5].\n\nOn Windows you can:\n1. Download copies of both [*Compare-UserJS.bat*][bat] and [*Compare-UserJS.ps1*][ps1].\n2. Place them in the same folder.\n3. Drag and drop the two files that you want to compare on the *Compare-UserJS.bat*, simultaneously.\n\nThe *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:\n\n...relax the execution policy:\n```PowerShell\n# pick one or the other\nSet-ExecutionPolicy RemoteSigned\nSet-ExecutionPolicy Unrestricted\n```\n\n...or call the script like this:\n```Batchfile\nPowerShell -ExecutionPolicy Bypass -File Compare-UserJS.ps1 \u003cparams\u003e\n```\n\n[:top:][1]\n\n\n🔹 Parameters\n---------------\n\n|**Index** |   **Name**    | **Required?** |    **Default**    |                        **Description**                        |\n|:--------:|:-------------:|:-------------:|:-----------------:|---------------------------------------------------------------|\n|    0     | `filePath_A`  |      Yes      |                   | Path to the first file to compare. (1)                        |\n|    1     | `filePath_B`  |      Yes      |                   | Path to the second file to compare.                           |\n|    2     |  `ouputFile`  |      No       | *userJS_diff.log* | Path to the file where the report will be dumped.             |\n|    3     |   `append`    |      No       |       false       | Append the report to the end of the file if it already exists.|\n|    4     | `noCommentsA` |      No       |       false       | Parse JS comments in file A as code. (deprecated)             |\n|    5     | `noCommentsB` |      No       |       false       | Parse JS comments in file B as code.                          |\n|    6     |  `hideMask`   |      No       |         0         | Bitmask value for hiding parts of the report selectively. (2) |\n|    7     |    `inJS`     |      No       |       false       | Get the report written in JavaScript. (3)                     |\n\n\u003csub\u003e\u003cem\u003e\n  1 - All path parameters can be absolute or relative. \u003cbr\u003e\n  2 - See the embedded help info for details. \u003cbr\u003e\n  3 - It will be written to userJS_diff.js unless the -outputFile parameter is also specified.\n\u003c/em\u003e\u003c/sub\u003e\n\n[:top:][1]\n\n\n🔹 Examples and tips\n--------------------\n\nSee the embedded help info:\n```PowerShell\nGet-Help .\\Compare-UserJS -full\n```\nOr just read it from the file, but that's less thrilling.\n\nIf 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:\n```Shell\nPowerShell -Version 2 -File Compare-UserJS.ps1 \u003cparams\u003e\n# if you have PowerShell Core, use \"pwsh\" instead of \"PowerShell\", like this:\npwsh -Version 2 -File Compare-UserJS.ps1 \u003cparams\u003e\n```\n---------------\n\nComparing fileA to fileB:\n```PowerShell\n.\\Compare-UserJS.ps1 \"C:\\absolute\\path\\to\\fileA\" \"..\\relative\\path\\to\\fileB\"\n```\n\nComparing *fileA.js* to *fileB.js*, and saving the report to *report.txt*, appending to the end of the file:\n```PowerShell\n.\\Compare-UserJS.ps1 \"fileA.js\" \"fileB.js\" -outputFile \"report.txt\" -append\n```\n\nThis tool can help you make manual cleanups of your *prefs.js* too!\n```PowerShell\n.\\Compare-UserJS.ps1 prefs.js user.js -hideMask 502 -inJS\n```\n\nPassing any parameters to the BAT is the same, except that you don't need the `.\\`\n```Batchfile\nCompare-UserJS.bat \"fileA.js\" \"fileB.js\" -outputFile diff.txt\n```\n\n[:top:][1]\n\n\n🔹 Acknowledgments\n-------------------\nThanks to [Thorin-Oakenpants][p] and [earthlng][e] for their valuable feedback on the initial stages of this little project.\n\n\n🔹 Glossary\n-------------\n- State: Whether a pref was declared within the context of a JavaScript comment (inactive) or not (active).\n- user.js: Configuration file used by Firefox. You can find more information [here][article] and [here][wiki]. 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][g-u.js] if you haven't already.\n\n\n[1]: https://github.com/claustromaniac/Compare-UserJS#Compare-UserJS\n[2]: https://github.com/claustromaniac/Compare-UserJS#-requirements\n[3]: https://github.com/claustromaniac/Compare-UserJS#-instructions\n[4]: https://github.com/claustromaniac/Compare-UserJS#-parameters\n[5]: https://github.com/claustromaniac/Compare-UserJS#-examples-and-tips\n[6]: https://github.com/claustromaniac/Compare-UserJS#-acknowledgments\n[7]: https://github.com/claustromaniac/Compare-UserJS#-glossary\n\n[article]: https://developer.mozilla.org/en-US/docs/Mozilla/Preferences/A_brief_guide_to_Mozilla_preferences\n[bat]: https://raw.githubusercontent.com/claustromaniac/Compare-UserJS/master/Compare-UserJS.bat\n[example]: https://gist.github.com/claustromaniac/f88116f8a59042d59edf10646c906c24\n[g-u.js]: https://github.com/ghacksuserjs/ghacks-user.js\n[ps1]: https://raw.githubusercontent.com/claustromaniac/Compare-UserJS/master/Compare-UserJS.ps1\n[ps]: https://github.com/PowerShell/PowerShell\n[wiki]: https://github.com/ghacksuserjs/ghacks-user.js/wiki/1.1-Overview#small_orange_diamond-what-is-it-what-does-it-do-and-why-would-i-want-one\n\n[p]: https://github.com/Thorin-Oakenpants\n[e]: https://github.com/earthlng\n","funding_links":[],"categories":["PowerShell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclaustromaniac%2FCompare-UserJS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclaustromaniac%2FCompare-UserJS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclaustromaniac%2FCompare-UserJS/lists"}