Skip to content

Instantly share code, notes, and snippets.

View anutron's full-sized avatar

Aaron Newton anutron

View GitHub Profile
//positions an input over an object to edit it inline
var EditInline = new Class({
Implements: [Options, Class.Occlude, Events],
Binds: ['edit', 'mouseenter', 'mouseleave', 'esc'],
options: {
//onEnter: $empty,
tag: 'input',
hoverClass: 'edit_highlight',
activeClass: 'edit_activated',
Hash.implement({
substitute: function(template, regexp){
return template.replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){
if (match.charAt(0) == '\\') return match.slice(1);
if (this.get(name)) return this.get(name);
if (name.contains(".")) {
var found = this.getFromPath(name);
return found ? found : "";
}
}.bind(this));
var Templatizer = new Class({
Implements: [Options, Events],
options: {
templates: {
/*
name: instanceOfSubtleTemplate
*/
},
data: {}
},
Request.JSON = new Class({
Extends: Request,
options: {
secure: true
},
initialize: function(options){
this.parent(options);
Depender.require({
scripts: [Fx.Reveal, Fx.Accordion, FormValidator],
sources: [core],
ready: fn1
});
Depender.require({
scripts: [Fx.Reveal],
sources: [core],
ready: fn2,
(function(){
var supported;
if (document.body.setAttribute) {
var el = document.createElement('div');
el.setAttribute('onhashchange','return;');
supported = typeof el.onhashchange == 'function';
} else {
supported = 'onhashchange' in document.documentElement;
}
if (!supported) {
/*
---
name: Behavior
description: Auto-instantiates widgets/classes based on parsed, declarative HTML.
requires: [Core/Class.Extras, Core/Element, /ART.Window]
provides: [Behavior]
...
*/
(function(){
@anutron
anutron / Events.Relay.js
Created December 22, 2010 19:35
PassEvents.js
/*
---
description: Allows you to pass through events in Class instances.
provides: [Events.Relay]
requires:
- Core/Events
script: Events.Relay.js
...
@anutron
anutron / mootools.highchart.adapter.js
Created March 20, 2012 00:31
mootools.highchart.adapter.js
/**
* @license Highcharts JS v2.2.0 (2012-02-16)
* MooTools adapter
*
* (c) 2010-2011 Torstein Hønsi
*
* License: www.highcharts.com/license
*/
// JSLint options:
['touchstart', 'touchmove', 'touchend'].each(function(type){
Element.NativeEvents[type] = 2;
});
Element.Events.swipe = {
onAdd: function(fn){
var startX, startY, active = false;
var touchStart = function(event){
active = true;