Skip to content

Commit

Permalink
truncate artist urls on display
Browse files Browse the repository at this point in the history
  • Loading branch information
r888888888 committed Sep 14, 2017
1 parent b361809 commit 5448ae5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/posts.js
Expand Up @@ -59,7 +59,7 @@
$("#form").appendTo(dialog);
dialog.dialog({
title: "Edit tags",
width: $(window).width() / 3,
width: $(window).width() * 0.6,
position: {
my: "right",
at: "right-20",
Expand Down
6 changes: 5 additions & 1 deletion app/assets/javascripts/related_tag.js
Expand Up @@ -259,7 +259,11 @@
if (text.match(/^ http/)) {
text = text.substring(1, 1000);
var $url = $("<a/>");
$url.text(text);
var desc = text.replace(/^https?:\/\//, "");
if (desc.length > 30) {
desc = desc.substring(0, 30) + "...";
}
$url.text(desc);
$url.attr("href", text);
$url.attr("target", "_blank");
$ul.append($("<li/>").html($url));
Expand Down

0 comments on commit 5448ae5

Please sign in to comment.