Tag Archives: userscripts

Make Github issue numbers appear in browser tabs

#70. Yippee!

#70. Yippee!

I use Github Issues as a bugtracker for a number of my projects. My workflow usually includes having the ticket open in one browser tab, and a local WordPress installation open in another browser tab (to test the bugfixes themselves). When I write commit messages, I want to reference the issue number, but by default, it’s buried deep in the <title> element, and thus not visible on a smallish browser tab.

So I wrote a short userscript that reproduces the issue number at the beginning of the <title>, so I can see it at a glance. It’s structured as a userscript for Greasemonkey/Firefox, though I imagine you could easily repackage it for Chrome or whatever.

[code language=javascript]
// ==UserScript==
// @name github issue number in tab
// @namespace https://boone.gorg.es
// @description github issue number in tab
// @include https://github.com/*/*/issues/*
// @version 1
// @grant none
// ==/UserScript==

var t, ttext, issueno;

t = document.getElementsByTagName( ‘title’ );
ttext = t[0].innerHTML;
ino = ttext.match(/Issue #([0-9]+)/);
console.log(“#” + ino[1] + ” ” + ttext);
t[0].innerHTML = “#” + ino[1] + ” ” + ttext;
[/code]