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,22 +76,33 @@
<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>
<p class="flow-text">Please choose one of the following methods to authenticate!</p> <div class="row valign-wrapper">
<div class="progress" id="loginProgress" style="display: none;"> <div class="col m3 s12" style="background-color: #455a64; padding-top: 10px; padding-bottom: 10px;">
<div class="indeterminate"></div> {% if guild['icon'] %}
</div> <img class="circle" src="{{ generate_guild_icon( guild['id'], guild['icon'] ) }}">
<div class="row"> {% endif %}
<div class="col s12 m4"> <p id="modal_guildname"><strong>{{ guild['name'] }}</strong></p>
<a id="discordlogin_btn" href="{{ url_for("embed.login_discord", _external=True) }}" class="waves-effect waves-light btn-large" target="_blank">Discord Login</a> <a id="modal_invite_btn" class="waves-effect waves-light btn" target="_blank">discord.gg</a>
<p>*You will be invited into this server.</p>
</div> </div>
{% if unauth_enabled %} <div class="col m9 s12">
<div class="col s12 m8"> <p class="flow-text">Please choose one of the following methods to authenticate!</p>
<p>Of course, you also have the option to login by picking a temporary username for your current browsing session.</p> <div class="progress" id="loginProgress" style="display: none;">
<input id="custom_username_field" type="text" {% if session.unauthenticated and session.username %}value="{{ session['username'] }}"{% endif %}> <div class="indeterminate"></div>
<label class="active" for="custom_username_field">Username (Hit ENTER/RETURN key to confirm)</label> </div>
<div class="row">
<div class="col s12 m4">
<a id="discordlogin_btn" href="{{ url_for("embed.login_discord", _external=True) }}" class="waves-effect waves-light btn-large" target="_blank">Discord Login</a>
<p>*You will be invited into this server.</p>
</div>
{% if unauth_enabled %}
<div class="col s12 m8">
<p>Of course, you also have the option to login by picking a temporary username for your current browsing session.</p>
<input id="custom_username_field" type="text" {% if session.unauthenticated and session.username %}value="{{ session['username'] }}"{% endif %}>
<label class="active" for="custom_username_field">Username (Hit ENTER/RETURN key to confirm)</label>
</div>
{% endif %}
</div>
</div> </div>
{% endif %}
</div> </div>
</div> </div>
</div> </div>