From 5448ae5af47f571739cb85f68151f035da835033 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Thu, 14 Sep 2017 15:56:04 -0700 Subject: [PATCH] truncate artist urls on display --- app/assets/javascripts/posts.js | 2 +- app/assets/javascripts/related_tag.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js index 1faa0a171..a3d5c6d6f 100644 --- a/app/assets/javascripts/posts.js +++ b/app/assets/javascripts/posts.js @@ -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", diff --git a/app/assets/javascripts/related_tag.js b/app/assets/javascripts/related_tag.js index 742d6ce2a..20b0ca0eb 100644 --- a/app/assets/javascripts/related_tag.js +++ b/app/assets/javascripts/related_tag.js @@ -259,7 +259,11 @@ if (text.match(/^ http/)) { text = text.substring(1, 1000); var $url = $(""); - $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($("
  • ").html($url));