www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 4a4ff9c275c8d0e66f37dd21e84f6d60f642e768
parent b3f9f5102bf50b0d6055f5de3b1f8a4867fb691c
Author: Dan Stillman <dstillman@zotero.org>
Date:   Tue, 28 Feb 2012 20:56:34 -0500

Merge branch '3.0'

Diffstat:
Mchrome/content/zotero/xpcom/report.js | 76++++++++++++++++++++++++++++++++++++++--------------------------------------
1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/chrome/content/zotero/xpcom/report.js b/chrome/content/zotero/xpcom/report.js @@ -234,53 +234,53 @@ Zotero.Report = new function() { table = true; var fieldText; - // Shorten long URLs manually until Firefox wraps at ? - // (like Safari) or supports the CSS3 word-wrap property - var firstSpace = arr[i].indexOf(' '); - if (arr[i].indexOf('http://') === 0 && - ((firstSpace == -1 && arr[i].length > 29) || firstSpace > 29)) { + if (i == 'url' && arr[i].match(/^https?:\/\//)) { + fieldText = arr[i]; - var stripped = false; - - // Strip query string for sites we know don't need it - for each(var re in _noQueryStringSites) { - if (re.test(arr[i])){ - var pos = arr[i].indexOf('?'); - if (pos != -1) { - fieldText = arr[i].substr(0, pos); - stripped = true; + // Shorten long URLs manually until Firefox wraps at ? + // (like Safari) or supports the CSS3 word-wrap property + var firstSpace = fieldText.indexOf(' '); + if ((firstSpace == -1 && arr[i].length > 29) || firstSpace > 29) { + var stripped = false; + + // Strip query string for sites we know don't need it + for each(var re in _noQueryStringSites) { + if (re.test(arr[i])){ + var pos = arr[i].indexOf('?'); + if (pos != -1) { + fieldText = arr[i].substr(0, pos); + stripped = true; + } + break; } - break; } - } - - if (!stripped) { - // Add a line-break after the ? of long URLs - fieldText = arr[i].replace('?', "?<ZOTEROBREAK/>"); - // Strip query string variables from the end while the - // query string is longer than the main part - var pos = fieldText.indexOf('?'); - if (pos != -1) { - while (pos < (fieldText.length / 2)) { - var lastAmp = fieldText.lastIndexOf('&'); - if (lastAmp == -1) { - break; + if (!stripped) { + // Add a line-break after the ? of long URLs + fieldText = arr[i].replace('?', "?<ZOTEROBREAK/>"); + + // Strip query string variables from the end while the + // query string is longer than the main part + var pos = fieldText.indexOf('?'); + if (pos != -1) { + while (pos < (fieldText.length / 2)) { + var lastAmp = fieldText.lastIndexOf('&'); + if (lastAmp == -1) { + break; + } + fieldText = fieldText.substr(0, lastAmp); + var shortened = true; + } + // Append '&...' to the end + if (shortened) { + fieldText += "&<ZOTEROHELLIP/>"; } - fieldText = fieldText.substr(0, lastAmp); - var shortened = true; - } - // Append '&...' to the end - if (shortened) { - fieldText += "&<ZOTEROHELLIP/>"; } } } - if (i == 'url') { - fieldText = '<a href="' + escapeXML(arr[i]) + '">' - + escapeXML(fieldText) + '</a>'; - } + fieldText = '<a href="' + escapeXML(arr[i]) + '">' + + escapeXML(fieldText) + '</a>'; } // Remove SQL date from multipart dates // (e.g. '2006-00-00 Summer 2006' becomes 'Summer 2006')