diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js index 1bcca9c83..b0e5029bd 100644 --- a/chrome/chromeFiles/content/scholar/overlay.js +++ b/chrome/chromeFiles/content/scholar/overlay.js @@ -247,7 +247,26 @@ var ScholarPane = new function() } else if(item.isAttachment()) { - document.getElementById('scholar-attachment-label').setAttribute('value',item.getField('title')); + // Wrap title to multiple lines if necessary + var label = document.getElementById('scholar-attachment-label'); + while (label.hasChildNodes()) + { + label.removeChild(label.firstChild); + } + var val = item.getField('title'); + var firstSpace = val.indexOf(" "); + // Crop long uninterrupted text + if ((firstSpace == -1 && val.length > 29 ) || firstSpace > 29) + { + label.setAttribute('crop', 'end'); + label.setAttribute('value', val); + } + // Create a element, essentially + else + { + label.appendChild(document.createTextNode(val)); + } + if (item.ref.getAttachmentLinkMode() == Scholar.Attachments.LINK_MODE_LINKED_URL || item.ref.getAttachmentLinkMode() == Scholar.Attachments.LINK_MODE_IMPORTED_URL) {