2013-05-27 19:45:33 +00:00
|
|
|
define([
|
2013-05-29 19:55:23 +00:00
|
|
|
"jquery",
|
2013-06-22 23:48:57 +00:00
|
|
|
"underscore",
|
2013-11-17 13:32:53 +00:00
|
|
|
"classes/Extension"
|
|
|
|
], function ($, _, Extension) {
|
2013-05-29 19:55:23 +00:00
|
|
|
|
2013-06-22 23:48:57 +00:00
|
|
|
var workingIndicator = new Extension("workingIndicator", "Working Indicator");
|
2013-05-29 19:55:23 +00:00
|
|
|
|
2013-11-07 23:10:38 +00:00
|
|
|
var $bodyElt;
|
|
|
|
var $workingIndicatorElt;
|
2013-11-16 18:09:33 +00:00
|
|
|
workingIndicator.onAsyncRunning = function (isRunning) {
|
2013-08-22 00:19:59 +00:00
|
|
|
$bodyElt.toggleClass("working", isRunning);
|
2013-12-03 00:29:57 +00:00
|
|
|
$workingIndicatorElt.toggleClass("hide", !isRunning);
|
2013-08-22 00:19:59 +00:00
|
|
|
};
|
|
|
|
|
2013-11-16 18:09:33 +00:00
|
|
|
workingIndicator.onReady = function () {
|
2013-08-22 00:19:59 +00:00
|
|
|
$bodyElt = $(document.body);
|
2013-11-23 15:41:02 +00:00
|
|
|
$workingIndicatorElt = $('<div class="hide">');
|
|
|
|
$('.working-indicator').append($workingIndicatorElt);
|
2013-12-03 00:20:16 +00:00
|
|
|
for (var i = 0; i < 3; i++) {
|
2013-11-17 13:32:53 +00:00
|
|
|
$workingIndicatorElt.append($('<div class="bar">').css({
|
2013-12-05 00:42:49 +00:00
|
|
|
'animation-delay': (i*15/10).toPrecision(3) + 's',
|
|
|
|
'-webkit-animation-delay': (i*15/10).toPrecision(3) + 's',
|
2013-11-17 13:32:53 +00:00
|
|
|
}));
|
2013-11-16 18:09:33 +00:00
|
|
|
}
|
2013-05-29 19:55:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return workingIndicator;
|
2013-05-27 19:45:33 +00:00
|
|
|
});
|