1$(document).on("ready", function() { 2 3 String.prototype.endsWith = function(suffix) { 4 return this.indexOf(suffix, this.length - suffix.length) !== -1; 5 }; 6 7 var protocol = window.location.protocol; 8 var origin = window.location.origin; 9 var links = $("a").filter(function() { 10 return !$(this).hasClass("rtIn") && !$(this).hasClass("ezcloudsearch-result-link"); 11 }); 12 13 function openInNewWindow(e) { 14 e.preventDefault(); 15 var href = $(this).attr("href") || ""; 16 if (href) window.open(href); 17 } 18 19 links.each(function(i) { 20 var href = $(this).attr("href") || ""; 21 var target = $(this).attr("target"); 22 if (href && href != "#") { 23 var text = $(this).text(); 24 var textI = text.toLowerCase(); 25 var contents = $(this).find("*").contents(); 26 var textNodes = contents.filter(function() { 27 return this.nodeType == 3 28 }); 29 var images = $(this).find("img"); 30 31 if (!textNodes.length) { 32 textNodes = $(this).contents().filter(function() { 33 return this.nodeType == 3 34 }); 35 } 36 37 if (!images.length && !textNodes.length) return; 38 39 if (images.length) { 40 var node = images.eq(0); 41 } else { 42 var node = textNodes[textNodes.length - 1]; 43 var lastTextNodeText = node.textContent; 44 } 45 46 if (href.endsWith(".pdf")) { 47 // node.textContent = lastTextNodeText + " (PDF)"; 48 $(node).after("<span class='screen-reader'> (opens PDF document)</span>"); 49 } else if (href.endsWith(".docx") || href.endsWith(".doc")) { 50 // node.textContent = lastTextNodeText + " (Word)"; 51 $(node).after("<span class='screen-reader'> (opens Word document)</span>"); 52 } else if (href.endsWith(".pptx") || href.endsWith(".ppt")) { 53 // node.textContent = lastTextNodeText + " (PowerPoint)"; 54 $(node).after("<span class='screen-reader'> (opens PowerPoint document)</span>"); 55 } else if (href.endsWith(".xlsx") || href.endsWith(".xls")) { 56 // node.textContent = lastTextNodeText + " (Excel)"; 57 $(node).after("<span class='screen-reader'> (opens Excel document)</span>"); 58 } else if (!(href.startsWith(origin)) && (href.startsWith("http") || href.startsWith("www"))) { 59 // $(node).after("<span class='screen-reader'> (opens external link in new window)</span><em aria-hidden='true' class='screen-reader-icon ion-android-open' style='margin-left:5px;font-size:inherit;line-height:inherit;'></em>"); 60 $(node).after("<span class='screen-reader'> (opens external link in new window)</span>"); 61 $(this).on("click", openInNewWindow); 62 } else if (target == "_blank") { 63 $(node).after("<span class='screen-reader'> (opens in a new window)</span>"); 64 } 65 } 66 }); 67});
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.