From 22a906f259a53eda72ee2155201b27dc698a7fa8 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Wed, 26 Apr 2017 00:30:36 -0700 Subject: [PATCH] Loading at the begining --- titanembeds/static/js/embed.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/titanembeds/static/js/embed.js b/titanembeds/static/js/embed.js index 0858540..5139ebe 100644 --- a/titanembeds/static/js/embed.js +++ b/titanembeds/static/js/embed.js @@ -87,14 +87,16 @@ } ); + $('#loginmodal').modal('open'); + lock_login_fields(); + var guild = query_guild(); guild.fail(function() { - $('#loginmodal').modal('open'); + unlock_login_fields(); }); guild.done(function(data) { initialize_embed(data); - //$('#loginmodal').modal('open'); }); }); @@ -115,15 +117,17 @@ } function initialize_embed(guildobj) { - $('#loginmodal').modal('close'); - unlock_login_fields(); if (guildobj === undefined) { var guild = query_guild(); guild.done(function(data) { prepare_guild(data); + $('#loginmodal').modal('close'); + unlock_login_fields(); }); } else { prepare_guild(guildobj); + $('#loginmodal').modal('close'); + unlock_login_fields(); } } @@ -399,6 +403,7 @@ return; } currently_fetching = true; + times_fetched += 1; var channel_id = selected_channel; var fet; var jumpscroll; @@ -449,7 +454,6 @@ }); fet.always(function() { currently_fetching = false; - times_fetched += 1; }); }