Introduction
Introduction Statistics Contact Development Disclaimer Help
compat.js - jscancer - Javascript crap (relatively small)
git clone git://git.codemadness.org/jscancer
Log
Files
Refs
README
LICENSE
---
compat.js (1922B)
---
1 if (typeof(Array) != "undefined" && typeof(Element) != "undefined" &&
2 typeof(Event) != "undefined" && typeof(String) != "undefined") {
3 if (!Array.prototype.indexOf)
4 Array.prototype.indexOf = function(s) {
5 if (!(s in this))
6 return -1;
7 for (var i = 0; i < this.length; i++)
8 if (this[i] === s)
9 return i;
10 return -1;
11 };
12 if (!Array.prototype.map)
13 Array.prototype.map = function(fn) {
14 var l = [];
15 for (var i = 0; i < this.length; i++)
16 l.push(fn(this[i]));
17 return l;
18 };
19 if (!document.getElementsByClassName)
20 Element.prototype.getElementsByClassName = document.getE…
21 var els = this.getElementsByTagName("*"), l = [],
22 p = new RegExp("(^|\\s)" + classname + "…
23 for (var i = 0; i < els.length; i++)
24 if (p.test(els[i].className))
25 l.push(els[i]);
26 return l;
27 };
28 if (!document.addEventListener)
29 // NOTE: capture is ignored if addEventListener is not s…
30 if (this.attachEvent) // IE DOM
31 Element.prototype.addEventListener = document.ad…
32 this.attachEvent("on" + ev, function(e) {
33 // fixup some standard event pro…
34 if (typeof(e) == "undefined")
35 e = window.event;
36 e.target = typeof(e.target) != "…
37 e.which = typeof(e.which) != "un…
38 return fn.apply(this, arguments);
39 });
40 };
41 if (!document.removeEventListener)
42 if (this.detachEvent) // IE DOM
43 Element.prototype.removeEventListener = document…
44 this.detachEvent("on" + ev, fn);
45 };
46 if (!Event.prototype.stopPropagation)
47 Event.prototype.stopPropagation = function() {
48 window.event.cancelBubble = true;
49 return false;
50 };
51 if (!String.trim)
52 String.prototype.trim = function() {
53 return this.replace(/^\s+|\s+$/g, "");
54 };
55 }
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.