From c0beca8e90c645fee7add8ddb81f03995c5d1bec Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 25 Jul 2016 14:25:09 -0700 Subject: [PATCH] fixes #2631 artist urls in related tags should have option to open in new window --- app/assets/javascripts/related_tag.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/related_tag.js b/app/assets/javascripts/related_tag.js index e2e575ae9..12ed65837 100644 --- a/app/assets/javascripts/related_tag.js +++ b/app/assets/javascripts/related_tag.js @@ -222,7 +222,21 @@ $("
  • ").append($link) ); } else { - $ul.append($("
  • ").text(tag[0])); + var text = tag[0]; + if (text.match(/^ http/)) { + text = text.substring(1, 1000); + var $url = $(""); + $url.text("open"); + $url.attr("href", text); + $url.attr("target", "_blank"); + var $li = $("
  • "); + $li.append(text + " ["); + $li.append($url); + $li.append("]"); + $ul.append($li); + } else { + $ul.append($("
  • ").text(text)); + } } });