mirror of
https://github.com/netzbegruenung/green-spider.git
synced 2024-05-02 09:04:51 +02:00
Truncate long URLs in output
This commit is contained in:
parent
a80142ee03
commit
7c286ca3ae
|
@ -8,6 +8,13 @@ import LazyLoad from 'vanilla-lazyload';
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
|
|
||||||
|
var trunc = function(s, length) {
|
||||||
|
if (s.length > length) {
|
||||||
|
s = s.substring(0, length) + '…';
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
};
|
||||||
|
|
||||||
var table = null;
|
var table = null;
|
||||||
|
|
||||||
$.getJSON('data/screenshots.json', function(screenshots){
|
$.getJSON('data/screenshots.json', function(screenshots){
|
||||||
|
@ -39,7 +46,7 @@ $(function(){
|
||||||
row.append('<td>' + (item.meta.city === null ? '' : item.meta.city) + '</td>');
|
row.append('<td>' + (item.meta.city === null ? '' : item.meta.city) + '</td>');
|
||||||
|
|
||||||
// input URL
|
// input URL
|
||||||
row.append('<td><a href="' + item.input_url + '">' + punycode.toUnicode(item.input_url) + '</a></td>');
|
row.append('<td><a href="' + item.input_url + '">' + trunc(punycode.toUnicode(item.input_url), 60) + '</a></td>');
|
||||||
|
|
||||||
// score
|
// score
|
||||||
row.append('<td>' + item.score.toFixed(1) + '</td>');
|
row.append('<td>' + item.score.toFixed(1) + '</td>');
|
||||||
|
|
Loading…
Reference in a new issue