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

@@ -1,29 +1,47 @@
# Gregs Memory Palace
This project contains several files that perform various tasks. Here's a brief overview of each file:
This project contains several files that perform various tasks to make my life easier. This README is maintained by one of the functions in here and ran on a pre-commit hook. Any new files added in utils make sure there are comments so this file can be as useful as possible.
# File Summary
## [apiResponseChecker.js](src\utils\apiResponseChecker.js)
This file contains a script that fetches data from an API and writes it to a file.
The script makes multiple API calls at regular intervals for a specified duration.
The fetched data is appended to separate files based on the data center, user tier, and security symbol.
The script uses Axios for making HTTP requests and the fs module for file operations.
The script exports a function fetchAndWriteApiData that takes an object with the following properties:
- url: The URL of the API endpoint to fetch data from.
- headers: An object containing the headers to be sent with the request.
- dataCenter: The data center to which the API request should be made.
- userTier: The user tier for which the API request should be made.
- xid: The xid of the security for which the API request should be made.
If user does not provide any input, it opens the default DAG Tasks page in a new tab.
- symbol: The symbol of the security for which the API request should be made.
The script also schedules the API calls to be made every 2 minutes for a duration of 4 hours.
The start time and stop time are logged to the console.
## [bookmarkletMaker.js](src\utils\bookmarkletMaker.js)
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.
## [apiDocs.js](src\utils\bookmarklets\apiDocs.js)
2. Decodes the string using decodeURIComponent.
Opens the API documentation for a given project API.
Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
@param {string} projectAPI - The project API to open the documentation for.
## [jira.js](src\utils\bookmarklets\jira.js)
## [dag.js](src\utils\bookmarklets\dag.js)
Opens the DAG Task details page(s) based on user input.
If user provides a comma-separated list of DAG Task numbers, it opens each task's details page in a new tab.
@@ -33,22 +51,12 @@ The function finds the input field on the page, iterates over the new securities
## [hashid.js](src\utils\bookmarklets\hashid.js)
5. Opens the URL in a new browser tab and brings focus to it.
This JavaScript function takes a string, decodes it using decodeURIComponent,
alerts the decoded string, and copies the result to the clipboard.
The function works as follows:
1. Takes a string as input.
2. Decodes the string using decodeURIComponent.
3. Alerts the decoded string.
4. Copies the decoded string to the clipboard.
This JavaScript function is a bookmarklet that prompts the user for multiple MOID (Markit On Demand) numbers
and then opens a new browser tab for each corresponding Jira page for those MOIDs.
The function works as follows:
1. Prompts the user to enter MOID numbers separated by commas. The entered values are stored in the `answers` array.
2. Sets a default URL to the Jira dashboard.
3. Checks if the user entered any values in the prompt.
4. If the user entered values, changes the URL to point to the specific Jira page for each entered MOID number.
5. Opens each URL in a new browser tab and brings focus to the last opened tab.
Note: This function is wrapped in a self-invoking function `(function() {...})();` which means it will automatically execute as soon as it is defined.
## [rbc-di-featureflags.js](src\utils\bookmarklets\rbc-di-featureflags.js)