Files
cf-memorypalace/src/utils/bookmarklets/moids.js

26 lines
1.3 KiB
JavaScript

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