1//-------------------------------------------------------------- 2// Copyright (C) 2021 Michael Schwarz (http://www.ajaxpro.info). 3// All rights reserved. 4//-------------------------------------------------------------- 5 6// prototype.js 7//<script> 8 9if (!Object.extend) //schon eine Prototype Implementierung vorhanden, dann machen wir den Kram mal nicht selber 10{ 11 12 Object.extend = function (dest, source, replace) 13 { 14 for (var prop in source) 15 { 16 if (replace == false && dest[prop] != null) { continue; } 17 dest[prop] = source[prop]; 18 } 19 return dest; 20 }; 21 22 Object.extend(Function.prototype, { 23 /* 24 apply: function(o, a) { 25 var r, x = "__fapply"; 26 if(typeof o != "object") { o = {}; } 27 o[x] = this; 28 var s = "r = o." + x + "("; 29 for(var i=0; i<a.length; i++) { 30 if(i>0) { s += ","; } 31 s += "a[" + i + "]"; 32 } 33 s += ");"; 34 eval(s); 35 delete o[x]; 36 return r; 37 },*/ 38 bind: function (o) 39 { 40 if (!Function.__objs) 41 { 42 Function.__objs = []; 43 Function.__funcs = []; 44 } 45 var objId = o.__oid; 46 if (!objId) 47 { 48 Function.__objs[objId = o.__oid = Function.__objs.length] = o; 49 } 50 51 var me = this; 52 var funcId = me.__fid; 53 if (!funcId) 54 { 55 Function.__funcs[funcId = me.__fid = Function.__funcs.length] = me; 56 } 57 58 if (!o.__closures) 59 { 60 o.__closures = []; 61 } 62 63 var closure = o.__closures[funcId]; 64 if (closure) 65 { 66 return closure; 67 } 68 69 o = null; 70 me = null; 71 72 return Function.__objs[objId].__closures[funcId] = function () 73 { 74 return Function.__funcs[funcId].apply(Function.__objs[objId], arguments); 75 }; 76 } 77 }, false); 78 79 Object.extend(Array.prototype, { 80 /*push: function(o) { 81 this[this.length] = o; 82 },*/ 83 addRange: function (items) 84 { 85 if (items.length > 0) 86 { 87 for (var i = 0; i < items.length; i++) 88 { 89 this.push(items[i]); 90 } 91 } 92 }, 93 clear: function () 94 { 95 this.length = 0; 96 return this; 97 }/*, 98 shift: function() { 99 if(this.length == 0) { return null; } 100 var o = this[0]; 101 for(var i=0; i<this.length-1; i++) { 102 this[i] = this[i + 1]; 103 } 104 this.length--; 105 return o; 106 }*/ 107 }, false); 108 109 Object.extend(String.prototype, { 110 trimLeft: function () 111 { 112 return this.replace(/^\s*/, ""); 113 }, 114 trimRight: function () 115 { 116 return this.replace(/\s*$/, ""); 117 }, 118 trim: function () 119 { 120 return this.trimRight().trimLeft(); 121 }, 122 endsWith: function (s) 123 { 124 if (this.length == 0 || this.length < s.length) { return false; } 125 return (this.substr(this.length - s.length) == s); 126 }, 127 startsWith: function (s) 128 { 129 if (this.length == 0 || this.length < s.length) { return false; } 130 return (this.substr(0, s.length) == s); 131 }, 132 split: function (c) 133 { 134 var a = []; 135 if (this.length == 0) return a; 136 var p = 0; 137 for (var i = 0; i < this.length; i++) 138 { 139 if (this.charAt(i) == c) 140 { 141 a.push(this.substring(p, i)); 142 p = ++i; 143 } 144 } 145 a.push(s.substr(p)); 146 return a; 147 } 148 }, false); 149 150 Object.extend(String, { 151 /*format: function(s) { 152 for(var i=1; i<arguments.length; i++) { 153 s = s.replace("{" + (i -1) + "}", arguments[i]); 154 } 155 return s; 156 },*/ 157 isNullOrEmpty: function (s) 158 { 159 if (s == null || s.length == 0) 160 { 161 return true; 162 } 163 return false; 164 } 165 }, false); 166 167} 168 169if (typeof addEvent == "undefined") 170 addEvent = function (o, evType, f, capture) 171 { 172 if (o == null) { return false; } 173 if (o.addEventListener) 174 { 175 o.addEventListener(evType, f, capture); 176 return true; 177 } else if (o.attachEvent) 178 { 179 var r = o.attachEvent("on" + evType, f); 180 return r; 181 } else 182 { 183 try { o["on" + evType] = f; } catch (e) { } 184 } 185 }; 186 187if (typeof removeEvent == "undefined") 188 removeEvent = function (o, evType, f, capture) 189 { 190 if (o == null) { return false; } 191 if (o.removeEventListener) 192 { 193 o.removeEventListener(evType, f, capture); 194 return true; 195 } else if (o.detachEvent) 196 { 197 o.detachEvent("on" + evType, f); 198 } else 199 {
200 try { o["on" + evType] = function () { }; } catch (e) { } 201 } 202 };
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.