Skip to content

Instantly share code, notes, and snippets.

View tivac's full-sized avatar
💭
👋🏻🙃

Pat Cavit tivac

💭
👋🏻🙃
View GitHub Profile
@tivac
tivac / gist:185607
Created September 11, 2009 21:43 — forked from lsmith/gist:185604
function Foo() {
/* constructor stuff */
}
// apply a class prototype that includes private and public methods
(function () {
function private(x) {
return x + 1;
}
var Foo = (function () {
var prop;
function Foo(bar) {
this.prop = bar || "baz";
}
// private/protected functions here
function priv() {
return "Private: " + prop;
//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();
Y.all(this.selector).each(function(n) {
if(!this._imageLoaded(n)) {
n.on('load', _setup, this);
}
_setup(n);
}, this);
_setup : function(img) {
<!DOCTYPE html>
<html>
<head>
<title>ChromaHash Test</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
</head>
<body lang="en-US">
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);
YUI().use("widget", function(Y) {
function Chiclet(config) {
Chiclet.superclass.constructor.apply(this, arguments);
}
Y.mix(Chiclet, {
NAME : "Chiclet",
ATTRS : {
speed : { value : 200 },
var feedData = [];
feedData.callbacks = [];
feedData.callbacks.insertNewItems = function(item) {
// ...
};
feedData.callbacks.updateNumberOfImages = function(data) {
// ...
};
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" ]
},
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";