From e1b9e41c44afefcf75bbe5f85c4d9d2d939a2745 Mon Sep 17 00:00:00 2001 From: benweet Date: Sun, 17 Nov 2013 13:32:53 +0000 Subject: [PATCH] Implemented css working indicator --- public/res/extensions/workingIndicator.js | 29 +++++--------------- public/res/html/bodyIndex.html | 4 +-- public/res/html/bodyViewer.html | 5 +--- public/res/styles/main.less | 32 ++++++++++++++++------- 4 files changed, 31 insertions(+), 39 deletions(-) diff --git a/public/res/extensions/workingIndicator.js b/public/res/extensions/workingIndicator.js index 8b938257..76018609 100644 --- a/public/res/extensions/workingIndicator.js +++ b/public/res/extensions/workingIndicator.js @@ -1,42 +1,27 @@ define([ "jquery", "underscore", - "classes/Extension", - "crel" -], function ($, _, Extension, crel) { + "classes/Extension" +], function ($, _, Extension) { var workingIndicator = new Extension("workingIndicator", "Working Indicator"); var $bodyElt; var $workingIndicatorElt; - var intervalId; workingIndicator.onAsyncRunning = function (isRunning) { $bodyElt.toggleClass("working", isRunning); $workingIndicatorElt.toggleClass("show", isRunning); - if(isRunning) { - animate(); - intervalId = setInterval(animate, 200); - } - else { - clearInterval(intervalId); - } }; - var indicatorElts = []; - var loop = 0; - function animate() { - indicatorElts[loop].className = ''; - loop = (loop + 1) % 3; - indicatorElts[loop].className = 'highlighted'; - } - workingIndicator.onReady = function () { $bodyElt = $(document.body); $workingIndicatorElt = $(".working-indicator"); - for (var i = 0; i < 3; i++) { - indicatorElts.push(crel('div')); + for (var i = 0; i < 4; i++) { + $workingIndicatorElt.append($('
').css({ + 'animation-delay': '0.' + (i*2) + 's', + '-webkit-animation-delay': '0.' + (i*2) + 's', + })); } - $workingIndicatorElt.append(indicatorElts); }; return workingIndicator; diff --git a/public/res/html/bodyIndex.html b/public/res/html/bodyIndex.html index f4bf4b94..bc3bf32a 100644 --- a/public/res/html/bodyIndex.html +++ b/public/res/html/bodyIndex.html @@ -28,15 +28,13 @@
  • -
    diff --git a/public/res/html/bodyViewer.html b/public/res/html/bodyViewer.html index f6baad7e..92595672 100644 --- a/public/res/html/bodyViewer.html +++ b/public/res/html/bodyViewer.html @@ -26,12 +26,9 @@ - -
    diff --git a/public/res/styles/main.less b/public/res/styles/main.less index a8f6920c..7e9e06ba 100644 --- a/public/res/styles/main.less +++ b/public/res/styles/main.less @@ -330,19 +330,22 @@ a { } .working-indicator { - margin: 12px -2px 0; - div { + overflow: hidden; + height: @input-height-base; + padding-top: 10px; + padding-right: 8px; + vertical-align: middle; + .bar { display: inline-block; visibility: hidden; - width: 14px; - height: 14px; - border-radius: 6px; + width: 8px; + height: 7px; + border-radius: 1px; margin: 0 2px; - background-color: fade(@btn-success-color, 25%); - .transition(~"background-color linear .15s"); - &.highlighted { - background-color: fade(@btn-success-color, 75%); - } + background-color: @btn-success-color; + opacity: 0; + animation: indicator 0.6s ease-out infinite; + -webkit-animation: indicator 0.6s ease-out infinite; /* Safari and Chrome */ } &.show div { visibility: visible; @@ -350,6 +353,15 @@ a { } } +@keyframes indicator { + from {opacity: 1;} + to {opacity: 0.25;} +} + +@-webkit-keyframes indicator /* Safari and Chrome */ { + from {opacity: 1;} + to {opacity: 0.25;} +} /********************* * Menu/Document panels