1(()=>{ 2 function getNumberOrDef(val, def) { 3 return typeof val === 'number' && !isNaN(val) ? val : def; 4 } 5 6 function isVisible(element) { 7 return element && element.style.visibility !== 'hidden'; 8 } 9 10 function inside(minX, minY, maxX, maxY, x1, y1) { 11 return minX <= x1 && x1 <= maxX && minY <= y1 && y1 <= maxY; 12 } 13 14 function intersectionPoint (x1, y1, x2, y2, minX, minY, maxX, maxY) { 15 var min = Math.min, max = Math.max; 16 var good = inside.bind(null, min(x1, x2), min(y1, y2), max(x1, x2), max(y1, y2)); 17 18 if ((x1 <= minX && x2 <= minX) || (y1 <= minY && y2 <= minY) || (x1 >= maxX && x2 >= maxX) || (y1 >= maxY && y2 >= maxY) || (inside(minX, minY, maxX, maxY, x1, y1) && inside(minX, minY, maxX, maxY, x2, y2))) 19 return null; 20 21 var m = (y2 - y1) / (x2 - x1); 22 var y = m * (minX - x1) + y1; 23 if (minY < y && y < maxY && good(minX, y)) return {x: minX, y:y}; 24 25 y = m * (maxX - x1) + y1; 26 if (minY < y && y < maxY && good(maxX, y)) return {x: maxX, y:y}; 27 28 var x = (minY - y1) / m + x1; 29 if (minX < x && x < maxX && good(x, minY)) return {x: x, y:minY}; 30 31 x = (maxY - y1) / m + x1; 32 if (minX < x && x < maxX && good(x, maxY)) return {x: x, y:maxY}; 33 34 return null; 35 } 36 37 38 function adjustLine(from, to, line, trafo){ 39 var color = trafo && trafo.color || 'black'; 40 var W = trafo && trafo.width || 2; 41 42 var fromB = parseFloat(from.style.top) ? null : from.getBoundingClientRect(); 43 var toB = parseFloat(to.style.top) ? null : to.getBoundingClientRect(); 44 var fromBStartY = (fromB ? window.scrollY + fromB.top : parseFloat(from.style.top)); 45 var fromBStartX = (fromB ? window.scrollX + fromB.left : parseFloat(from.style.left)); 46 var toBStartY = (toB ? window.scrollY + toB.top : parseFloat(to.style.top)); 47 var toBStartX = (toB ? window.scrollX + toB.left : parseFloat(to.style.left)); 48 var fromBWidth = (fromB ? fromB.width : parseFloat(from.style.width) || from.offsetWidth); 49 var fromBHeight = (fromB ? fromB.height : parseFloat(from.style.height) || from.offsetHeight); 50 var toBWidth = (toB ? toB.width : parseFloat(to.style.width) || to.offsetWidth); 51 var toBHeight = (toB ? toB.height : parseFloat(to.style.height) || to.offsetHeight); 52 53 var fT = fromBStartY + fromBHeight * getNumberOrDef(trafo && trafo.fromY, getNumberOrDef(trafo, 0.5)); 54 var tT = toBStartY + toBHeight * getNumberOrDef(trafo && trafo.toY, getNumberOrDef(trafo, 0.5)); 55 var fL = fromBStartX + fromBWidth * getNumberOrDef(trafo && trafo.fromX, getNumberOrDef(trafo, 0.5)); 56 var tL = toBStartX + toBWidth * getNumberOrDef(trafo && trafo.toX, getNumberOrDef(trafo, 0.5)); 57 58 var CA = Math.abs(tT - fT); 59 var CO = Math.abs(tL - fL); 60 var H = Math.sqrt(CA*CA + CO*CO); 61 var ANG = 180 / Math.PI * Math.acos( CO/H ); 62 63 if((fT >= tT || fL >= tL) && (tT >= fT || tL >= fL)) { 64 ANG *= -1; 65 } 66 67 if (trafo && trafo.onlyVisible) { 68 var arrangeFrom = intersectionPoint(fL, fT, tL, tT, fromBStartX, fromBStartY, fromBStartX + fromBWidth, fromBStartY + fromBHeight); 69 var arrangeTo = intersectionPoint(fL, fT, tL, tT, toBStartX, toBStartY, toBStartX + toBWidth, toBStartY + toBHeight); 70 71 if (arrangeFrom) { 72 fL = arrangeFrom.x; 73 fT = arrangeFrom.y; 74 } 75 if (arrangeTo) { 76 tL = arrangeTo.x; 77 tT = arrangeTo.y; 78 } 79 CA = Math.abs(tT - fT); 80 CO = Math.abs(tL - fL); 81 H = Math.sqrt(CA*CA + CO*CO); 82 } 83 84 var top = (tT+fT)/2 - W/2 - 100; 85 var left = (tL+fL)/2 - H/2; 86 87 var arrows = [...line.getElementsByClassName('arrow')]; 88 89 var needSwap = (fL > tL || (fL == tL && fT < tT)); 90 var arrowFw = needSwap && isVisible(arrows[0]) && arrows[0] || !needSwap && isVisible(arrows[1]) && arrows[1]; 91 var arrowBw = !needSwap && isVisible(arrows[0]) && arrows[0] || needSwap && isVisible(arrows[1]) && arrows[1]; 92 if (arrowFw) { 93 arrowFw.classList.remove('arrow-bw'); 94 arrowFw.classList.add('arrow-fw'); 95 arrowFw.style.borderRightColor = color; 96 arrowFw.style.top = W/2-6 + "px"; 97 } 98 if (arrowBw) { 99 arrowBw.classList.remove('arrow-fw'); 100 arrowBw.classList.add('arrow-bw'); 101 arrowBw.style.borderLeftColor = color; 102 arrowBw.style.top = W/2-6 + "px"; 103 } 104 line.style.display = "none"; 105 line.style["-webkit-transform"] = 'rotate('+ ANG +'deg)'; 106 line.style["-moz-transform"] = 'rotate('+ ANG +'deg)'; 107 line.style["-ms-transform"] = 'rotate('+ ANG +'deg)'; 108 line.style["-o-transform"] = 'rotate('+ ANG +'deg)'; 109 line.style["-transform"] = 'rotate('+ ANG +'deg)'; 110 line.style.top = top+'px'; 111 line.style.left = left+'px'; 112 line.style.width = H + 'px'; 113 line.style.height = W + 'px'; 114 line.style.background = "linear-gradient(to right, " + 115 (arrowFw ? "transparent" : color) +" 11px, " + 116 color + " 11px " + (H - 11) + "px, " + 117 (arrowBw ? "transparent" : color) + " " + (H - 11) + "px 100%)"; 118 line.style.display = "initial"; 119 } 120 121 function repaintConnection(connectionElement) { 122 var fromQ = connectionElement.getAttribute('from'); 123 var fromE = document.querySelector(fromQ); 124 var toQ = connectionElement.getAttribute('to'); 125 var toE = document.querySelector(toQ); 126 connectedObserver.observe(fromE, {attributes:true}); 127 connectedObserver.observe(toE, {attributes:true}); 128 129 var lineE = connectionElement.getElementsByClassName('line')[0]; 130 if (!lineE) { 131 lineE = document.createElement('div'); 132 lineE.classList.add('line'); 133 connectionElement.appendChild(lineE); 134 } 135 var needTail = connectionElement.hasAttribute('tail'); 136 var needHead = connectionElement.hasAttribute('head'); 137 var arrows = lineE.getElementsByClassName('arrow'); 138 var tail = arrows[0]; 139 var head = arrows[1]; 140 if (!tail && (needHead || needTail)) { 141 tail = document.createElement('div'); 142 tail.classList.add('arrow'); 143 lineE.appendChild(tail); 144 } 145 146 if (!head && needHead) { 147 head = document.createElement('div'); 148 head.classList.add('arrow'); 149 lineE.appendChild(head); 150 } 151 152 tail && (tail.style.visibility = needTail ? 'visible' : 'hidden'); 153 head && (head.style.visibility = needHead ? 'visible' : 'hidden'); 154 155 var textE = lineE.getElementsByClassName('text')[0]; 156 var textMessage = connectionElement.getAttribute('text'); 157 158 if (!textE && textMessage) { 159 textE = document.createElement('div'); 160 textE.classList.add('text'); 161 lineE.appendChild(textE); 162 } 163 if (textE && textE.innerText != textMessage) { 164 textE.innerText = textMessage; 165 } 166 167 adjustLine(fromE, toE, lineE, { 168 color: connectionElement.getAttribute('color'), 169 onlyVisible: connectionElement.hasAttribute('onlyVisible'), 170 fromX: parseFloat(connectionElement.getAttribute('fromX')), 171 fromY: parseFloat(connectionElement.getAttribute('fromY')), 172 toX: parseFloat(connectionElement.getAttribute('toX')), 173 toY: parseFloat(connectionElement.getAttribute('toY')), 174 width: parseFloat(connectionElement.getAttribute('width')) 175 }); 176 } 177 178 function repaintWithoutObserve(tag) { 179 connectionObserver.observe(tag, {attributeFilter: []}); 180 repaintConnection(tag); 181 connectionObserver.observe(tag, {attributes:true, childList:true, subtree: true}); 182 } 183 184 function createOne(newElement) { 185 connectionElements.push(newElement); 186 repaintConnection(newElement); 187 connectionObserver.observe(newElement, {attributes:true, childList:true, subtree: true}); 188 } 189 190 function create() { 191 bodyObserver.observe(document.body, {childList:true, subtree: true}); 192 [...document.body.getElementsByTagName('connection')].forEac
192h(createOne); 193 } 194 195 function removeConnection(tag) { 196 for(var i = connectionElements.length - 1; i >= 0; i--) 197 if(connectionElements[i] === tag) 198 connectionElements.splice(i, 1); 199 200 connectionObserver.observe(tag, {attributeFilter: []}); 201 } 202 203 function changedConnectedTag(changes) { 204 changes.forEach(e => { 205 var changedElem = e.target; 206 var wasConnection = false; 207 for (var i = 0; i < connectionElements.length; ++i) { 208 var fromE = document.querySelector(connectionElements[i].getAttribute('from')); 209 if (fromE === changedElem) { 210 wasConnection = true; 211 repaintWithoutObserve(connectionElements[i]); 212 continue; 213 } 214 var toE = document.querySelector(connectionElements[i].getAttribute('to')); 215 if (toE === changedElem) { 216 wasConnection = true; 217 repaintWithoutObserve(connectionElements[i]); 218 } 219 } 220 if (!wasConnection) { 221 connectionObserver.observe(changedElem, {attributeFilter: []}); 222 } 223 }); 224 } 225 226 function changedConnectionTag(changes) {
227 changes.forEach(e => { 228 var conn = e.target; 229 if (conn.tagName.toLowerCase() !== 'connection' && e.attributeName === 'class') 230 ; 231 while (conn && conn.tagName.toLowerCase() !== 'connection') 232 conn = conn.parentElement; 233 if (!conn) return; 234 repaintWithoutObserve(conn); 235 }); 236 } 237 238 function bodyNewElement(changes) { 239 changes.forEach(e => { 240 e.removedNodes.forEach(n => { 241 if (n.tagName && n.tagName.toLowerCase() === 'connection') 242 removeConnection(n); 243 }); 244 e.addedNodes.forEach(n => { 245 if (n.tagName && n.tagName.toLowerCase() === 'connection') 246 createOne(n); 247 }); 248 }); 249 } 250 251 var connectionElements = []; 252 var MutationObserver = window.MutationObserver || 253 window.WebKitMutationObserver || window.MozMutationObserver; 254 var bodyObserver = new MutationObserver(bodyNewElement); 255 var connectionObserver = new MutationObserver(changedConnectionTag); 256 var connectedObserver = new MutationObserver(changedConnectedTag); 257 document.body && create() || window.addEventListener("load", create); 258})(); 259 260
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.