Skip to content

Instantly share code, notes, and snippets.

@FreePhoenix888
Created April 1, 2025 13:58
Show Gist options
  • Save FreePhoenix888/9a9e62aace91950fc3ecba8caf5e4192 to your computer and use it in GitHub Desktop.
Save FreePhoenix888/9a9e62aace91950fc3ecba8caf5e4192 to your computer and use it in GitHub Desktop.
Jira Get In Progress Task List
// ==UserScript==
// @name Task List Window
// @namespace http://tampermonkey.net/
// @version 1.0.0
// @description Show task list in a fixed window when pressing F1
// @author You
// @match https://rmrkz.atlassian.net/jira/your-work
// @grant none
// ==/UserScript==
(function() {
'use strict';
let taskWindow = null;
function getTasks() {
const assignedToMeTabHtmlElem = document.getElementById('your-work-page-tabs-2-tab').children[0].children[0];
const inProgressDivHtmlElem = [...assignedToMeTabHtmlElem.children].find(elem => elem.textContent.includes('In Progress'));
if (!inProgressDivHtmlElem) return [];
const inProgressUlHtmlElem = inProgressDivHtmlElem.nextElementSibling;
if (!inProgressUlHtmlElem) return [];
const tasks = [];
for (let inProgressListElem of inProgressUlHtmlElem.children) {
const aLinkElem = inProgressListElem.children[0];
const taskUrl = aLinkElem.href;
const spanElem = aLinkElem.children[1];
const taskName = spanElem.children[0].textContent;
const taskNumber = spanElem.children[1].children[0].textContent;
tasks.push({ number: taskNumber, name: taskName, url: taskUrl });
}
return tasks;
}
function createTaskWindow(tasks) {
if (taskWindow) {
document.body.removeChild(taskWindow);
taskWindow = null;
return;
}
taskWindow = document.createElement('div');
taskWindow.style.position = 'fixed';
taskWindow.style.top = '20px';
taskWindow.style.right = '20px';
taskWindow.style.width = '300px';
taskWindow.style.height = 'auto';
taskWindow.style.maxHeight = '400px';
taskWindow.style.overflowY = 'auto';
taskWindow.style.background = 'white';
taskWindow.style.border = '1px solid black';
taskWindow.style.padding = '10px';
taskWindow.style.zIndex = '10000';
taskWindow.style.boxShadow = '0 0 10px rgba(0,0,0,0.5)';
const closeButton = document.createElement('button');
closeButton.textContent = 'Close';
closeButton.style.display = 'block';
closeButton.style.marginBottom = '10px';
closeButton.onclick = () => {
document.body.removeChild(taskWindow);
taskWindow = null;
};
taskWindow.appendChild(closeButton);
const taskText = tasks.map(task => `<a href="${task.url}" target="_blank" style="color: blue; text-decoration: none;">${task.number} - ${task.name}</a>`).join('; ');
const taskContainer = document.createElement('div');
taskContainer.innerHTML = taskText;
taskWindow.appendChild(taskContainer);
document.body.appendChild(taskWindow);
}
document.addEventListener('keydown', function(event) {
if (event.key === 'F1') {
event.preventDefault(); // Prevent browser help menu
const tasks = getTasks();
createTaskWindow(tasks);
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment