1/****************************************************************************** 2 Javascript Utilities 3 author Olaf Hannemann 4 license GPL V3 5 version 0.1.4 6 date 13.08.2011 7 8 This file is free software: you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation, either version 3 of the License, or 11 (at your option) any later version. 12 13 This file is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License (http://www.gnu.org/licenses/)for more details. 17 ******************************************************************************/ 18 19function setCookie(key, value) { 20 var expireDate = new Date; 21 expireDate.setMonth(expireDate.getMonth() + 6); 22 document.cookie = key + "=" + value + ";" + "expires=" + expireDate.toGMTString() + ";"; 23} 24 25function getCookie(argument) { 26 var buff = document.cookie; 27 var args = buff.split(";"); 28 for(i = 0; i < args.length; i++) { 29 var a = args[i].split("="); 30 if(trim(a[0]) == argument) { 31 return trim(a[1]); 32 } 33 } 34 35 return "-1"; 36} 37 38function getArgument(argument) { 39 if(window.location.search != "") { 40 // We have parameters 41 var undef = document.URL.split("?"); 42 var args = undef[1].split("&"); 43 for(i = 0; i < args.length; i++) { 44 var a = args[i].split("="); 45 if(a[0] == argument) { 46 return a[1]; 47 } 48 } 49 return "-1"; 50 } 51 return "-1"; 52} 53 54function checkKeyReturn(e) { 55 if (e.keyCode == 13) { 56 return true; 57 } 58 59 return false; 60} 61 62function trim(buffer) { 63 return buffer.replace(/^\s+/, '').replace(/\s+$/, ''); 64} 65 66function convert2Web(buffer) { 67 buffer = buffer.replace('&', '&'); 68 buffer = buffer.replace('<', '<'); 69 buffer = buffer.replace('>', '>'); 70 buffer = buffer.replace('\'', '''); 71 buffer = buffer.replace('\"', '"'); 72 73 return buffer 74} 75 76function convert2Ascii(buffer) { 77 buffer = buffer.replace('ü', 'ue'); 78 buffer = buffer.replace('ö', 'oe'); 79 buffer = buffer.replace('ä', 'ae'); 80 buffer = buffer.replace('Ã', 'ss'); 81 buffer = buffer.replace('ø', 'oe'); 82 83 return buffer 84} 85 86function convert2Locode(buffer) { 87 buffer = buffer.replace('ü', 'u'); 88 buffer = buffer.replace('ö', 'o'); 89 buffer = buffer.replace('ä', 'a'); 90 buffer = buffer.replace('Ã', 'ss'); 91 buffer = buffer.replace('ø', 'o'); 92 93 return buffer 94} 95 96function convert2Text(buffer) { 97 buffer = buffer.replace(/%20/g, ' '); 98 buffer = buffer.replace(/°/g, '°'); 99 100 return buffer 101} 102 103function format2FixedLenght(number, length, fraclength) { 104 var text = number.toFixed(fraclength); 105 while (text.length < length) text = "0"+text; 106 return text; 107} 108 109function loadXMLDoc(name) { 110 if (window.XMLHttpRequest) { 111 xhttp=new XMLHttpRequest(); 112 } else { 113 xhttp=new ActiveXObject("Microsoft.XMLHTTP"); 114 } 115 xhttp.open("GET",name,false); 116 xhttp.send(); 117 118 return xhttp.responseXML; 119}
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.