This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Class.Initializers = {}; | |
| Class.Mutators.initialize = function(initialize){ | |
| return function(){ | |
| this._init_ = initialize; | |
| for (var modifier in Class.Initializers) { | |
| if (!this[modifier]) continue; | |
| this[modifier] = Class.Initializers[modifier].call(this, this[modifier]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Class.Mutators.BindAll = function(self, bool) { | |
| if (!bool) return self; | |
| var init = self.initialize; | |
| var exclude = arguments.callee.exclude; | |
| self.initialize = function() { | |
| for (var method in this) { | |
| if (typeof this[method] != 'function' || exclude.contains(method)) | |
| continue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Element.Events.clickout = { | |
| base : 'click', | |
| condition : function(event){ | |
| event.stopPropagation(); // stop event bubbling to the body | |
| return false; // never run handler when clicking on element | |
| }, | |
| onAdd : function(fn){ | |
| this.getDocument().addEvent('click', fn); | |
| }, | |
| onRemove : function(fn){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Native.implement([Element, Window, Document, Events], { | |
| oneEvent : function(type, fn) { | |
| return this.addEvent(type, function() { | |
| this.removeEvent(type, arguments.callee); | |
| return fn.apply(this, arguments); | |
| }); | |
| } | |
| }); | |
| /* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function $E(tag, props) { | |
| if (typeof props == 'string') | |
| props = { style : props }; | |
| if (typeof tag == 'string') { | |
| var id = tag.match(/#([\w-]+)/); | |
| var classes = tag.match(/(?:\.[\w-]+)+/); | |
| tag = tag.replace(/[#.].*/, ''); | |
| props = props || {}; | |
| if (id) props.id = id[1]; | |
| if (classes) props['class'] = classes[0].replace(/\./g, ' '); |
NewerOlder