Stackedit/public/res/extensions/workingIndicator.js

29 lines
847 B
JavaScript
Raw Normal View History

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);
$workingIndicatorElt.toggleClass("show", isRunning);
};
2013-11-16 18:09:33 +00:00
workingIndicator.onReady = function () {
2013-08-22 00:19:59 +00:00
$bodyElt = $(document.body);
$workingIndicatorElt = $(".working-indicator");
2013-11-17 13:32:53 +00:00
for (var i = 0; i < 4; i++) {
$workingIndicatorElt.append($('<div class="bar">').css({
'animation-delay': '0.' + (i*2) + 's',
'-webkit-animation-delay': '0.' + (i*2) + 's',
}));
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
});