Fixed working indicator CPU usage

This commit is contained in:
benweet 2013-11-23 15:41:02 +00:00
parent e8cb038ea6
commit 18dceb2924
2 changed files with 7 additions and 10 deletions

View File

@ -10,12 +10,13 @@ define([
var $workingIndicatorElt;
workingIndicator.onAsyncRunning = function (isRunning) {
$bodyElt.toggleClass("working", isRunning);
$workingIndicatorElt.toggleClass("show", isRunning);
$workingIndicatorElt.toggleClass("hide", !isRunning);
};
workingIndicator.onReady = function () {
$bodyElt = $(document.body);
$workingIndicatorElt = $(".working-indicator");
$workingIndicatorElt = $('<div class="hide">');
$('.working-indicator').append($workingIndicatorElt);
for (var i = 0; i < 4; i++) {
$workingIndicatorElt.append($('<div class="bar">').css({
'animation-delay': (i*2/10).toPrecision(3) + 's',
@ -25,5 +26,4 @@ define([
};
return workingIndicator;
});

View File

@ -332,22 +332,19 @@ a {
.working-indicator {
overflow: hidden;
height: @input-height-base;
width: 65px;
padding-top: 10px;
padding-right: 8px;
vertical-align: middle;
.bar {
display: inline-block;
visibility: hidden;
width: 10px;
height: 10px;
border-radius: 1px;
margin: 0 2px;
opacity: 0.25;
background-color: @btn-success-color;
animation: indicator 0.6s ease-out infinite;
-webkit-animation: indicator 0.6s ease-out infinite; /* Safari and Chrome */
}
&.show div {
visibility: visible;
animation: indicator 0.8s ease-out infinite;
-webkit-animation: indicator 0.8s ease-out infinite; /* Safari and Chrome */
}
}
}