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 Foo() { | |
/* constructor stuff */ | |
} | |
// apply a class prototype that includes private and public methods | |
(function () { | |
function private(x) { | |
return x + 1; | |
} |
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
var Foo = (function () { | |
var prop; | |
function Foo(bar) { | |
this.prop = bar || "baz"; | |
} | |
// private/protected functions here | |
function priv() { | |
return "Private: " + prop; |
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
//Assume all code is wrapped within each respective library's DOMReady handler | |
//Scope-corrected callback in YUI 2 | |
YAHOO.util.Event("id", "click", function(e) { | |
this._methodName(); | |
}, null, this); | |
//Scope-corrected callback in YUI 3 | |
Y.on("click", function(e) { | |
this._methodName(); |
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
Y.all(this.selector).each(function(n) { | |
if(!this._imageLoaded(n)) { | |
n.on('load', _setup, this); | |
} | |
_setup(n); | |
}, this); | |
_setup : function(img) { | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>ChromaHash Test</title> | |
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> | |
</head> | |
<body lang="en-US"> |
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
Y.Echofin.Modal.async('/path', function(dlg) { | |
Y.delegate("click", function(e) { | |
//from in here you can still call stuff from outside the .async | |
//call thanks to closures, so go nuts! | |
}, dlg, "a.img"); | |
}, this); |
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
YUI().use("widget", function(Y) { | |
function Chiclet(config) { | |
Chiclet.superclass.constructor.apply(this, arguments); | |
} | |
Y.mix(Chiclet, { | |
NAME : "Chiclet", | |
ATTRS : { | |
speed : { value : 200 }, |
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
var feedData = []; | |
feedData.callbacks = []; | |
feedData.callbacks.insertNewItems = function(item) { | |
// ... | |
}; | |
feedData.callbacks.updateNumberOfImages = function(data) { | |
// ... | |
}; |
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
YUI({ | |
groups : { | |
googa : { | |
combine : false, | |
base : "/blog/wp-content/themes/aooga/js/lib/", | |
modules : { | |
'chiclet' : { | |
fullpath : "chiclet-lib.js", | |
requires : [ "widget", "anim-base", "anim-easing" ] | |
}, |
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 moveIt(checkbox) { | |
var pos = checkbox.value, | |
moz = document.getElementById('moz'), | |
moz1 = document.getElementById('moz1'), | |
moz2 = document.getElementById('moz2'), | |
moz3 = document.getElementById('moz3'); | |
switch (pos) { | |
case "nw" : | |
moz.style.visibility = (checkbox.checked === true) ? "visible" : "hidden"; |