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($){ | |
jQuery.fn.mouseyDialog = function() { | |
// Classic Class Structure (note: no var, it's exposed for TDD) | |
MouseyDialog = function(anchor) { | |
this.anchor = $(anchor); | |
this.dialog = $(this.anchor.attr('href')); | |
this.button = $('<a href="#" class="mouseyDialog_close">close</a>'); | |
}; | |
MouseyDialog.prototype = { |
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($){ | |
jQuery.fn.mouseyDialog = function() { | |
// Classic Class Structure (note: no var, it's exposed for TDD) | |
MouseyDialog = function(element) { | |
// Constructor | |
} | |
MouseyDialog.prototype = { | |
sweetMethod: function() { | |
// Code |
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
.DS_Store | |
*.swp | |
*~.nib | |
build/ | |
*.pbxuser | |
*.perspective | |
*.perspectivev3 |
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
new Ajax.Request(this.element.readAttribute('href'), { | |
method:'post', | |
onSuccess: function(response) { | |
this.hideSpinner(); | |
$('promotion_list').insert({top: response.responseText}).down('li').hide().appear(); | |
}.bind(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
var JSClassObserver = Class.create({ | |
findElements: function(class_name) { | |
var self = this; | |
$('.' + class_name).each(function(index, element) { | |
if(element.js_attached == null) { | |
element.js_attached = {}; | |
} | |
if(element.js_attached[class_name] != true) { | |
self.attachBehavior(element, index); | |
element.js_attached[class_name] = true; |
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 Person = Micro.extend(function(name) { | |
this.name = name; | |
}); | |
Person.include({ | |
greet: function() { | |
print('Hello, ' + this.name + '!'); | |
} | |
}); |
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 Micro = (function() { | |
var proxy = function() {}; | |
var wrap = function(zuper, fn) { | |
return function() { | |
var saved = this.zuper; | |
this.zuper = zuper; | |
try { | |
return fn.apply(this, arguments); | |
} finally { | |
this.zuper = saved; |
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
/* | |
This is a combination of: | |
http://meyerweb.com/eric/thoughts/2007/09/07/diagnostic-styling/ | |
http://www.nealgrosskopf.com/tech/thread.asp?pid=17 | |
.. with some additional tweaking and additions | |
*/ | |
/* Empty Attributes */ | |
img[alt=""], |
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
/* Clone and Insert Attacher -------------------------------- */ | |
AttachOnceClass.add('CloneAndInsert', 'js_clone_and_insert', function(jquery_selector) { | |
// TODO: conside refactoring into a class | |
jquery_selector.click(function() { | |
var parent = $(this).parent(); | |
var insert = parent.find('.js_insert'); | |
var clone = parent.find('.js_clone').clone(true); | |
var count = insert.children().length + 2; | |
// Recursively make attributes unique in cloned html |
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 AttachOnce() { | |
this.behavior($('.' + this.target_class)); | |
this.clean(); | |
} | |
AttachOnce.prototype.clean = function() { | |
$('.' + this.target_class).removeClass(this.target_class); | |
} | |
AttachOnce.prototype.behavior = function() { | |
// Will be overwritten. | |
} |