Updated all bookmarklets to just be functions and we can use utils/bookmarkletMaker.js to generate the bookmarklets in the console for now.

This commit is contained in:
Greg Jacobs
2024-06-12 13:04:47 -04:00
parent 3f25aef4f2
commit e2c5035011
26 changed files with 587 additions and 380 deletions

View File

@@ -0,0 +1,28 @@
/**
* This script generates a bookmarklet from a JavaScript file.
* It reads the JavaScript file, removes any multiline comments, and creates a bookmarklet string.
* The bookmarklet can then be used to execute the JavaScript code in a browser.
*
* Use this to generate a bookmarklet from a JavaScript file in the utils/bookmarklets directory.
*
* @param {string} filePath - The path to the JavaScript file.
* @returns {string} The generated bookmarklet.
*/
const fs = require('fs');
const path = require('path');
// Get the file path from command line arguments
const filePath = process.argv[2];
// Read the JavaScript file
const jsCode = fs.readFileSync(filePath, 'utf8');
const cleanedCode = jsCode.replace(/\/\*[\s\S]*?\*\//, '');
// Create the bookmarklet
const bookmarklet = `javascript:(function() {
${cleanedCode}
})();`;
console.log(bookmarklet);