Skip to content

Instantly share code, notes, and snippets.

@mkhamat
Last active October 21, 2020 19:34
Show Gist options
  • Save mkhamat/13d02174ee4151a396354451ed58a273 to your computer and use it in GitHub Desktop.
Save mkhamat/13d02174ee4151a396354451ed58a273 to your computer and use it in GitHub Desktop.
Firefox User.js Generator
/**
* This is script for https://gist.github.com/0XDE57/fbd302cef7693e62c769
* remove descriptions and leave only config lines!
* put it in txt file and pass path to it through arg
* example: node index.js ./config.txt
*
* user.js will appear in the same directory
*
*/
const fs = require('fs');
var config = ``;
fs.readFile(process.argv[2], 'utf-8', (err, data) => {
let arr = data.split(/\n/)
for (let i = 0; i < arr.length; i++) {
let setting = arr[i].trim().split('=')[0]
let value = arr[i].trim().split('=')[1]
config += `user_pref("${setting}", ${value});\n`;
}
fs.writeFile('./user.js', config, 'utf-8')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment