Skip to content

Instantly share code, notes, and snippets.

View anutron's full-sized avatar

Aaron Newton anutron

View GitHub Profile
var Templatizer = new Class({
Implements: [Options, Events],
options: {
templates: {
/*
name: instanceOfSubtleTemplate
*/
},
data: {}
},
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));
//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',
Number.implement({
parsePermissions: function() {
var perms = {};
$H({
user_read: 0004,
user_write: 0002,
user_execute: 0001,
group_read: 0040,
group_write: 0020,
group_execute: 0010,
dispose: (Browser.Engine.trident && window.location.href.test(/^https/i)) ?
function(){
if (this.parentNode) {
var bg = this.style.background;
this.style.background = '';
this.parentNode.removeChild(this);
this.style.background = bg;
}
return this;
} : function(){
Class.Initializers = {};
Class.Mutators.initialize = function(initialize){
return function(){
for (var modifier in Class.Initializers) {
if (!this[modifier]) continue;
this[modifier] = Class.Initializers[modifier].call(this, this[modifier]);
}
Class.events = new Events();
Class.Mutators.initialize = function(initialize){
return function(){
Class.events.fireEvent('initialize', this);
var inited = initialize.apply(this, arguments);
Class.events.fireEvent('afterInitialize', this);
return inited;
}
};
/*
Script: Element.Measure.js
Extends the Element native object to include methods useful in measuring dimensions.
Element.measure / .expose methods by Daniel Steigerwald
License: MIT-style license.
Copyright: Copyright (c) 2008 Daniel Steigerwald, daniel.steigerwald.cz
License:
MIT-style license.
/*
* AUTOGROW TEXTAREA
* Version 1.0
* A mooTools plugin
* by Gary Glass (www.bookballoon.com)
* mailto:bookballoon -at- bookballoon.com
*
* Based on a jQuery plugin by Chrys Bader (www.chrysbader.com).
*
* Copyright (c) 2009 Gary Glass (www.bookballoon.com)
Chain = new Class({
$chains: {},
getChain: function(key) {
this.$chains[key] = this.$chains[key] || {
$chain: [],