1function createXmlHttpRequestObject() { 2 var xmlHttp; 3 try { 4 xmlHttp = new XMLHttpRequest(); 5 } 6 catch (e) { 7 var XmlHttpVersions = ['MSXML2.XMLHTTP.6.0', 8 'MSXML2.XMLHTTP.5.0', 9 'MSXML2.XMLHTTP.4.0', 10 'MSXML2.XMLHTTP.3.0', 11 'MSXML2.XMLHTTP', 12 'Microsoft.XMLHTTP']; 13 14 for (var i = 0; i < XmlHttpVersions.length && !xmlHttp; i++) { 15 try { 16 xmlHttp = new ActiveXObject(XmlHttpVersions[i]); 17 } 18 catch (e) { 19 } 20 } 21 } 22 return xmlHttp; 23} 24 25/** 26 * @return {boolean} 27 */ 28function AddBriefcase(saveTxt, system, hory, iddata, UID, list, from, addr, paramv, bNewWin, hideIcon) { 29 var xmlHttp = createXmlHttpRequestObject(); 30 if (xmlHttp) { 31 var span = "system-" + system + "-hory-" + hory + "-iddata-" + iddata + "-" + UID; 32 var p = document.getElementById(span); 33 p.innerHTML = "Nahrávám ..."; 34 35 xmlHttp.open("GET", "/share/ajax/briefcase_server.php?system=" + system + "&hory=" + hory + "&iddata=" + iddata + "&time=" + (new Date()).getTime(), true); 36 xmlHttp.onreadystatechange = function () { 37 ShowResponse(xmlHttp, saveTxt, span, hory, list, from, addr, paramv, bNewWin, hideIcon); 38 }; 39 40 xmlHttp.send(null); 41 42 return true; 43 } 44 return false; 45} 46 47function extractHostname(url) { 48 var hostname; 49 //find & remove protocol (http, ftp, etc.) and get hostname 50 51 if (url.indexOf("//") > -1) { 52 hostname = url.split('/')[2]; 53 } 54 else { 55 hostname = url.split('/')[0]; 56 } 57 58 //find & remove port number 59 hostname = hostname.split(':')[0]; 60 //find & remove "?" 61 hostname = hostname.split('?')[0]; 62 63 return hostname; 64} 65 66// To address those who want the "root domain," use this function: 67function extractRootDomain(url) { 68 var domain = extractHostname(url), 69 splitArr = domain.split('.'), 70 arrLen = splitArr.length; 71 72 //extracting the root domain here 73 //if there is a subdomain 74 if (arrLen > 2) { 75 domain = splitArr[arrLen - 2] + '.' + splitArr[arrLen - 1]; 76 //check to see if it's using a Country Code Top Level Domain (ccTLD) (i.e. ".me.uk") 77 if (splitArr[arrLen - 2].length === 2 && splitArr[arrLen - 1].length === 2) { 78 //this is using a ccTLD 79 domain = splitArr[arrLen - 3] + '.' + domain; 80 } 81 } 82 return domain; 83} 84 85/** 86 * Sestavà url, kde nahradà subdoménu za www, napÅ. pro mÃsta, jinak link smÄÅuje na 404 87 * @returns {string} 88 */ 89function getBaseDomain() 90{ 91 var domain = location.hostname; 92 93 if (domain === 'localhost') 94 return 'https://' + domain; 95 96 return 'https://www.' + extractRootDomain(domain); 97} 98 99/** 100 * @return {boolean} 101 */ 102function ShowResponse(xmlHttp, saveTxt, span, hory, list, from, addr, paramv, bNewWin, hideIcon) { 103 if (xmlHttp.readyState === 4) { 104 if (xmlHttp.status === 200) { 105 if (typeof(svr) === "undefined") 106 svr = getBaseDomain(); 107 108 console.log(svr); 109 110 var p = document.getElementById(span); 111 var xmlResponse = xmlHttp.responseXML; 112 var xmlRoot = xmlResponse.documentElement; 113 var nodeAlert = xmlRoot.getElementsByTagName("alert"); 114 var txt = nodeAlert.item(0).firstChild.nodeValue; 115 var target = ""; 116 117 if (bNewWin) 118 target = "target=\"_blank\""; 119 120 if(txt=="OK") { 121 var icon = '<img src="https://www.ceskehory.cz/share/img/aktovka.svg" class="ico-cena" />', 122 text = saveTxt + " ve <u>Vašà Aktovce</u>"; 123 124 p.href = svr + addr + "/briefcase/?hory=" + hory + "&from=" + from + "¶mv=" + paramv + "&list=" + list; 125 p.onclick = function(){}; 126 p.innerHTML = (hideIcon ? "" : icon) + text; 127 } 128 else 129 p.innerHTML = txt; 130 131 return true; 132 } 133 } 134 return false; 135}
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.