jQuery mutator for MooTools
var MyClass = new Class({
Implements: [Options,Events],
options: {},
jQuery: {
method: 'jqfun',
helpers: ['one', 'two']
},
initialize: function(){},
one: function(){},
two: function(){},
three: function(){}
});
var mine = new MyClass();
Class.Mutators.jQuery= function(jquery){
return jquery;
};
Class.Mutators.initialize = function(initialize){
return function(){
//console.log("add ", this.jQuery.method, " to jQuery");
jQuery.fn[this.jQuery.method] = function(){};
$splat(this.jQuery.helpers).each(function(name){
//console.log("add ", name, " as ", this[name], " to jQuery.", this.jQuery.method);
jQuery.fn[this.jQuery.method][name] = this[name];
}, this);
return initialize.apply(this, arguments);
};
};