Created
January 17, 2013 21:52
-
-
Save lyricallogical/4560143 to your computer and use it in GitHub Desktop.
github の scala リポジトリのコミットタイトルやメッセージ内の JIRA の Issue 番号にリンクをつけるだけの chrome 向け user script
firefox でも動くかもしれない
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 add link to jira | |
// @description replace SI-NNNN with link to correspond issue page. | |
// @version 0.1 | |
// @match https://github.com/scala/scala/commit/* | |
// @match https://github.com/scala/scala/commits/* | |
// ==/UserScript== | |
(function() { | |
var each = Array.prototype.forEach | |
var url = 'https://issues.scala-lang.org/browse/'; | |
var doms = document.querySelectorAll(".commit-title, .commit-desc > pre") | |
each.call(doms, function(dom) { | |
var html = ""; | |
each.call(dom.childNodes, function(child) { | |
if (child.nodeType != 3) { | |
html += new XMLSerializer().serializeToString(child); | |
} else { | |
html += child.nodeValue.replace(/SI\-\d+/g, '<a href="' + url + '$&" target="_blank">$&</a>'); | |
} | |
}); | |
dom.innerHTML = html; | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment