1/* 2 Depends on DialogBoxes 3*/ 4var DocumentViewer = { 5 6 show : function(documentSource) { 7 // Close the current dialog 8 if(DialogBoxes.IsDialogOpen) { 9 DialogBoxes.hide(); 10 } 11 12 var documentContainer = document.getElementById("Document_container"); 13 if(!documentContainer) { 14 documentContainer = document.createElement("div"); 15 documentContainer.setAttribute("id", "Document_container"); 16 documentContainer.setAttribute("style", "display: none;") 17 document.body.appendChild(documentContainer); 18 } 19 20 var documentDiv = document.getElementById("Document_div"); 21 if(!documentDiv) { 22 documentDiv = document.createElement("div"); 23 documentDiv.setAttribute("id", "Document_div"); 24 documentContainer.appendChild(documentDiv); 25 } 26 27 var close = document.createElement("img"); 28 close.setAttribute("style", "padding: 0 3px 5px 0; float: right; cursor: pointer;"); 29 close.setAttribute("alt", "Close"); 30 close.setAttribute("title", "Close") 31 close.src = "/apps/pics/close.gif"; 32 close.onclick = DialogBoxes.hide; 33 34 var w = Math.max(800, window.innerWidth - 400); 35 var h = Math.max(600, window.innerHeight - 100); 36 37 var documentDocument = document.createElement("iframe"); 38 documentDocument.setAttribute("style", "border: 1px solid #000000; background: #FFFFFF; border-radius: 6px; width: " + (w-4) + "px; height: " + (h-100) + "px;"); 39 documentDocument.src = "http://docs.google.com/viewer?url=" + documentSource + "&embedded=true"; 40 41 var linkToOriginal = document.createElement("a"); 42 linkToOriginal.setAttribute("style", "color: #FFFFFF; display: block; text-align: center; margin-top: 8px; font-size: 14px; padding: 0 3px 5px 0; float: none; cursor: pointer; text-shadow: 0 0 2px #000000;"); 43 linkToOriginal.setAttribute("alt", documentSource); 44 linkToOriginal.setAttribute("title", documentSource) 45 linkToOriginal.href = documentSource; 46 linkToOriginal.innerHTML = "Download Original →"; 47 48 while(documentDiv.hasChildNodes()) {
49 documentDiv.removeChild(documentDiv.lastChild); 50 } 51 documentDiv.appendChild(close); 52 documentDiv.appendChild(documentDocument); 53 documentDiv.appendChild(linkToOriginal); 54 55 DialogBoxes.show({ srcDiv: "Document_div", w: w, h: h, onClick: DialogBoxes.hide }); 56 }, 57 58 isLoaded : function() { 59 return true; 60 } 61 62};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.