From 3fe3f08407360eaf4dcec9a67c6b6ca4102fa97b Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 23 Nov 2017 12:23:12 +0300 Subject: [PATCH] USO page: animate the update button's spinner on consequent clicks --- content/install.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/content/install.js b/content/install.js index 9dd0063e..74c90a48 100644 --- a/content/install.js +++ b/content/install.js @@ -257,10 +257,17 @@ function saveStyleCode(message, name, addProps) { }); function enableUpdateButton(state) { + const important = s => s.replace(/;/g, '!important;'); const button = document.getElementById('update_style_button'); if (button) { - button.style.cssText = state ? '' : - 'pointer-events: none !important; opacity: .25 !important;'; + button.style.cssText = state ? '' : important('pointer-events: none; opacity: .35;'); + const icon = button.querySelector('img[src*=".svg"]'); + if (icon) { + icon.style.cssText = state ? '' : important('transition: transform 5s; transform: rotate(0);'); + if (state) { + setTimeout(() => (icon.style.cssText += important('transform: rotate(10turn);'))); + } + } } } }