Last active
January 18, 2021 02:58
-
-
Save tkdn/cabe343e5fa23904e3d5346b975e5675 to your computer and use it in GitHub Desktop.
UserScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name JIRA 次世代プロジェクトサポート | |
// @namespace https://gist.github.com/tkdn/cabe343e5fa23904e3d5346b975e5675#file-jirasupport-userscript-js | |
// @updateURL https://gist.githubusercontent.com/tkdn/cabe343e5fa23904e3d5346b975e5675/raw/ee98ebba57c2728ce23373de75e64e3aa81219fa/jirasupport.userscript.js | |
// @downloadURL https://gist.githubusercontent.com/tkdn/cabe343e5fa23904e3d5346b975e5675/raw/ee98ebba57c2728ce23373de75e64e3aa81219fa/jirasupport.userscript.js | |
// @version 0.1 | |
// @description JIRA 次世代プロジェクトの UI サポートをします | |
// @author tkdn | |
// @match https://*.atlassian.net/jira/software/projects/* | |
// @grant none | |
// @run-at document-start | |
// @noframes | |
// ==/UserScript== | |
(function() { | |
document.addEventListener("DOMContentLoaded", () => { | |
const $overflowButton = document.querySelector("[aria-controls=uid1]") | |
$overflowButton.addEventListener("click", () => { | |
setTimeout(() => { | |
const $boardMenu = document?.querySelector("[role=menu]") | |
if ($boardMenu?.ariaExpanded === "true") { | |
return | |
} | |
const $swimlaneOpenMenuItem = $boardMenu.querySelector("[role=menuitem]").cloneNode(true) | |
const $swimlaneCloseMenuItem = $boardMenu.querySelector("[role=menuitem]").cloneNode(true) | |
$swimlaneOpenMenuItem.textContent = "レーン全開" | |
$swimlaneCloseMenuItem.textContent = "レーン全閉" | |
$swimlaneOpenMenuItem.onclick = () => onClickSwimlaneOpenHandler() | |
$swimlaneCloseMenuItem.onclick = () => onClickSwimlaneCloseHandler() | |
$boardMenu.appendChild($swimlaneOpenMenuItem) | |
$boardMenu.appendChild($swimlaneCloseMenuItem) | |
}, 50) | |
}) | |
}) | |
// スイムレーン全開閉トグル | |
function onClickSwimlaneHandler(open = true) { | |
const $laneToggles = document | |
.querySelector(`[data-test-id="software-board.board-area"]`) | |
.querySelectorAll("[role=button]") | |
const expectedValForExpand = open ? "false" : "true" | |
$laneToggles.forEach($elem => { | |
if($elem.ariaExpanded === expectedValForExpand) { | |
$elem.click() | |
} | |
}) | |
} | |
function onClickSwimlaneOpenHandler() { | |
onClickSwimlaneHandler() | |
} | |
function onClickSwimlaneCloseHandler() { | |
onClickSwimlaneHandler(false) | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment