1// Create Variables 2var allOSB = []; 3var mxh = ''; 4 5window.onload = function() { 6 // Set Variables 7 allOSB = document.getElementsByClassName("short-description"); 8 9 if (allOSB.length > 0) { 10 mxh = window.getComputedStyle(allOSB[0]).getPropertyValue('max-height'); 11 mxh = parseInt(mxh.replace('px', '')); 12 13 // Add read-more button to each OSB section 14 for (var i = 0; i < allOSB.length; i++) { 15 var el = document.createElement("button"); 16 el.innerHTML = "WiÄcej"; 17 el.setAttribute("type", "button"); 18 el.setAttribute("class", "read-more hid"); 19 20 insertAfter(allOSB[i], el); 21 } 22 } 23 var readMoreButtons = document.getElementsByClassName("read-more"); 24 for (var i = 0; i < readMoreButtons.length; i++) { 25 readMoreButtons[i].addEventListener("click", function() { 26 revealThis(this); 27 }, false); 28 } 29 updateReadMore(); 30} 31window.onresize = function() { 32 updateReadMore(); 33} 34function updateReadMore() { 35 if (allOSB.length > 0) { 36 for (var i = 0; i < allOSB.length; i++) { 37 if (allOSB[i].scrollHeight > mxh) { 38 if (allOSB[i].hasAttribute("style")) { 39 updateHeight(allOSB[i]); 40 } 41 allOSB[i].nextElementSibling.className = "read-more"; 42 } else { 43 allOSB[i].nextElementSibling.className = "read-more hid"; 44 } 45 } 46 } 47} 48function revealThis(current) { 49 var el = current.previousElementSibling; 50 if (el.hasAttribute("style")) { 51 current.innerHTML = "WiÄcej"; 52 el.removeAttribute("style"); 53 } else { 54 updateHeight(el); 55 current.innerHTML = "Mniej"; 56 } 57} 58function updateHeight(el) { 59 el.style.maxHeight = el.scrollHeight + "px"; 60} 61 62function insertAfter(referenceNode, newNode) { 63 referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); 64}
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.