Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kartben/1019674 to your computer and use it in GitHub Desktop.
Save kartben/1019674 to your computer and use it in GitHub Desktop.
git.eclipse.org GreaseMonkey extension
// ==UserScript==
// @name git.eclipse.org bug reference detector
// @version 0.1.0
// @licence EPL v1.0 - http://www.eclipse.org/legal/epl-v10.html
// @namespace http://www.github.com/kartben
// @description Make references to Eclipse bugs clickable in git.eclipse.org Web UI
// @include http://git.eclipse.org/*
// ==/UserScript==
var nodes = document.evaluate(
"//div[@class='commit-subject'] | //div[@class='commit-msg'] | //a",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
if (!nodes) return;
for (var i = 0; i < nodes.snapshotLength; i++) {
node = nodes.snapshotItem(i);
node.innerHTML = node.innerHTML.replace( /.*(bug ([0-9]+))/ig,
" <a style=\"border: dotted 1px #DAA520; background: #FAFAD2; font-size: inherit;\" " +
" href=\"https://bugs.eclipse.org/bugs/show_bug.cgi?id=$2\">$1</a>");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment