Skip to content

Commit

Permalink
showing loading when waiting for the result to be saved
Browse files Browse the repository at this point in the history
  • Loading branch information
Miodec committed Jun 8, 2020
1 parent bc2d635 commit ee20551
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,8 @@ <h1>discord dot</h1>
<script src="js/userconfig.js?v=9"></script>
<script src="js/commandline.js?v=9"></script>
<script src="js/settings.js?v=9"></script>
<script src="js/account.js?v=9"></script>
<script src="js/script.js?v=9"></script>
<script src="js/account.js?v=10"></script>
<script src="js/script.js?v=10"></script>


</html>
4 changes: 2 additions & 2 deletions public/js/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ firebase.auth().onAuthStateChanged(function(user) {
if (user) {
// User is signed in.
updateAccountLoginButton();
$("#top #menu .account .icon").html('<i class="fas fa-fw fa-spin fa-circle-notch"></i>');
accountIconLoading(true);
db_getUserSnapshot().then(e => {
console.log('DB snapshot ready');
$("#top #menu .account .icon").html('<i class="fas fa-fw fa-user"></i>');
accountIconLoading(false);
});
var displayName = user.displayName;
var email = user.email;
Expand Down
14 changes: 12 additions & 2 deletions public/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,9 @@ function showResult(difficultyFailed = false) {
localPb = true;
}
})

accountIconLoading(true);
testCompleted({uid:firebase.auth().currentUser.uid,obj:completedEvent}).then(e => {
// showNotification('done');
accountIconLoading(false);
if(e.data === -1){
showNotification('Could not save result',3000);
}else if(e.data === 1 || e.data === 2){
Expand Down Expand Up @@ -1172,6 +1172,16 @@ function updateAccountLoginButton() {
}
}

function accountIconLoading(truefalse) {

if(truefalse){
$("#top #menu .account .icon").html('<i class="fas fa-fw fa-spin fa-circle-notch"></i>');
}else{
$("#top #menu .account .icon").html('<i class="fas fa-fw fa-user"></i>');
}

}

function toggleResultWordsDisplay(){
if(resultVisible){
if($("#words").hasClass('hidden')){
Expand Down

0 comments on commit ee20551

Please sign in to comment.