From 7c286ca3aedde2d1c2708db6df078251e9b67830 Mon Sep 17 00:00:00 2001 From: Marian Steinbach Date: Thu, 19 Apr 2018 11:37:12 +0200 Subject: [PATCH] Truncate long URLs in output --- webapp/src/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/webapp/src/index.js b/webapp/src/index.js index a8f2377..201012b 100644 --- a/webapp/src/index.js +++ b/webapp/src/index.js @@ -8,6 +8,13 @@ import LazyLoad from 'vanilla-lazyload'; $(function(){ + var trunc = function(s, length) { + if (s.length > length) { + s = s.substring(0, length) + '…'; + } + return s; + }; + var table = null; $.getJSON('data/screenshots.json', function(screenshots){ @@ -39,7 +46,7 @@ $(function(){ row.append('' + (item.meta.city === null ? '' : item.meta.city) + ''); // input URL - row.append('' + punycode.toUnicode(item.input_url) + ''); + row.append('' + trunc(punycode.toUnicode(item.input_url), 60) + ''); // score row.append('' + item.score.toFixed(1) + '');