Give a notice for priming the embed

This commit is contained in:
Jeremy Zhang 2017-05-24 03:20:23 +00:00
parent ecfa8a0ed7
commit cd3864a6a4
2 changed files with 34 additions and 17 deletions

View File

@ -80,6 +80,31 @@
} }
$(function() { $(function() {
$("#focusmodal").modal({
dismissible: true,
opacity: .5,
inDuration: 400,
outDuration: 400,
startingTop: "4%",
endingTop: "10%",
});
$("#focusmodal").modal("open");
if (document.hasFocus()) {
primeEmbed();
}
$(window).focus(function() {
if (!has_already_been_focused) {
primeEmbed();
}
});
});
function primeEmbed() {
$("#focusmodal").modal("close");
has_already_been_focused = true;
$("#loginmodal").modal({ $("#loginmodal").modal({
dismissible: false, // Modal can be dismissed by clicking outside of the modal dismissible: false, // Modal can be dismissed by clicking outside of the modal
opacity: .5, // Opacity of modal background opacity: .5, // Opacity of modal background
@ -90,21 +115,6 @@
} }
); );
$('#loginmodal').modal('open'); $('#loginmodal').modal('open');
if (document.hasFocus()) {
has_already_been_focused = true;
primeEmbed();
}
$(window).focus(function() {
if (!has_already_been_focused) {
has_already_been_focused = true;
primeEmbed();
}
});
});
function primeEmbed() {
lock_login_fields(); lock_login_fields();
var guild = query_guild(); var guild = query_guild();
@ -204,7 +214,7 @@
guild_members[member["hoist-role"]["id"]] = {}; guild_members[member["hoist-role"]["id"]] = {};
guild_members[member["hoist-role"]["id"]]["name"] = member["hoist-role"]["name"]; guild_members[member["hoist-role"]["id"]]["name"] = member["hoist-role"]["name"];
guild_members[member["hoist-role"]["id"]]["members"] = []; guild_members[member["hoist-role"]["id"]]["members"] = [];
guild_members[member["hoist-role"]["id"]]["position"] = member["hoist-role"]["position"] guild_members[member["hoist-role"]["id"]]["position"] = member["hoist-role"]["position"];
} }
guild_members[member["hoist-role"]["id"]]["members"].push(member); guild_members[member["hoist-role"]["id"]]["members"].push(member);
} else { } else {
@ -218,7 +228,7 @@
} }
} }
var guild_members_arr = []; var guild_members_arr = [];
for (key in guild_members) { for (var key in guild_members) {
guild_members_arr.push(guild_members[key]); guild_members_arr.push(guild_members[key]);
} }
guild_members_arr.sort(function(a, b) { guild_members_arr.sort(function(a, b) {

View File

@ -95,6 +95,13 @@
</div> </div>
</div> </div>
</div> </div>
<div id="focusmodal" class="modal">
<div class="modal-content">
<h4>This embed is currently unfocused.</h4>
<p class="flow-text">Please click this part of the page to initialize the embed.</p>
</div>
</div>
<footer id="footer" class="footer"> <footer id="footer" class="footer">
<div id="fetching-indicator" class="preloader-wrapper small active" style="display: none;"> <div id="fetching-indicator" class="preloader-wrapper small active" style="display: none;">