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:
11
.gitignore
vendored
11
.gitignore
vendored
@@ -1,3 +1,12 @@
|
|||||||
|
# The usual suspects in frontend dev
|
||||||
package-lock.json
|
package-lock.json
|
||||||
node_modules/
|
node_modules/
|
||||||
codingstandards.txt
|
|
||||||
|
# References used by copilot
|
||||||
|
references/
|
||||||
|
|
||||||
|
#Static files created by apps
|
||||||
|
output/
|
||||||
|
|
||||||
|
# Environment variables
|
||||||
|
.env
|
||||||
48
README.MD
48
README.MD
@@ -1,29 +1,47 @@
|
|||||||
# Gregs Memory Palace
|
# 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
|
# 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.
|
- 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.
|
- 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.
|
- 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 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)
|
## [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)
|
## [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.
|
Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
||||||
|
|
||||||
@param {string} projectAPI - The project API to open the documentation for.
|
@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.
|
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.
|
If user provides a comma-separated list of DAG Task numbers, it opens each task's details page in a new tab.
|
||||||
@@ -35,20 +53,10 @@ It then triggers events to simulate user input and key presses to add the securi
|
|||||||
|
|
||||||
This JavaScript function takes a string, decodes it using decodeURIComponent,
|
This JavaScript function takes a string, decodes it using decodeURIComponent,
|
||||||
alerts the decoded string, and copies the result to the clipboard.
|
alerts the decoded string, and copies the result to the clipboard.
|
||||||
|
|
||||||
|
The function works as follows:
|
||||||
1. Takes a string as input.
|
1. Takes a string as input.
|
||||||
2. Decodes the string using decodeURIComponent.
|
2. Decodes the string using decodeURIComponent.
|
||||||
3. Alerts the decoded string.
|
3. Alerts the decoded string.
|
||||||
4. Copies the decoded string to the clipboard.
|
4. Copies the decoded string to the clipboard.
|
||||||
|
|
||||||
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)
|
|
||||||
@@ -3,12 +3,14 @@
|
|||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "This project contains several files that perform various tasks. Here's a brief overview of each file:",
|
"description": "This project contains several files that perform various tasks. Here's a brief overview of each file:",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"lint": "eslint src --ext .js",
|
"lint": "eslint src --ext .js",
|
||||||
"lint:fix": "eslint src --ext .js --fix",
|
"lint:fix": "eslint src --ext .js --fix",
|
||||||
"format": "prettier src --write --ignore-unknown",
|
"format": "prettier src --write --ignore-unknown",
|
||||||
"readme": "node updateReadme.js"
|
"readme": "node src/utils/git/updateReadme.js",
|
||||||
|
"bookmark": "node src/utils/bookmarkletMaker.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -21,5 +23,10 @@
|
|||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
"eslint-plugin-prettier": "^5.1.3",
|
||||||
"prettier": "^3.3.0"
|
"prettier": "^3.3.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^1.7.2",
|
||||||
|
"dotenv": "^16.4.5",
|
||||||
|
"json": "^11.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
24
src/ideas/RBCDict.txt
Normal file
24
src/ideas/RBCDict.txt
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
SGID=6756377f6537943100df345f380035003301
|
||||||
|
language=ENGLISH
|
||||||
|
system=NETA
|
||||||
|
7AServer=N600LD
|
||||||
|
rbPath=https://www1.steroyalbank.com/cgi-bin/rbaccess/rbunxcgi
|
||||||
|
siteNavCss=https://www1.steroyalbank.com/N600/css/rbcSiteNav_1024Mega.css
|
||||||
|
siteNavJs=https%3a%2f%2fwww1.steroyalbank.com%2fcgi-bin%2frbaccess%2frbunxcgi%3fF22%3d4WN600S%267ASERVER%3dN601LD%26LANGUAGE%3dENGLISH%267ASCRIPT%3d%2fWebUI%2fNavigation%2fHeaderFooter
|
||||||
|
titleHeader=Navigation Header
|
||||||
|
titleMenu=Menu
|
||||||
|
titleFooter=Footer
|
||||||
|
requestTime=739042.12:03:04.3789018
|
||||||
|
refId=sucduu%252fQIQBuLwttXjWgvw%253d%253d
|
||||||
|
showlevel2=no
|
||||||
|
NETA=1
|
||||||
|
DSOL=1
|
||||||
|
WM=1
|
||||||
|
IB=0
|
||||||
|
HOME=0
|
||||||
|
rollover=1
|
||||||
|
xtid=RBC:6756377f6537943100df345f380035003301
|
||||||
|
xbrand=NETA
|
||||||
|
LOGICALSESSID=iHpJZiDwq91hZlQwAAD4HwAAbXYFAA__
|
||||||
|
RBCAPI=STE_ENV2
|
||||||
|
HSBCStatus=1
|
||||||
@@ -1 +1,7 @@
|
|||||||
- Checking network tab for certain calls and showing their data
|
- Checking network tab for certain calls and showing their data
|
||||||
|
- C:\Projects\memorypalace\src\utils\importBookmarkMaker.js
|
||||||
|
|
||||||
|
|
||||||
|
Postman script to run every x mins to return data and store data in two sep files for ctc and ptc
|
||||||
|
VS Code Thunderclient
|
||||||
|
|
||||||
|
|||||||
15
src/ideas/split.js
Normal file
15
src/ideas/split.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
const filePath = '/Projects/memorypalace/src/ideas/RBCDict.txt';
|
||||||
|
|
||||||
|
// Read the contents of the file
|
||||||
|
const content = fs.readFileSync(filePath, 'utf8');
|
||||||
|
|
||||||
|
// Split the content based on '&'
|
||||||
|
const separatedContent = content.split('&');
|
||||||
|
|
||||||
|
// Join the separated content with new lines
|
||||||
|
const newContent = separatedContent.join('\n');
|
||||||
|
|
||||||
|
// Write the modified content back to the file
|
||||||
|
fs.writeFileSync(filePath, newContent);
|
||||||
106
src/utils/apiResponseChecker.js
Normal file
106
src/utils/apiResponseChecker.js
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
* - 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.
|
||||||
|
*/
|
||||||
|
import axios from 'axios';
|
||||||
|
import { promises as fs } from 'fs';
|
||||||
|
import dotenv from 'dotenv';
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
|
const bearerToken = process.env.BEARER_TOKEN;
|
||||||
|
const securities = [
|
||||||
|
{
|
||||||
|
symbol: 'HOU',
|
||||||
|
xid: '10020415'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
symbol: 'HZU',
|
||||||
|
xid: '19728747'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
const dataCenters = ['ptc', 'ctc'];
|
||||||
|
const users = [
|
||||||
|
{
|
||||||
|
userTier: 'QT1a',
|
||||||
|
modAccessToken: '{"multex":"Y","active":true,"externalId":"testuser","customerTier":5824,"language":"Y","user_tier":"QT1a","token_type":"Bearer","pro":"Y","client_id":"szbv6INGApq0e1Ognvsmzmpq8dGTURTr","realTime":"Y","internalId":"TESTUSER","marketer":"RC","customerType":3870,"levelTwo":"Y","siteId":1614,"exchangeAgreements":"testExchangeAgreements","exp":1689789174}'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
userTier: 'GT2',
|
||||||
|
modAccessToken: '{"multex":"Y","active":true,"externalId":"testuser","customerTier":5999,"language":"Y","user_tier":"GT2","token_type":"Bearer","pro":"Y","client_id":"szbv6INGApq0e1Ognvsmzmpq8dGTURTr","realTime":"Y","internalId":"TESTUSER","marketer":"RC","customerType":3879,"levelTwo":"Y","siteId":1614,"exchangeAgreements":"testExchangeAgreements","exp":1689789174}'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
async function fetchAndWriteApiData({url, headers, dataCenter, userTier, xid, symbol}) {
|
||||||
|
try {
|
||||||
|
await axios.get(url, {}, { headers: { ...headers, Authorization: bearerToken } })
|
||||||
|
.then(response => {
|
||||||
|
const datetime = new Date().toISOString();
|
||||||
|
const responseData = response.data.replace(/<!doctype html><html><body><pre>/, '').split('</pre></body></html>');
|
||||||
|
console.error(`${dataCenter} as ${userTier} @ ${datetime} - ${symbol} lastTrade.date:`, JSON.parse(responseData[0])?.data?.lastTrade?.date);
|
||||||
|
const dataToWrite = `Datetime: ${datetime}\nResponse from ${url}:\n${response.data}\n`;
|
||||||
|
return fs.appendFile(`./output/apiResponses/rbc-quote/${dataCenter}_${userTier}_${xid}.txt`, dataToWrite);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
// console.log(`Appended response from ${url} to ${dataCenter}_${userTier}.txt`);
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(`Failed to fetch from ${url} or write to ${dataCenter}_${userTier}_${xid}.txt:`, error);
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Schedule the calls every 2 minutes for 4 hours
|
||||||
|
const startTime = new Date().toISOString();
|
||||||
|
const stopTime = new Date(Date.now() + 4 * 60 * 60 * 1000).toISOString();
|
||||||
|
const intervalId = setInterval(async () => {
|
||||||
|
try {
|
||||||
|
// Create an array of promises based on securities array for the each data senter and the users
|
||||||
|
const promises = securities.flatMap(security => {
|
||||||
|
return dataCenters.flatMap(dataCenter => {
|
||||||
|
return users.map(user => {
|
||||||
|
return fetchAndWriteApiData({
|
||||||
|
userTier: user.userTier,
|
||||||
|
dataCenter: dataCenter,
|
||||||
|
xid: security.xid,
|
||||||
|
symbol: security.symbol,
|
||||||
|
url: `https://api.${dataCenter}.services.mdgapp.net/rbc-quote/v1/${security.xid}?realTime=0&..showdebugdata..=on`, // showdebuginfo was window based we should use showdebugdata
|
||||||
|
headers: {
|
||||||
|
'x-mod-access-token': user.modAccessToken
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Wait for all promises to resolve
|
||||||
|
await Promise.all(promises);
|
||||||
|
|
||||||
|
console.log(`All calls completed successfully at ${new Date().toISOString()}`);
|
||||||
|
|
||||||
|
const currentTime = new Date().toISOString();
|
||||||
|
if (currentTime >= stopTime) {
|
||||||
|
clearInterval(intervalId);
|
||||||
|
console.log('Interval stopped after 4 hours');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error:', error);
|
||||||
|
}
|
||||||
|
}, 2 * 60 * 1000); // 2 minutes in milliseconds
|
||||||
|
|
||||||
|
console.log('Interval started at:', startTime);
|
||||||
28
src/utils/bookmarkletMaker.js
Normal file
28
src/utils/bookmarkletMaker.js
Normal 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);
|
||||||
12
src/utils/bookmarklets/apiDocs.js
Normal file
12
src/utils/bookmarklets/apiDocs.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
const projectAPI = prompt("Please enter the project API:");
|
||||||
|
if (projectAPI) {
|
||||||
|
window.open(`https://api.qa.services.mdgapp.net/${projectAPI}/v1/docs`, "_blank").focus();
|
||||||
|
}
|
||||||
@@ -2,8 +2,9 @@
|
|||||||
* Opens the DAG Task details page(s) based on user input.
|
* 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.
|
* If user provides a comma-separated list of DAG Task numbers, it opens each task's details page in a new tab.
|
||||||
* If user does not provide any input, it opens the default DAG Tasks page in a new tab.
|
* If user does not provide any input, it opens the default DAG Tasks page in a new tab.
|
||||||
|
*
|
||||||
|
* Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
||||||
*/
|
*/
|
||||||
javascript:(function() {
|
|
||||||
let answers = prompt("Enter the DAG Task #s, separated by commas");
|
let answers = prompt("Enter the DAG Task #s, separated by commas");
|
||||||
const splitAnswers = answers ? answers.split(",") : false;
|
const splitAnswers = answers ? answers.split(",") : false;
|
||||||
let url = "https://dag.tools.mdgapp.net/Tasks/Tasks.asp";
|
let url = "https://dag.tools.mdgapp.net/Tasks/Tasks.asp";
|
||||||
@@ -15,4 +16,3 @@ javascript:(function() {
|
|||||||
} else {
|
} else {
|
||||||
window.open(url, '_blank').focus();
|
window.open(url, '_blank').focus();
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
@@ -9,8 +9,9 @@
|
|||||||
* 4. Copies the decoded string to the clipboard.
|
* 4. Copies the decoded string to the clipboard.
|
||||||
*
|
*
|
||||||
* Note: This function uses the Clipboard API which might not be fully supported in all browsers.
|
* Note: This function uses the Clipboard API which might not be fully supported in all browsers.
|
||||||
|
*
|
||||||
|
* Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
||||||
*/
|
*/
|
||||||
javascript:(function() {
|
|
||||||
let answer = prompt("Enter the HashID");
|
let answer = prompt("Enter the HashID");
|
||||||
let decodedStr = decodeURIComponent(answer);
|
let decodedStr = decodeURIComponent(answer);
|
||||||
alert(decodedStr);
|
alert(decodedStr);
|
||||||
@@ -18,4 +19,3 @@ javascript:(function() {
|
|||||||
navigator.clipboard.writeText(decodedStr)
|
navigator.clipboard.writeText(decodedStr)
|
||||||
.then(() => console.log('Decoded string copied to clipboard'))
|
.then(() => console.log('Decoded string copied to clipboard'))
|
||||||
.catch(err => console.error('Error in copying decoded string to clipboard: ', err));
|
.catch(err => console.error('Error in copying decoded string to clipboard: ', err));
|
||||||
})();
|
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
* 5. Opens the URL in a new browser tab and brings focus to it.
|
* 5. Opens the URL in a new browser tab and brings focus to it.
|
||||||
*
|
*
|
||||||
* Note: This function is wrapped in a self-invoking function `(function() {...})();` which means it will automatically execute as soon as it is defined.
|
* Note: This function is wrapped in a self-invoking function `(function() {...})();` which means it will automatically execute as soon as it is defined.
|
||||||
|
* Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
||||||
*/
|
*/
|
||||||
javascript:(function() {
|
|
||||||
let answers = prompt("Enter the JIRA Tickets, separated by commas");
|
let answers = prompt("Enter the JIRA Tickets, separated by commas");
|
||||||
const splitAnswers = answers ? answers.split(",") : false;
|
const splitAnswers = answers ? answers.split(",") : false;
|
||||||
let url = "https://fincentric.atlassian.net/jira/software/c/projects/DIP/boards/513";
|
let url = "https://fincentric.atlassian.net/jira/software/c/projects/DIP/boards/513";
|
||||||
@@ -23,4 +23,3 @@ javascript:(function() {
|
|||||||
} else {
|
} else {
|
||||||
window.open(url, '_blank').focus();
|
window.open(url, '_blank').focus();
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
* 5. Opens each URL in a new browser tab and brings focus to the last opened tab.
|
* 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.
|
* Note: This function is wrapped in a self-invoking function `(function() {...})();` which means it will automatically execute as soon as it is defined.
|
||||||
|
* Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
||||||
*/
|
*/
|
||||||
javascript:(function() {
|
|
||||||
let answers = prompt("Enter the MOID #s, separated by commas");
|
let answers = prompt("Enter the MOID #s, separated by commas");
|
||||||
const splitAnswers = answers ? answers.split(",") : false;
|
const splitAnswers = answers ? answers.split(",") : false;
|
||||||
let url = "https://jira.ihsmarkit.com/secure/Dashboard.jspa?selectPageId=63222";
|
let url = "https://jira.ihsmarkit.com/secure/Dashboard.jspa?selectPageId=63222";
|
||||||
@@ -23,4 +23,3 @@ javascript:(function() {
|
|||||||
} else {
|
} else {
|
||||||
window.open(url, '_blank').focus();
|
window.open(url, '_blank').focus();
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
19
src/utils/bookmarklets/notMine/jsToMsDate.js
Normal file
19
src/utils/bookmarklets/notMine/jsToMsDate.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
function jsToMsDate(jsdate) {
|
||||||
|
const ms = Date.UTC(
|
||||||
|
jsdate.getFullYear(),
|
||||||
|
jsdate.getMonth(),
|
||||||
|
jsdate.getDate(),
|
||||||
|
jsdate.getHours(),
|
||||||
|
jsdate.getMinutes(),
|
||||||
|
jsdate.getSeconds(),
|
||||||
|
jsdate.getMilliseconds()
|
||||||
|
);
|
||||||
|
const off = jsdate.getTimezoneOffset();
|
||||||
|
return (ms - off * 60 * 1000) / 86400000 + 25569;
|
||||||
|
}
|
||||||
|
|
||||||
|
const date = prompt("Enter date");
|
||||||
|
if (date) {
|
||||||
|
const parsedDate = new Date(date);
|
||||||
|
alert(jsToMsDate(parsedDate));
|
||||||
|
}
|
||||||
11
src/utils/bookmarklets/notMine/msToJsDate.js
Normal file
11
src/utils/bookmarklets/notMine/msToJsDate.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
function msToJsDate(msdate) {
|
||||||
|
const jscriptDateObj = new Date((msdate - 25569) * 86400000);
|
||||||
|
const timezoneOffset = jscriptDateObj.getTimezoneOffset();
|
||||||
|
jscriptDateObj.setTime((msdate - 25569 + timezoneOffset / (60 * 24)) * 86400000);
|
||||||
|
return jscriptDateObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
const date = prompt("Enter MSDate");
|
||||||
|
if (date) {
|
||||||
|
alert(msToJsDate(date));
|
||||||
|
}
|
||||||
40
src/utils/bookmarklets/notMine/showDebugInfo.js
Normal file
40
src/utils/bookmarklets/notMine/showDebugInfo.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
function setFlag(flag, state) {
|
||||||
|
function setFlagSub(url, flag, state) {
|
||||||
|
if (!url.includes(flag)) {
|
||||||
|
url += (url.includes('?') ? '&' : '?');
|
||||||
|
url += `..${flag}..=${state}`;
|
||||||
|
} else {
|
||||||
|
const re = new RegExp(`\\.\\.${flag}\\.\\.=[^&]*`);
|
||||||
|
url = url.replace(re, `..${flag}..=${state}`);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleParameter(ad, type, val) {
|
||||||
|
type = `..${type}..`;
|
||||||
|
const regex = new RegExp(`[?|&]${type}=(on|off)&?`);
|
||||||
|
const match = ad.match(regex);
|
||||||
|
if (match) {
|
||||||
|
ad = ad.replace(`${type}=${match[1]}`, `${type}=${val || (match[1] === 'on' ? 'off' : 'on')}`);
|
||||||
|
} else {
|
||||||
|
ad += (ad.includes('?') ? '&' : '?') + `${type}=${val || 'on'}`;
|
||||||
|
}
|
||||||
|
return ad;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dependencies = {
|
||||||
|
debugchartsrv: ['showdebuginfo'],
|
||||||
|
scriptscachedebug: ['scriptscache']
|
||||||
|
};
|
||||||
|
|
||||||
|
let url = window.location.href.replace(/#.*/, '');
|
||||||
|
if (dependencies[flag] && state !== 'off') {
|
||||||
|
for (const dependency of dependencies[flag]) {
|
||||||
|
url = toggleParameter(url, dependency, 'on');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = toggleParameter(url, flag, state || null);
|
||||||
|
window.location.href = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
setFlag('showdebuginfo');
|
||||||
@@ -3,8 +3,9 @@
|
|||||||
* It retrieves the feature flags from the session storage, creates checkboxes for each flag,
|
* It retrieves the feature flags from the session storage, creates checkboxes for each flag,
|
||||||
* and saves the updated flags back to the session storage when the user clicks the save button.
|
* and saves the updated flags back to the session storage when the user clicks the save button.
|
||||||
* The modal dialog is appended to the document body and can be closed by clicking the save button.
|
* The modal dialog is appended to the document body and can be closed by clicking the save button.
|
||||||
|
*
|
||||||
|
* Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
||||||
*/
|
*/
|
||||||
javascript:(function() {
|
|
||||||
let data = sessionStorage.getItem('rbc_di_session');
|
let data = sessionStorage.getItem('rbc_di_session');
|
||||||
let parsedData = JSON.parse(data);
|
let parsedData = JSON.parse(data);
|
||||||
let features = parsedData.features || {};
|
let features = parsedData.features || {};
|
||||||
@@ -93,4 +94,3 @@ javascript:(function() {
|
|||||||
|
|
||||||
document.body.appendChild(overlay);
|
document.body.appendChild(overlay);
|
||||||
document.body.appendChild(modal);
|
document.body.appendChild(modal);
|
||||||
})();
|
|
||||||
@@ -3,8 +3,9 @@
|
|||||||
* Deletes the 'fnc-rbc-session' property from the session storage if it exists.
|
* Deletes the 'fnc-rbc-session' property from the session storage if it exists.
|
||||||
* If the property exists, it prompts the user for confirmation before deleting.
|
* If the property exists, it prompts the user for confirmation before deleting.
|
||||||
* If the property does not exist, it displays an alert message.
|
* If the property does not exist, it displays an alert message.
|
||||||
|
*
|
||||||
|
* Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
||||||
*/
|
*/
|
||||||
javascript: (function () {
|
|
||||||
const rbcSession = sessionStorage.getItem('fnc-rbc-session');
|
const rbcSession = sessionStorage.getItem('fnc-rbc-session');
|
||||||
if (rbcSession) {
|
if (rbcSession) {
|
||||||
const sessionValue = JSON.parse(rbcSession);
|
const sessionValue = JSON.parse(rbcSession);
|
||||||
@@ -20,4 +21,3 @@ javascript: (function () {
|
|||||||
} else {
|
} else {
|
||||||
alert("'fnc-rbc-session' does not exist in session storage.");
|
alert("'fnc-rbc-session' does not exist in session storage.");
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
|
|||||||
@@ -4,10 +4,11 @@
|
|||||||
* Prompts the user to enter the environment and language in the format 'prod|ste,en|fr'.
|
* Prompts the user to enter the environment and language in the format 'prod|ste,en|fr'.
|
||||||
* If the input is valid, it opens the corresponding URL in a new tab.
|
* If the input is valid, it opens the corresponding URL in a new tab.
|
||||||
* If the input is invalid, it logs an error message to the console.
|
* If the input is invalid, it logs an error message to the console.
|
||||||
|
*
|
||||||
|
* Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
||||||
*/
|
*/
|
||||||
javascript: (function () {
|
|
||||||
const answer = prompt("Please enter the env and language in the format 'prod|ste,en|fr':");
|
const answer = prompt("Please enter the env and language in the format 'prod|ste,en|fr':");
|
||||||
const [env, language] = answer.split(",");
|
const [env, language] = answer.split(/,|\s/);
|
||||||
switch (env) {
|
switch (env) {
|
||||||
case "prod":
|
case "prod":
|
||||||
if (language === "fr") {
|
if (language === "fr") {
|
||||||
@@ -26,4 +27,3 @@ javascript: (function () {
|
|||||||
default:
|
default:
|
||||||
console.log("Invalid input");
|
console.log("Invalid input");
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
@@ -6,8 +6,9 @@ and sets the value of the input field to each security in the array.
|
|||||||
It then triggers events to simulate user input and key presses to add the security to the watchlist.
|
It then triggers events to simulate user input and key presses to add the security to the watchlist.
|
||||||
The process repeats for each security in the array with a delay of 2.5 seconds between each iteration.
|
The process repeats for each security in the array with a delay of 2.5 seconds between each iteration.
|
||||||
The code is executed when the bookmarklet is clicked on the web page.
|
The code is executed when the bookmarklet is clicked on the web page.
|
||||||
|
|
||||||
|
Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
||||||
*/
|
*/
|
||||||
javascript: (function () {
|
|
||||||
const newSecurities = [
|
const newSecurities = [
|
||||||
'AMX',
|
'AMX',
|
||||||
'VNORP',
|
'VNORP',
|
||||||
@@ -45,4 +46,3 @@ javascript: (function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
populateWatchlist();
|
populateWatchlist();
|
||||||
})();
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
javascript:(function() {
|
|
||||||
const urls = {
|
const urls = {
|
||||||
JIRAMetricsDashboard: "https://fincentric.atlassian.net/jira/dashboards/14019/",
|
JIRAMetricsDashboard: "https://fincentric.atlassian.net/jira/dashboards/14019/",
|
||||||
JIRABoard: "https://fincentric.atlassian.net/jira/software/c/projects/DIP/boards/513",
|
JIRABoard: "https://fincentric.atlassian.net/jira/software/c/projects/DIP/boards/513",
|
||||||
@@ -87,5 +86,4 @@ javascript:(function() {
|
|||||||
|
|
||||||
document.body.appendChild(overlay);
|
document.body.appendChild(overlay);
|
||||||
document.body.appendChild(modal);
|
document.body.appendChild(modal);
|
||||||
})();
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
* markdown links for each file. Then, it updates the README file with the generated links
|
* markdown links for each file. Then, it updates the README file with the generated links
|
||||||
* and descriptions.
|
* and descriptions.
|
||||||
*/
|
*/
|
||||||
const fs = require('fs');
|
import fs from 'fs';
|
||||||
const path = require('path');
|
import path from 'path';
|
||||||
|
|
||||||
const resolvedPath = path.resolve();
|
const resolvedPath = path.resolve();
|
||||||
console.log(resolvedPath);
|
console.log(resolvedPath);
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
javascript:(function() {
|
|
||||||
function jsToMsDate(jsdate) {
|
|
||||||
var ms = Date.UTC(
|
|
||||||
jsdate.getUTCFullYear(),
|
|
||||||
jsdate.getUTCMonth(),
|
|
||||||
jsdate.getUTCDate(),
|
|
||||||
jsdate.getUTCHours(),
|
|
||||||
jsdate.getUTCMinutes(),
|
|
||||||
jsdate.getUTCSeconds(),
|
|
||||||
jsdate.getUTCMilliseconds()
|
|
||||||
);
|
|
||||||
var off = jsdate.getTimezoneOffset();
|
|
||||||
return (ms - off * 60 * 1000) / 86400000 + 25569;
|
|
||||||
}
|
|
||||||
|
|
||||||
var date = prompt("Enter date");
|
|
||||||
if (date) {
|
|
||||||
date = new Date(date);
|
|
||||||
alert(jsToMsDate(date)); }
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
javascript:(function() {
|
|
||||||
function msToJsDate(msdate) {
|
|
||||||
var jscriptDateObj = new Date(((msdate - 25569) * 86400000));
|
|
||||||
var timezoneOffset = jscriptDateObj.getTimezoneOffset();
|
|
||||||
jscriptDateObj = new Date(((msdate - 25569 + (timezoneOffset / (60 * 24))) * 86400000));
|
|
||||||
return jscriptDateObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
var date = prompt("Enter MSDate");
|
|
||||||
if (date) {
|
|
||||||
alert(msToJsDate(date));
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
// eslint-disable-next-line no-use-before-define
|
|
||||||
javascript: (function () {
|
|
||||||
function setFlag(_flag, _state) {
|
|
||||||
function setFlagSub(_url, _flag, _state) {
|
|
||||||
if (_url.indexOf(_flag) == -1) {
|
|
||||||
_url += (/\?/.test(_url)) ? '&' : '?';
|
|
||||||
_url += '..' + _flag + '..=' + _state;
|
|
||||||
} else {
|
|
||||||
var re = new RegExp('\\.\\.' + _flag + '\\.\\.=[^&]*');
|
|
||||||
_url = _url.replace(re, '..' + _flag + '..=' + _state);
|
|
||||||
}
|
|
||||||
return _url;
|
|
||||||
};
|
|
||||||
|
|
||||||
function toggleParameter(ad, type, val) {
|
|
||||||
type = '..' + type + '..';
|
|
||||||
if (m = ad.match(new RegExp('[?|&]' + type + '=(on|off)&?'))) {
|
|
||||||
ad = ad.replace(type + '=' + m[1], type + '=' + (val || (m[1] == 'on' ? 'off' : 'on')));
|
|
||||||
} else {
|
|
||||||
ad += (/\?/.test(ad) ? '&' : '?') + type + '=' + (val || 'on');
|
|
||||||
}
|
|
||||||
return ad;
|
|
||||||
};
|
|
||||||
|
|
||||||
var dependencies = {
|
|
||||||
'debugchartsrv': ['showdebuginfo'],
|
|
||||||
'scriptscachedebug': ['scriptscache']
|
|
||||||
};
|
|
||||||
|
|
||||||
var url = new String(window.location.href).replace(/#.*/,);
|
|
||||||
if (dependencies[_flag] && _state != 'off') {
|
|
||||||
for (var i = 0; i < dependencies[_flag].length; i++) {
|
|
||||||
url = toggleParameter(url, dependencies[_flag][i], 'on');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
url = toggleParameter(url, _flag, _state || null);
|
|
||||||
window.location.href = url;
|
|
||||||
};
|
|
||||||
setFlag('showdebuginfo');
|
|
||||||
})();
|
|
||||||
Reference in New Issue
Block a user