1Liferay.Class = function(properties) { 2 var instance = this; 3 4 var superclass = instance; 5 6 if (typeof properties == 'function') { 7 var initialize = properties; 8 9 properties = properties.prototype; 10 11 properties.initialize = initialize; 12 13 superclass = initialize.superclass || superclass; 14 } 15 16 if (!properties.implement) { 17 properties.implement = function(options) { 18 var instance = this; 19 20 var args = Array.prototype.slice.call(arguments, 0); 21 22 args.unshift(instance); 23 Expanse.extend.apply(instance, args); 24 25 return instance; 26 }; 27 } 28 29 var Class = function(args) { 30 var instance = this; 31 32 if (typeof properties == 'function') { 33 var initialize = properties; 34 35 properties = properties.prototype; 36 37 properties.initialize = initialize; 38 39 } 40 41 for (var p in instance) { 42 if (instance[p] && typeof instance[p] == 'function') { 43 instance[p]._proto_ = instance; 44 } 45 } 46 47 if (this instanceof arguments.callee) { 48 var formalArguments = arguments; 49 var firstArgument = arguments[0]; 50 51 if (args && args.callee) { 52 formalArguments = args; 53 54 if (formalArguments[0]) { 55 firstArgument = formalArguments[0]; 56 } 57 } 58 59 if (firstArgument != 'noinit' && instance.initialize) { 60 return instance.initialize.apply(instance, formalArguments); 61 } 62 } 63 else { 64 return new arguments.callee(arguments); 65 } 66 }; 67 68 Class.extend = this.extend; 69 Class.implement = this.implement; 70 Class.prototype = properties; 71 72 Class.prototype.superclass = superclass; 73 Class.superclass = superclass; 74 75 Class.prototype.constructor = Class.prototype.constructor || Class; 76 Class.constructor = Class.constructor || Class; 77 78 return Class; 79}; 80 81Liferay.Class.prototype = { 82 extend: function(properties) { 83 var instance = this; 84 85 var proto = new instance('noinit'); 86 87 for (var property in properties) { 88 var previous = proto[property]; 89 var current = properties[property]; 90 91 if (previous && typeof previous == 'function' && previous != current) { 92 current = Liferay.Class.createSuper(previous, current) || current; 93 } 94 95 proto[property] = current; 96 } 97 98 var Class = new Liferay.Class(proto); 99 100 Class.prototype.superclass = instance; 101 Class.superclass = instance; 102 103 Class.prototype.constructor = Class.prototype.constructor || Class; 104 Class.constructor = Class.constructor || Class; 105 106 return Class; 107 }, 108 109 implement: function(properties) { 110 var instance = this; 111 112 for (var property in properties) { 113 instance.prototype[property] = properties[property]; 114 } 115 } 116}; 117 118Liferay.Class.createSuper = function(previous, current) { 119 return function() { 120 this.parent = previous; 121 122 return current.apply(this, arguments); 123 } 124}; 125 126window.Class = Liferay.Class;
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.