Below is a customization/bugmonkey script I was able to create to provide the desired functionality:
name: Customization to link custom fields that use W1234 syntax to their corresponding wiki pages.
description: If the value of a custom field is the capital letter W followed by 2-6 digits, it will turn it into a wiki article link.
author: Scott Willeke
version: 1.0.0.0
js:
$('[id*="bugviewContainerSide"]').find(".content").each(
function(index) {
var wikiField = $(this);
var oldValue = wikiField.html();
var matchWikiLink = /^(W\d{2,6})$/;
if (matchWikiLink.test(oldValue)) {
console.log('matched wikifield:' + wikiField);
var articleUrl = 'default.asp?' + oldValue;
console.log('getting article:' + articleUrl);
$.get(articleUrl, function(data) {
console.log('got article.');
//NOTE: <title> element seems stripped from $(data) object. Is also why jquery.load(...) with a selector won't work
var matchHtmlTitle = /<title>([^<>]+) - FogBugz<\/title>/i;
var articleTitle = matchHtmlTitle.exec(data);
if (articleTitle != null) {
articleTitle = articleTitle[1];
}
console.log('articleTitle:' + articleTitle);
// if for some reason we fail to get a good title, lets keep the Wnnnn link as the title
if (articleTitle == null || articleTitle.length == 0)
articleTitle = oldValue;
wikiField.html('<a href="default.asp?' + oldValue + '">' + articleTitle + '</a>');
});
}
}
);