From a1cd54336a070b46aa5061ae42a7c49264786b7b Mon Sep 17 00:00:00 2001 From: Frederic Barthelemy Date: Wed, 3 Mar 2010 18:14:46 -0800 Subject: [PATCH] Added support for urls in commit log messages. This means jira:// urls will function if you have the url handler installed. --- html/views/history/history.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/html/views/history/history.js b/html/views/history/history.js index 6cd7540..0ca0767 100644 --- a/html/views/history/history.js +++ b/html/views/history/history.js @@ -162,7 +162,13 @@ var showRefs = function() { } else refs.parentNode.style.display = "none"; } - +var generateTextWithURLsFromText = function(text) +{ + // (^|[ \t\r\n])((ftp|http|https|gopher|mailto|news|nntp|telnet|wais|file|prospero|aim|webcal|jira|ngmoco):(([A-Za-z0-9$_.+!*(),;/?:@&~=-])|%[A-Fa-f0-9]{2}){2,}(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*(),;/?:@&~=%-]*))?([A-Za-z0-9$_+!*();/?:~-])) + var reg = new RegExp("(^|[ \\t\\r\\n])((ftp|http|https|gopher|mailto|news|nntp|telnet|wais|file|prospero|aim|webcal|jira|ngmoco):(([A-Za-z0-9$_.+!*(),;/?:@&~=-])|%[A-Fa-f0-9]{2}){2,}(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*(),;/?:@&~=%-]*))?([A-Za-z0-9$_+!*();/?:~-]))"); + var urled = text.replace(reg,"$2"); + return urled; +}; var loadCommit = function(commitObject, currentRef) { // These are only the things we can do instantly. // Other information will be loaded later by loadCommitDetails, @@ -314,7 +320,7 @@ var loadCommitDetails = function(data) } $("date").innerHTML = commit.author_date; - $("message").innerHTML = commit.message.replace(/\n/g,"
"); + $("message").innerHTML = generateTextWithURLsFromText(commit.message.replace(/\n/g,"
")); if (commit.diff.length < 200000) showDiff();