phorge/webroot/rsrc/js/core/Busy.js
Chad Little ddcdf0a04f Fix full width form layouts
Summary: Fixes T3473, mostly reverts previous changes to clean up required field text, will  have to redesign that in general for responsiveness.

Test Plan: use logout form, use new conpherence form

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T3473

Differential Revision: https://secure.phabricator.com/D6371
2013-07-03 20:24:28 -07:00

52 lines
1.2 KiB
JavaScript

/**
* @requires javelin-install
* javelin-dom
* javelin-fx
* @provides phabricator-busy
* @javelin
*/
/**
* Show a "busy" indicator onscreen so the user knows something awesome is
* happening, and that the awesome thing isn't the application breaking or
* locking up.
*
* Example usage:
*
* JX.Busy.start();
* // Do something...
* JX.Busy.done();
*
* Calls to `start()` should be paired with calls to `done()`.
*/
JX.install('Busy', {
statics : {
_depth : 0,
start : function() {
var self = JX.Busy;
if (!self._depth) {
self._indicator = JX.$N('div', {className: 'busy'});
self._indicator.style.opacity = 0;
document.body.appendChild(self._indicator);
// Don't actually show the indicator for a little while, to prevent
// it from flashing briefly for every Ajax request.
new JX.FX(self._indicator).setDuration(1000).start({opacity: [0, 0.8]});
}
self._depth++;
},
done : function() {
var self = JX.Busy;
--self._depth;
if (!self._depth) {
JX.DOM.remove(self._indicator);
self._indicator = null;
}
}
}
});