Files
cf-memorypalace/src/helpers/jira.js
2024-06-01 12:33:51 -04:00

26 lines
1.2 KiB
JavaScript

/**
* 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();
}
})();