1/* Prototype JavaScript framework 2 * (c) 2005 Sam Stephenson <[email protected]> 3 * Prototype is freely distributable under the terms of an MIT-style license. 4 * For details, see the Prototype web site: http://prototype.conio.net/ 5/*--------------------------------------------------------------------------*/ 6 7//note: modified & stripped down version of prototype, to be used with moo.fx by mad4milk (http://moofx.mad4milk.net). 8 9var Class = { 10 create: function() { 11 return function() { 12 this.initialize.apply(this, arguments); 13 } 14 } 15} 16 17Object.extend = function(destination, source) { 18 for (property in source) destination[property] = source[property]; 19 return destination; 20} 21 22Function.prototype.bind = function(object) { 23 var __method = this; 24 return function() { 25 return __method.apply(object, arguments); 26 } 27} 28 29Function.prototype.bindAsEventListener = function(object) { 30var __method = this; 31 return function(event) { 32 __method.call(object, event || window.event); 33 } 34} 35 36function $() { 37 if (arguments.length == 1) return get$(arguments[0]); 38 var elements = []; 39 $c(arguments).each(function(el){ 40 elements.push(get$(el)); 41 }); 42 return elements; 43 44 function get$(el){ 45 if (typeof el == 'string') el = document.getElementById(el); 46 return el; 47 } 48} 49 50if (!window.Element) var Element = new Object(); 51 52Object.extend(Element, { 53 remove: function(element) { 54 element = $(element); 55 element.parentNode.removeChild(element); 56 }, 57 58 hasClassName: function(element, className) { 59 element = $(element); 60 if (!element) return; 61 var hasClass = false; 62 element.className.split(' ').each(function(cn){ 63 if (cn == className) hasClass = true; 64 }); 65 return hasClass; 66 }, 67 68 addClassName: function(element, className) { 69 element = $(element); 70 Element.removeClassName(element, className); 71 element.className += ' ' + className; 72 }, 73 74 removeClassName: function(element, className) { 75 element = $(element); 76 if (!element) return; 77 var newClassName = ''; 78 element.className.split(' ').each(function(cn, i){ 79 if (cn != className){ 80 if (i > 0) newClassName += ' '; 81 newClassName += cn; 82 } 83 }); 84 element.className = newClassName; 85 }, 86 87 cleanWhitespace: function(element) { 88 element = $(element); 89 $c(element.childNodes).each(function(node){ 90 if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) Element.remove(node); 91 }); 92 }, 93 94 find: function(element, what) { 95 element = $(element)[what]; 96 while (element.nodeType != 1) element = element[what]; 97 return element; 98 } 99}); 100 101var Position = { 102 cumulativeOffset: function(element) { 103 var valueT = 0, valueL = 0; 104 do { 105 valueT += element.offsetTop || 0; 106 valueL += element.offsetLeft || 0; 107 element = element.offsetParent; 108 } while (element); 109 return [valueL, valueT]; 110 } 111}; 112 113document.getElementsByClassName = function(className) { 114 var children = document.getElementsByTagName('*') || document.all; 115 var elements = []; 116 $c(children).each(function(child){ 117 if (Element.hasClassName(child, className)) elements.push(child); 118 }); 119 return elements; 120} 121 122//useful array functions 123Array.prototype.iterate = function(func){ 124 for(var i=0;i<this.length;i++) func(this[i], i); 125} 126if (!Array.prototype.each) Array.prototype.each = Array.prototype.iterate; 127 128function $c(array){ 129 var nArray = []; 130 for (var i=0;i<array.length;i++) nArray.push(array[i]); 131 return nArray; 132}
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.