This file contains 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
/* | |
* MUI.Widget - is base class for all widgets, designed to be extended | |
* | |
* - allows you to add functionality to elements unobtrusively | |
* - the lifecycle methods: initialize, render and destroy | |
* - abstract rendering methods (render calls: createUI, updateUI) to support a consistent structure | |
* - provides a common set of base widget attributes | |
* - consistent class-name generation | |
* - for easy widget developement and maintanance use external stylesheets and HTML templates as much you can | |
* - basic widget HTML template consists of container (outermost element) and content (direct descendant) |
This file contains 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
// template based on fast string building - proposal | |
// Daniel Steigerwald - MIT Licensed | |
var Template = new Class({ | |
Implements: [Events, Options], | |
options: { | |
data: null, // datasource | |
mapper: $empty // custom mapper function, has to return hash. Key is className, value is same hash as for Element.set | |
}, |
This file contains 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
var el = new Element('div', { | |
style: 'position: absolute; width: 100px; height: 100px; background-color: red' | |
}).inject(document.body); | |
var styles = { clip: 'rect(10px 90px 90px 10px)' }; | |
//el.setStyles(styles); // ok | |
el.morph(styles); // doesn't work |
This file contains 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
// mootools browser.js | |
// | |
// "We've been the only framework using object detection since the beginning, | |
// but we only used it to set some Browser.Engine flags... which is IMO pretty lame." tomocchino | |
// | |
// Example: if (Browser.ie > 7) {.. | |
@@ -34,13 +34,22 @@ var Browser = $merge({ | |
return (document.getBoxObjectFor == undefined) ? false : ((document.getElementsByClassName) ? 19 : 18); | |
} | |
This file contains 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
/* | |
Script: Element.Dimensions.js | |
Contains methods to work with size, scroll, or positioning of Elements and the window object. | |
License: | |
MIT-style license. | |
Credits: | |
- Viewport dimensions based on [YUI](http://developer.yahoo.com/yui/) code, [BSD License](http://developer.yahoo.com/yui/license.html). |
This file contains 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
var Theme = { | |
'art-widget': { | |
styles: { | |
normal: { roundness: 4, backgroundOpacity: .7 }, | |
focused: { backgroundOpacity: .9 } | |
}, | |
'art-button': { // should inherit 'art-widget' styles | |
normal: { roundness: 2, backgroundOpacity: 1 } | |
}, | |
'art-input': { // should inherit 'art-widget' styles |
This file contains 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
var ArtSheet = { | |
'widget': { roundness: 4, backgroundOpacity: .7 }, | |
'widget:focus': { backgroundOpacity: .9 }, | |
'widget button': { roundness: 2, backgroundOpacity: 1 }, | |
'widget button:hover': { roundness: 4 }, | |
'widged input': { roundness: 4, backgroundOpacity: 1 } | |
}; |
This file contains 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
var names = ['mrd', 'prd']; | |
for (var i = 0, l = names.length, name; name = names[i], i < l; i++) { | |
document.title += name; | |
} | |
for (var i = names.length, name; name = names[i - 1], i--; ) { | |
document.title += name; | |
} |
This file contains 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.prototype.pleaseAcceptAsPairToo = function() { | |
var one = function(key, value) { | |
var obj = {}; | |
obj[key] = value; | |
return many.call(this, obj); | |
}, many = this; | |
return function(item) { | |
return ((typeof item == 'string') ? one : many).apply(this, arguments); | |
}; |
This file contains 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 getTextNodes(node) { | |
var tns = []; | |
(function walk(n) { | |
while (n) n.nodeType == 3 ? tns.push(n) : walk(n.firstChild), n = n.nextSibling; | |
})(node.firstChild); | |
return tns; | |
}; |
OlderNewer