diff options
-rw-r--r-- | web/public/js/taginfo.js | 8 | ||||
-rw-r--r-- | web/views/project.erb | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js index c8b7a25..92e7f70 100644 --- a/web/public/js/taginfo.js +++ b/web/public/js/taginfo.js @@ -228,6 +228,14 @@ function link_to_url(url) { ); } +function link_to_url_nofollow(url) { + return link( + encodeURI(url), + html_escape(url.replace(/^http:\/\//, '')), + { target: '_blank', 'class': 'extlink', 'rel': 'nofollow' } + ); +} + function highlight(str, query) { return html_escape(str).replace(new RegExp('(' + html_escape(query) + ')', 'gi'), "<b>$1</b>"); } diff --git a/web/views/project.erb b/web/views/project.erb index c4ff153..b82f925 100644 --- a/web/views/project.erb +++ b/web/views/project.erb @@ -37,16 +37,16 @@ function page_init2() { doc_url = #{ @project['doc_url'].to_json }; if (project_url) { - jQuery('#project_url').html(link_to_url(project_url)); + jQuery('#project_url').html(link_to_url_nofollow(project_url)); } if (icon_url) { jQuery('#icon_url').html(img({ src: icon_url, width: 16, height: 16, alt: ''})); } if (json_url) { - jQuery('#json_url').html(link_to_url(json_url)); + jQuery('#json_url').html(link_to_url_nofollow(json_url)); } if (doc_url) { - jQuery('#doc_url').html(link_to_url(doc_url)); + jQuery('#doc_url').html(link_to_url_nofollow(doc_url)); } init_tabs([project]); |