From d88978ead121df402ca5832710b931fc1f4ceb89 Mon Sep 17 00:00:00 2001 From: mprahl Date: Fri, 28 Oct 2016 19:40:37 -0400 Subject: [PATCH] Replace GIF spinner with CSS spinner --- docs/ChangeLog.md | 3 ++ postmaster/static/css/spinner.css | 55 ++++++++++++++++++++++++++++++ postmaster/static/css/styles.css | 9 ----- postmaster/static/img/loader.gif | Bin 4176 -> 0 bytes postmaster/static/js/utils.js | 23 ++++++++----- postmaster/templates/admins.html | 2 +- postmaster/templates/aliases.html | 2 +- postmaster/templates/base.html | 1 + postmaster/templates/configs.html | 2 +- postmaster/templates/domains.html | 2 +- postmaster/templates/logs.html | 2 +- postmaster/templates/spinner.html | 7 ++++ postmaster/templates/users.html | 2 +- 13 files changed, 86 insertions(+), 24 deletions(-) create mode 100644 postmaster/static/css/spinner.css delete mode 100644 postmaster/static/img/loader.gif create mode 100644 postmaster/templates/spinner.html diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index c1997a5..ca80af3 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -11,6 +11,9 @@ Features: * Supports Two-Factor Authentication on the backend [GH-169] +Improvements: + +* Replaced GIF spinner with a pure CSS spinner using CSS3 animations [GH-177]. ### v1.1.0 - A Hard Day's Night diff --git a/postmaster/static/css/spinner.css b/postmaster/static/css/spinner.css new file mode 100644 index 0000000..a5cd168 --- /dev/null +++ b/postmaster/static/css/spinner.css @@ -0,0 +1,55 @@ +/* Parent div for gradient */ +.spinnerParent { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(255, 255, 255, 0.6); +} + +/* Parent div for the circles */ +.spinner { + position: absolute; + left: 50%; + top: 50%; + width: 70px; + margin: 0px auto; +} + +/* Taken from http://tobiasahlin.com/spinkit/ */ + +.spinner > div { + width: 18px; + height: 18px; + background-color: #333; + border-radius: 100%; + display: inline-block; + -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both; + animation: sk-bouncedelay 1.4s infinite ease-in-out both; +} + +.spinner .bounce1 { + -webkit-animation-delay: -0.32s; + animation-delay: -0.32s; +} + +.spinner .bounce2 { + -webkit-animation-delay: -0.16s; + animation-delay: -0.16s; +} + +@-webkit-keyframes sk-bouncedelay { + 0%, 80%, 100% { -webkit-transform: scale(0) } + 40% { -webkit-transform: scale(1.0) } +} + +@keyframes sk-bouncedelay { + 0%, 80%, 100% { + -webkit-transform: scale(0); + transform: scale(0); + } 40% { + -webkit-transform: scale(1.0); + transform: scale(1.0); + } +} diff --git a/postmaster/static/css/styles.css b/postmaster/static/css/styles.css index 62233a3..63b1118 100644 --- a/postmaster/static/css/styles.css +++ b/postmaster/static/css/styles.css @@ -196,15 +196,6 @@ ul.pagination li.disabled a:hover { margin: auto; width: 60%; } - -.loader { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: rgba(255, 255, 255, 0.7) url('/static/img/loader.gif') no-repeat 50%; -} /* End of Manage Page CSS */ /* Only Domains Page CSS */ diff --git a/postmaster/static/img/loader.gif b/postmaster/static/img/loader.gif deleted file mode 100644 index e15844396f9b8c4d915f5cf595e2a22014a24426..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4176 zcmb`KYgAK*md8&{PI6984tX4MLVzSBA%TD-1Qd!GFefCDmzZGG)JGc-y3jHfEn2R% zy?K*FpaCNlZnXgcAMI7Ns8}Bp5GkUy$fDLdy)J5P2OaCs4!2{wy6V_j_v`I^nf-aM zz4qF__1}B{SCp9YmR3ms3GfpDJbU&G0Dxb9`Q`ro`_t3YGcz+!o;>;W*I$47>8Ii0 z;rjY|gTYWyQQ`OdZ{NPXu&^*bK3-m44ndGuES{a6ee~$jp+koT1_plo@yB2=n2?Z= zo16Rb#~0fL;fF$@aAIPD&*!5knv#;@@pwi@M+*xJaU5@KZ0zXh2!%odfuNMOh5e){z3!NI|%rly-WZ@OGAo6VM;ojo=-_Ta&Tr%#{G z&(DAN-FNBf>DATMFTM2A+}vD4L&Nil{eOk@8MDG@U0p<)joE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)O?V z28v&`I*Z?B&CWI*G&_x6S`sZ?S=;#8lpCd0?74%}VCN+-WSxt=z;(r0+QNizP8V+tDI8ic|b!Wg(ANO~_O93Qi3awQoi+bCm(?xG64ACMjXtYIfUBifj Y#`Dx6nd>%kIx0NRp)dR0fBtX$58}9UkpKVy diff --git a/postmaster/static/js/utils.js b/postmaster/static/js/utils.js index fdba53e..478c810 100644 --- a/postmaster/static/js/utils.js +++ b/postmaster/static/js/utils.js @@ -51,20 +51,25 @@ function changePage(obj, e) { // This manages the loading spinner for the table function manageSpinner(present) { - var spinner = $('div.loader'); + var spinner = $('div.spinner'); + var spinnerParent = $('div.spinnerParent'); if (present) { - if (spinner.length == 0) { - $('#dynamicTableDiv').prepend('
'); + // If the spinner isn't there, create it + if (spinnerParent.length == 0) { + var spinnerParentHtml = $('
', {'class': 'spinnerParent'}); + var spinnerHtml = $('
', {'class': 'spinner'}); + spinnerHtml.append($('
', {'class': 'bounce1'})); + spinnerHtml.append($('
', {'class': 'bounce2'})); + spinnerHtml.append($('
', {'class': 'bounce3'})); + spinnerParentHtml.append(spinnerHtml); + + $('#dynamicTableDiv').prepend(spinnerParentHtml); } } else { - // Remove the spinner but keep the gray background with opacity - spinner.css('background', 'rgba(255, 255, 255, 0.7)'); - // Remove the gray background with opacity after 300 ms - setTimeout(function () { - spinner.fadeOut('fast', function() { spinner.remove() }); - }, 400); + // Remove the spinner + spinner.fadeOut(500, function() { spinnerParent.remove(); }); } } diff --git a/postmaster/templates/admins.html b/postmaster/templates/admins.html index 5e9ca54..ab012af 100644 --- a/postmaster/templates/admins.html +++ b/postmaster/templates/admins.html @@ -16,7 +16,7 @@

PostMaster Administrators

-
+ {% include 'spinner.html' %} diff --git a/postmaster/templates/aliases.html b/postmaster/templates/aliases.html index d202491..322668e 100644 --- a/postmaster/templates/aliases.html +++ b/postmaster/templates/aliases.html @@ -16,7 +16,7 @@

Aliases

-
+ {% include 'spinner.html' %}
diff --git a/postmaster/templates/base.html b/postmaster/templates/base.html index 91375da..26536e0 100644 --- a/postmaster/templates/base.html +++ b/postmaster/templates/base.html @@ -14,6 +14,7 @@ + {% block head %}{% endblock %} diff --git a/postmaster/templates/configs.html b/postmaster/templates/configs.html index dbe7f3d..7e7c101 100644 --- a/postmaster/templates/configs.html +++ b/postmaster/templates/configs.html @@ -10,7 +10,7 @@

PostMaster Configurations

-
+ {% include 'spinner.html' %}
diff --git a/postmaster/templates/domains.html b/postmaster/templates/domains.html index c032010..25c19ed 100644 --- a/postmaster/templates/domains.html +++ b/postmaster/templates/domains.html @@ -16,7 +16,7 @@

Domains

-
+ {% include 'spinner.html' %}
diff --git a/postmaster/templates/logs.html b/postmaster/templates/logs.html index f606e9a..f90d060 100644 --- a/postmaster/templates/logs.html +++ b/postmaster/templates/logs.html @@ -10,7 +10,7 @@

PostMaster Recent Logs

-
+ {% include 'spinner.html' %}
diff --git a/postmaster/templates/spinner.html b/postmaster/templates/spinner.html new file mode 100644 index 0000000..4f4af81 --- /dev/null +++ b/postmaster/templates/spinner.html @@ -0,0 +1,7 @@ +
+
+
+
+
+
+
diff --git a/postmaster/templates/users.html b/postmaster/templates/users.html index 7c0eb27..9696f78 100644 --- a/postmaster/templates/users.html +++ b/postmaster/templates/users.html @@ -16,7 +16,7 @@

Users

-
+ {% include 'spinner.html' %}