Skip to content

Instantly share code, notes, and snippets.

@JJTech0130
Last active July 20, 2022 19:00
Show Gist options
  • Save JJTech0130/09c0e1122f5e06dd341fd3e348085d00 to your computer and use it in GitHub Desktop.
Save JJTech0130/09c0e1122f5e06dd341fd3e348085d00 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name GitHub Project Issue Numbers
// @namespace https://jjtech.dev
// @description Appends issue numbers to issue titles
// @version 0.7
// @require https://code.jquery.com/jquery-3.6.0.slim.min.js
// @match https://github.com/*
// @icon https://github.githubassets.com/pinned-octocat.svg
// @inject-into content
// ==/UserScript==
function updateIssueNumbers() {
$('[class^="interactive-item-title"]').each( function() {
// Check if we have already added an issue number
if ($(this).data('gh-issue-num') == undefined) {
num = $(this).attr('href').split('/').pop()
// Get the parent's parent's previous siblings's first child's first child's text
$($($(this).parent().parent().prev().children().get(0)).children().get(0)).text("#" + num)
//$(this).text("#" + num + ": " + $(this).text())
$(this).data('gh-issue-num', num)
}
})
}
const callback = function(mutationList, observer) {
updateIssueNumbers()
}
// Create an observer, so that we can re-add issue numbers if a new issue is added
new MutationObserver(callback).observe($('body')[0], { childList: true, subtree: true });
@JJTech0130
Copy link
Author

Click the "Raw" button to install it

@JJTech0130
Copy link
Author

If you liked the old version (which added the issue number to the title, rather than replacing the numbers on the left, go to this link https://gist.github.com/JJTech0130/09c0e1122f5e06dd341fd3e348085d00/8f8a5bc2acf6b72ae476ef716f955ebe19776489

@JJTech0130
Copy link
Author

There's a bit of a bug right now: If you re-arrange the columns, it replaces the content of the column before the issue title with the issue number, even if it's not the correct column

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment