better organization, add in eslint as well as package and other helper bookmarklets found on confluence to have here if needed as a reference
This commit is contained in:
18
src/utils/bookmarklets/dag.js
Normal file
18
src/utils/bookmarklets/dag.js
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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 does not provide any input, it opens the default DAG Tasks page in a new tab.
|
||||
*/
|
||||
javascript:(function() {
|
||||
let answers = prompt("Enter the DAG Task #s, separated by commas");
|
||||
const splitAnswers = answers ? answers.split(",") : false;
|
||||
let url = "https://dag.tools.mdgapp.net/Tasks/Tasks.asp";
|
||||
if (splitAnswers) {
|
||||
splitAnswers.forEach(answer => {
|
||||
let moidUrl = "https://dag.tools.mdgapp.net/Tasks/TaskDetail.asp?Cmd=Details&TaskID=" + answer.trim();
|
||||
window.open(moidUrl, '_blank');
|
||||
});
|
||||
} else {
|
||||
window.open(url, '_blank').focus();
|
||||
}
|
||||
})();
|
||||
21
src/utils/bookmarklets/hashid.js
Normal file
21
src/utils/bookmarklets/hashid.js
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* Note: This function uses the Clipboard API which might not be fully supported in all browsers.
|
||||
*/
|
||||
javascript:(function() {
|
||||
let answer = prompt("Enter the HashID");
|
||||
let decodedStr = decodeURIComponent(answer);
|
||||
alert(decodedStr);
|
||||
|
||||
navigator.clipboard.writeText(decodedStr)
|
||||
.then(() => console.log('Decoded string copied to clipboard'))
|
||||
.catch(err => console.error('Error in copying decoded string to clipboard: ', err));
|
||||
})();
|
||||
26
src/utils/bookmarklets/jira.js
Normal file
26
src/utils/bookmarklets/jira.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* This JavaScript function is a bookmarklet that prompts the user for a JIRA ticket number
|
||||
* and then opens a new browser tab with the corresponding JIRA page for that ticket.
|
||||
*
|
||||
* The function works as follows:
|
||||
* 1. Prompts the user to enter a JIRA ticket number. The entered value is stored in the `answer` variable.
|
||||
* 2. Sets a default URL to the JIRA dashboard.
|
||||
* 3. Checks if the user entered a value in the prompt.
|
||||
* 4. If the user entered a value, changes the URL to point to the specific JIRA page for the entered ticket number.
|
||||
* 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.
|
||||
*/
|
||||
javascript:(function() {
|
||||
let answers = prompt("Enter the JIRA Tickets, separated by commas");
|
||||
const splitAnswers = answers ? answers.split(",") : false;
|
||||
let url = "https://fincentric.atlassian.net/jira/software/c/projects/DIP/boards/513";
|
||||
if (splitAnswers) {
|
||||
splitAnswers.forEach(answer => {
|
||||
let moidUrl = "https://fincentric.atlassian.net/browse/" + answer.trim();
|
||||
window.open(moidUrl, '_blank');
|
||||
});
|
||||
} else {
|
||||
window.open(url, '_blank').focus();
|
||||
}
|
||||
})();
|
||||
26
src/utils/bookmarklets/moids.js
Normal file
26
src/utils/bookmarklets/moids.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
javascript:(function() {
|
||||
let answers = prompt("Enter the MOID #s, separated by commas");
|
||||
const splitAnswers = answers ? answers.split(",") : false;
|
||||
let url = "https://jira.ihsmarkit.com/secure/Dashboard.jspa?selectPageId=63222";
|
||||
if (splitAnswers) {
|
||||
splitAnswers.forEach(answer => {
|
||||
let moidUrl = "https://jira.ihsmarkit.com/browse/MOID-" + answer.trim();
|
||||
window.open(moidUrl, '_blank');
|
||||
});
|
||||
} else {
|
||||
window.open(url, '_blank').focus();
|
||||
}
|
||||
})();
|
||||
96
src/utils/bookmarklets/rbc-di-featureflags.js
Normal file
96
src/utils/bookmarklets/rbc-di-featureflags.js
Normal file
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* This function creates a modal dialog that allows the user to toggle feature flags.
|
||||
* 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.
|
||||
* The modal dialog is appended to the document body and can be closed by clicking the save button.
|
||||
*/
|
||||
javascript:(function() {
|
||||
let data = sessionStorage.getItem('rbc_di_session');
|
||||
let parsedData = JSON.parse(data);
|
||||
let features = parsedData.features || {};
|
||||
|
||||
let modal = document.createElement('div');
|
||||
modal.style.position = 'fixed';
|
||||
modal.style.top = '50%';
|
||||
modal.style.left = '50%';
|
||||
modal.style.transform = 'translate(-50%, -50%)';
|
||||
modal.style.backgroundColor = 'white';
|
||||
modal.style.padding = '20px';
|
||||
modal.style.border = '1px solid black';
|
||||
modal.style.zIndex = '999';
|
||||
modal.style.display = 'flex';
|
||||
modal.style.flexWrap = 'wrap';
|
||||
|
||||
for (let key in features) {
|
||||
if (features.hasOwnProperty(key) && typeof features[key] === 'boolean') {
|
||||
let checkboxContainer = document.createElement('div');
|
||||
checkboxContainer.style.width = '50%';
|
||||
|
||||
let checkbox = document.createElement('input');
|
||||
checkbox.type = 'checkbox';
|
||||
checkbox.id = key;
|
||||
checkbox.checked = features[key];
|
||||
|
||||
let label = document.createElement('label');
|
||||
label.htmlFor = key;
|
||||
label.innerText = key;
|
||||
|
||||
checkboxContainer.appendChild(checkbox);
|
||||
checkboxContainer.appendChild(label);
|
||||
modal.appendChild(checkboxContainer);
|
||||
}
|
||||
}
|
||||
|
||||
let saveButton = document.createElement('button');
|
||||
saveButton.innerText = 'Save';
|
||||
saveButton.addEventListener('click', function() {
|
||||
const checkboxes = modal.querySelectorAll('input[type="checkbox"]');
|
||||
checkboxes.forEach(function(checkbox) {
|
||||
features[checkbox.id] = checkbox.checked;
|
||||
});
|
||||
parsedData.features = features;
|
||||
sessionStorage.setItem('rbc_di_session', JSON.stringify(parsedData));
|
||||
location.reload();
|
||||
});
|
||||
|
||||
let closeButton = document.createElement('button');
|
||||
closeButton.innerText = 'X';
|
||||
closeButton.style.position = 'absolute';
|
||||
closeButton.style.right = '10px';
|
||||
closeButton.style.top = '10px';
|
||||
closeButton.addEventListener('click', function() {
|
||||
document.body.removeChild(modal);
|
||||
document.body.removeChild(overlay);
|
||||
});
|
||||
|
||||
let cancelButton = document.createElement('button');
|
||||
cancelButton.innerText = 'Cancel';
|
||||
cancelButton.addEventListener('click', function() {
|
||||
document.body.removeChild(modal);
|
||||
document.body.removeChild(overlay);
|
||||
});
|
||||
|
||||
let buttonContainer = document.createElement('div');
|
||||
buttonContainer.style.width = '100%';
|
||||
buttonContainer.style.display = 'flex';
|
||||
buttonContainer.style.justifyContent = 'center';
|
||||
buttonContainer.style.marginTop = '20px';
|
||||
|
||||
buttonContainer.appendChild(saveButton);
|
||||
buttonContainer.appendChild(cancelButton);
|
||||
|
||||
modal.appendChild(closeButton);
|
||||
modal.appendChild(buttonContainer);
|
||||
|
||||
let overlay = document.createElement('div');
|
||||
overlay.style.position = 'fixed';
|
||||
overlay.style.top = '0';
|
||||
overlay.style.left = '0';
|
||||
overlay.style.width = '100%';
|
||||
overlay.style.height = '100%';
|
||||
overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
|
||||
overlay.style.zIndex = '998';
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
document.body.appendChild(modal);
|
||||
})();
|
||||
91
src/utils/bookmarklets/workspace.js
Normal file
91
src/utils/bookmarklets/workspace.js
Normal file
@@ -0,0 +1,91 @@
|
||||
javascript:(function() {
|
||||
const urls = {
|
||||
JIRAMetricsDashboard: "https://fincentric.atlassian.net/jira/dashboards/14019/",
|
||||
JIRABoard: "https://fincentric.atlassian.net/jira/software/c/projects/DIP/boards/513",
|
||||
MOIDDashboard: "https://jira.ihsmarkit.com/secure/Dashboard.jspa?selectPageId=63222",
|
||||
DIUserLoginsConfluencePage: "https://confluence.ihsmarkit.com/pages/viewpage.action?spaceKey=MOD&title=DI+User+Logins#direct-investing--686175318",
|
||||
WEUserAdmin: "https://intranet.tools.mdgapp.net/P/PTC1/UserAdmin"
|
||||
};
|
||||
|
||||
let modal = document.createElement('div');
|
||||
modal.style.position = 'fixed';
|
||||
modal.style.top = '50%';
|
||||
modal.style.left = '50%';
|
||||
modal.style.transform = 'translate(-50%, -50%)';
|
||||
modal.style.backgroundColor = 'white';
|
||||
modal.style.padding = '20px';
|
||||
modal.style.border = '1px solid black';
|
||||
modal.style.zIndex = '999';
|
||||
modal.style.display = 'flex';
|
||||
modal.style.flexWrap = 'wrap';
|
||||
|
||||
Object.keys(urls).forEach(key => {
|
||||
let checkboxContainer = document.createElement('div');
|
||||
checkboxContainer.style.width = '50%';
|
||||
|
||||
const checkbox = document.createElement('input');
|
||||
checkbox.type = 'checkbox';
|
||||
checkbox.id = key;
|
||||
checkbox.name = key;
|
||||
checkbox.value = urls[key];
|
||||
|
||||
const label = document.createElement('label');
|
||||
label.htmlFor = key;
|
||||
label.innerText = key.split(/(?=[A-Z][a-z])/).join(' ');
|
||||
|
||||
checkboxContainer.appendChild(checkbox);
|
||||
checkboxContainer.appendChild(label);
|
||||
modal.appendChild(checkboxContainer);
|
||||
});
|
||||
|
||||
const startButton = document.createElement('button');
|
||||
startButton.innerText = 'Start';
|
||||
startButton.addEventListener('click', () => {
|
||||
const selectedUrls = Array.from(modal.querySelectorAll('input[type="checkbox"]:checked')).map(checkbox => checkbox.value);
|
||||
selectedUrls.forEach(url => window.open(url, '_blank'));
|
||||
document.body.removeChild(modal);
|
||||
document.body.removeChild(overlay);
|
||||
});
|
||||
|
||||
let closeButton = document.createElement('button');
|
||||
closeButton.innerText = 'X';
|
||||
closeButton.style.position = 'absolute';
|
||||
closeButton.style.right = '10px';
|
||||
closeButton.style.top = '10px';
|
||||
closeButton.addEventListener('click', function() {
|
||||
document.body.removeChild(modal);
|
||||
document.body.removeChild(overlay);
|
||||
});
|
||||
|
||||
let cancelButton = document.createElement('button');
|
||||
cancelButton.innerText = 'Cancel';
|
||||
cancelButton.addEventListener('click', function() {
|
||||
document.body.removeChild(modal);
|
||||
document.body.removeChild(overlay);
|
||||
});
|
||||
|
||||
let buttonContainer = document.createElement('div');
|
||||
buttonContainer.style.width = '100%';
|
||||
buttonContainer.style.display = 'flex';
|
||||
buttonContainer.style.justifyContent = 'center';
|
||||
buttonContainer.style.marginTop = '20px';
|
||||
|
||||
buttonContainer.appendChild(startButton);
|
||||
buttonContainer.appendChild(cancelButton);
|
||||
|
||||
modal.appendChild(closeButton);
|
||||
modal.appendChild(buttonContainer);
|
||||
|
||||
let overlay = document.createElement('div');
|
||||
overlay.style.position = 'fixed';
|
||||
overlay.style.top = '0';
|
||||
overlay.style.left = '0';
|
||||
overlay.style.width = '100%';
|
||||
overlay.style.height = '100%';
|
||||
overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
|
||||
overlay.style.zIndex = '998';
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
document.body.appendChild(modal);
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user