Skip to content

Instantly share code, notes, and snippets.

@niaher
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niaher/7e1ea413646d4f5a438a to your computer and use it in GitHub Desktop.
Save niaher/7e1ea413646d4f5a438a to your computer and use it in GitHub Desktop.
TFS website: add support for links to backlog/buglist
<style>
.link {padding:2px 3px; border-radius:3px; display:inline-block; margin:0 5px; border:1px solid}
.link.story {background:#A7EEFF; border-color:#8EC7D8}
.link.issue {background:#4CFF85; border-color:#6DC295}
</style>
<script>
(function() {
$(document).ajaxComplete(initTags);
function initTags() {
var backlogLinkRegex = new RegExp(/(#([1-9][0-9]*))/gim);
var bugLinkRegex = new RegExp(/(!([1-9][0-9]*))/gim);
$(".result-details,.vc-page-title").each(function() {
var el = $(this);
var taggedDescription = el.html()
.replace(backlogLinkRegex, "<a class='link story' href='/backlog/items/$2'>$2</a>")
.replace(bugLinkRegex, "<a class='link issue' href='/buglist/items/$2'>$2</a>");
el.html(taggedDescription);
});
}
}());
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment