var MooBehaviors = {}; MooBehaviors.Util = function() { return { handleAnimMoments: function(cfg, anim, currScope) { if(cfg.onStart) { anim.onStart.subscribe(function() { ProtoScript.Core.callBehaviors(cfg.onStart, currScope); }); } if(cfg.onStop) { anim.onTween.subscribe(function() { ProtoScript.Core.callBehaviors(cfg.onTween, currScope); }); } if(cfg.onComplete) { anim.onComplete.subscribe(function() { ProtoScript.Core.callBehaviors(cfg.onComplete, currScope); }); } } } }(); MooBehaviors.Fade = function(behaviorName, behaviorCfg) { this.init(behaviorName, behaviorCfg); }; MooBehaviors.Fade.prototype = { defaultCfg : { start: 1, // revisit end: 0, // revisit transition: null, duration: null, unit: null, wait: null, fps: null }, init: function(behaviorName, behaviorCfg) { this.name = behaviorName; this.cfg = ProtoScript.Core.applyConfig(this.defaultCfg, behaviorCfg); }, action: function(currScope) { var scopeElems = currScope.elems; var cfg = this.cfg; for (var i=0; i 0) { setTimeout(function() { this.callBehaviors(behaviorCfg['on'+behaviorName], scope); }, behaviorCfg.delay*1000); } else { ProtoScript.Core.callBehaviors(behaviorCfg['on'+behaviorName], scope); } } }; }(triggerElem, onTriggerElem, i)); } } }; MooBehaviors.Click = function(behaviorName, behaviorCfg) { this.init(behaviorName, behaviorCfg); }; MooBehaviors.Click.prototype = { defaultCfg : {}, init: function(behaviorName, behaviorCfg) { this.name = behaviorName; this.cfg = ProtoScript.Core.applyConfig(this.defaultCfg, behaviorCfg); }, action: function(currScope) { MooBehaviors.Trigger(this.cfg, currScope, 'click');} };