USO page: animate the update button's spinner on consequent clicks

This commit is contained in:
tophf 2017-11-23 12:23:12 +03:00
parent d97337ded7
commit 3fe3f08407

View File

@ -257,10 +257,17 @@ function saveStyleCode(message, name, addProps) {
}); });
function enableUpdateButton(state) { function enableUpdateButton(state) {
const important = s => s.replace(/;/g, '!important;');
const button = document.getElementById('update_style_button'); const button = document.getElementById('update_style_button');
if (button) { if (button) {
button.style.cssText = state ? '' : button.style.cssText = state ? '' : important('pointer-events: none; opacity: .35;');
'pointer-events: none !important; opacity: .25 !important;'; 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);')));
}
}
} }
} }
} }