Basic server information and discord.gg btn

This commit is contained in:
Jeremy Zhang 2017-05-24 05:03:48 +00:00
parent 029bcff59d
commit bb35d3700b
2 changed files with 38 additions and 14 deletions

View File

@ -80,6 +80,14 @@
return funct.promise(); return funct.promise();
} }
function discord_embed() {
var funct = $.ajax({
dataType: "json",
url: "https://discordapp.com/api/guilds/" + guild_id + "/widget.json",
});
return funct.promise();
}
$(function() { $(function() {
$("#focusmodal").modal({ $("#focusmodal").modal({
dismissible: true, dismissible: true,
@ -106,6 +114,11 @@
$("#focusmodal").modal("close"); $("#focusmodal").modal("close");
has_already_been_focused = true; has_already_been_focused = true;
var dembed = discord_embed();
dembed.done(function (data) {
$("#modal_invite_btn").attr("href", data.instant_invite);
});
$("#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

View File

@ -76,6 +76,15 @@
<div id="loginmodal" class="modal"> <div id="loginmodal" class="modal">
<div class="modal-content"> <div class="modal-content">
<h4>{{ login_greeting }}</h4> <h4>{{ login_greeting }}</h4>
<div class="row valign-wrapper">
<div class="col m3 s12" style="background-color: #455a64; padding-top: 10px; padding-bottom: 10px;">
{% if guild['icon'] %}
<img class="circle" src="{{ generate_guild_icon( guild['id'], guild['icon'] ) }}">
{% endif %}
<p id="modal_guildname"><strong>{{ guild['name'] }}</strong></p>
<a id="modal_invite_btn" class="waves-effect waves-light btn" target="_blank">discord.gg</a>
</div>
<div class="col m9 s12">
<p class="flow-text">Please choose one of the following methods to authenticate!</p> <p class="flow-text">Please choose one of the following methods to authenticate!</p>
<div class="progress" id="loginProgress" style="display: none;"> <div class="progress" id="loginProgress" style="display: none;">
<div class="indeterminate"></div> <div class="indeterminate"></div>
@ -95,6 +104,8 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
<div id="focusmodal" class="modal"> <div id="focusmodal" class="modal">
<div class="modal-content"> <div class="modal-content">