define([ "jquery", "underscore", "crel", "classes/Extension" ], function ($, _, crel, Extension) { var workingIndicator = new Extension("workingIndicator", "Working Indicator"); var keyframeTemlate = [ '@<%= prefix %>keyframes <%= name %> {', ' 0% { opacity:<%= z %>; }', ' <%= start %>.01% { opacity:<%= alpha %>; }', ' <%= start %>.02% { opacity:1; }', ' <%= ((start + trail) % 100) %>.01% { opacity:<%= alpha %>; }', ' 100% { opacity:<%= z %>; }', '}' ].join('\n'); var $bodyElt; var $workingIndicatorElt; workingIndicator.onAsyncRunning = function (isRunning) { $bodyElt.toggleClass("working", isRunning); $workingIndicatorElt.toggleClass("hide", !isRunning); }; workingIndicator.onReady = function () { var styleContent = ''; function addKeyframe(params) { params.z = Math.max(1 - (1-params.alpha) / params.trail * (100-params.start), params.alpha); styleContent += _.template(keyframeTemlate, _.extend({ prefix: '' }, params)); styleContent += _.template(keyframeTemlate, _.extend({ prefix: '-webkit-' }, params)); } $bodyElt = $(document.body); $workingIndicatorElt = $('