Linkify short links too in reports

This commit is contained in:
Dan Stillman 2012-02-28 20:48:39 -05:00
parent e1594ce3d6
commit 635cc8bd15

View File

@ -234,12 +234,13 @@ Zotero.Report = new function() {
table = true; table = true;
var fieldText; var fieldText;
if (i == 'url' && arr[i].match(/^https?:\/\//)) {
fieldText = arr[i];
// Shorten long URLs manually until Firefox wraps at ? // Shorten long URLs manually until Firefox wraps at ?
// (like Safari) or supports the CSS3 word-wrap property // (like Safari) or supports the CSS3 word-wrap property
var firstSpace = arr[i].indexOf(' '); var firstSpace = fieldText.indexOf(' ');
if (arr[i].indexOf('http://') === 0 && if ((firstSpace == -1 && arr[i].length > 29) || firstSpace > 29) {
((firstSpace == -1 && arr[i].length > 29) || firstSpace > 29)) {
var stripped = false; var stripped = false;
// Strip query string for sites we know don't need it // Strip query string for sites we know don't need it
@ -276,12 +277,11 @@ Zotero.Report = new function() {
} }
} }
} }
}
if (i == 'url') {
fieldText = '<a href="' + escapeXML(arr[i]) + '">' fieldText = '<a href="' + escapeXML(arr[i]) + '">'
+ escapeXML(fieldText) + '</a>'; + escapeXML(fieldText) + '</a>';
} }
}
// Remove SQL date from multipart dates // Remove SQL date from multipart dates
// (e.g. '2006-00-00 Summer 2006' becomes 'Summer 2006') // (e.g. '2006-00-00 Summer 2006' becomes 'Summer 2006')
else if (i=='date') { else if (i=='date') {