Last active
May 1, 2024 21:09
-
-
Save ipatalas/031c4836606a7352f9f286203b09adbf to your computer and use it in GitHub Desktop.
Azure DevOps bookmarklets
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
var header = $('.grid-header'); | |
var itemName = ""; | |
var itemId = undefined; | |
var type = undefined; | |
if ($('.work-item-form-id').length == 1) { | |
itemId = $('.work-item-form-id').text(); | |
itemName = $('.work-item-form-title input').val(); | |
type = $('.work-item-type-icon-host').find('i').attr('aria-label'); | |
} else { | |
var idIndex = header.find(".grid-header-column[aria-label='ID']").index(); | |
var titleIndex = header.find(".grid-header-column[aria-label='Title']").index(); | |
itemId = $('.grid-row-current').find('.grid-cell')[idIndex].innerText; | |
var titleColumn = $('.grid-row-current').find('.grid-cell')[titleIndex]; | |
type = $(titleColumn).find('.work-item-type-icon-host i').attr("aria-label"); | |
itemName = titleColumn.innerText; | |
} | |
var prefix = type == "Bug" ? "Bug" : "US"; | |
var message = `message\n\n${prefix}#${itemId} (${itemName})`; | |
navigator.clipboard.writeText(message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a bookmarklet to be used along with Azure DevOps.
It will copy selected item on the list (or when opened) and prepare a commit message in the following form:
To generate a bookmarklet from that you can use this service for instance: https://mrcoles.com/bookmarklet/