Browse Source

Truncate long URLs

Jean-Baptiste (Rorist) Aubort 6 years ago
parent
commit
b60f883d4a
1 changed files with 9 additions and 1 deletions
  1. 9 1
      site/script/main.js

+ 9 - 1
site/script/main.js

@@ -196,7 +196,15 @@ function getObject(obj) {
             if (value.startsWith("http")) {
                 var a = $('<a>')
                 a.attr({'href': value})
-                a.text(value)
+                value = value.replace('http://www.', '');
+                value = value.replace('https://www.', '');
+                value = value.replace('http://', '');
+                value = value.replace('https://', '');
+                if(value.length > 28){
+                    a.text(value.substring(0, 18) + '..' + value.substr(-8, 8));
+                } else {
+                    a.text(value)
+                }
                 span.append(a)
             } else {
                 span.text(value.capitalize());