mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2025-06-17 03:45:25 +02:00
Slap that beta and cleanup
This commit is contained in:
@ -23,15 +23,6 @@ app.register_blueprint(blueprints.api.api, url_prefix="/api", template_folder="/
|
||||
app.register_blueprint(blueprints.user.user, url_prefix="/user", template_folder="/templates")
|
||||
app.register_blueprint(blueprints.embed.embed, url_prefix="/embed", template_folder="/templates")
|
||||
|
||||
@app.route("/set_username/<guildid>/<channelid>", methods=["GET"])
|
||||
def get_set_username(guildid, channelid):
|
||||
return render_template("set_username.html")
|
||||
|
||||
@app.route("/set_username/<guildid>/<channelid>", methods=["POST"])
|
||||
def post_set_username(guildid, channelid):
|
||||
session['username'] = request.form.get('username')
|
||||
return redirect(url_for("embed_get", guildid=guildid, channelid=channelid))
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
return render_template("index.html.j2")
|
||||
|
@ -127,4 +127,10 @@ float: left;
|
||||
|
||||
.modal {
|
||||
background-color: #546e7a;
|
||||
}
|
||||
|
||||
.betatag {
|
||||
font-variant: small-caps;
|
||||
font-size: 15px;
|
||||
color: #eceff1;
|
||||
}
|
@ -50,3 +50,11 @@ nav {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.betatag {
|
||||
font-variant: small-caps;
|
||||
font-size: 25px;
|
||||
border-radius: 50px;
|
||||
border: 2px solid #37474f;
|
||||
color: #eceff1;
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||
<script>
|
||||
function escapeHTML(unsafe) {
|
||||
return unsafe
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
}
|
||||
var lastSnowflake = undefined
|
||||
function updateMessages(channelid, aftersnowflake=null) {
|
||||
setTimeout(function() {
|
||||
$.ajax({
|
||||
url: "/api/Get_Channel_Messages",
|
||||
data: {
|
||||
channel_id: channelid,
|
||||
after: aftersnowflake
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data, status){
|
||||
data = data['j']
|
||||
for (i = data.length-1; i >= 0; i--) {
|
||||
item = data[i]
|
||||
$("#messagesview").append("<p>"+item['id'] + " " + item['timestamp'] + " " + item['author']['username'] + " " + escapeHTML(item['content']) + "</p>")
|
||||
lastSnowflake = item['id']
|
||||
|
||||
if($("#messagesview").scrollTop() + $("#messagesview").innerHeight() >= $("#messagesview")[0].scrollHeight - 160) {
|
||||
$('#messagesview').scrollTop($('#messagesview').prop("scrollHeight"));
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
updateMessages("140252024666062848", lastSnowflake)
|
||||
}
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
updateMessages("140252024666062848")
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div style="height: 95vh; overflow-y: auto;" id="messagesview"></div>
|
||||
|
||||
<div style="height: 5vh;">
|
||||
<input type="text" id="messagebox" style="height:100%; width:100%; font-size:15px;">
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var channelid = "140252024666062848"
|
||||
$('#messagebox').bind("enterKey",function(e){
|
||||
var content = $('#messagebox').val();
|
||||
$('#messagebox').val('')
|
||||
$.ajax({
|
||||
url: "/api/Create_Message",
|
||||
method: "post",
|
||||
data: {
|
||||
channel_id: channelid,
|
||||
content: content
|
||||
},
|
||||
dataType: "json"
|
||||
})
|
||||
});
|
||||
$('#messagebox').keyup(function(e){
|
||||
if(e.keyCode == 13)
|
||||
{
|
||||
var content = $('#messagebox').val();
|
||||
if (/\S/.test(content)) {
|
||||
$(this).trigger("enterKey");
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -18,7 +18,7 @@
|
||||
<div class="nav-wrapper">
|
||||
<a href="#" data-activates="guild-nav" class="button-collapse" id="guild-btn"><i class="material-icons">menu</i></a>
|
||||
<div class="container">
|
||||
<a href="#" class="brand-logo"><b>Titan</b>Embeds</a>
|
||||
<a href="{{ url_for("index") }}" target="_blank" class="brand-logo"><b>Titan</b>Embeds <span class="betatag">BETA</span></a>
|
||||
</div>
|
||||
<a href="#" data-activates="members-nav" class="button-collapse right" id="members-btn"><i class="material-icons">person</i></a>
|
||||
</div>
|
||||
@ -85,7 +85,7 @@
|
||||
<footer class="footer">
|
||||
<div class="footercontainer">
|
||||
<div class="currentuserchip left" id="nameplate">
|
||||
<div class="left"><img id="currentuserimage" src="https://cdn.discordapp.com/icons/213459805048668160/14aa7c0ad94e3c80d2eeef3a83cae1c1.jpg" class="circle left currentuserimage" style="display: none;"></div>
|
||||
<div class="left"><img id="currentuserimage" src="" class="circle left currentuserimage" style="display: none;"></div>
|
||||
<div id="currentusername" class="currentusername left">Titan#0001</div>
|
||||
</div>
|
||||
<div id="messageboxouter" class="input-field inline"><textarea placeholder="Enter message" id="messagebox" type="text" class="materialize-textarea" rows="1"></textarea></div>
|
||||
|
@ -1,21 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<form method="post">
|
||||
<h1>Set username:<h1>
|
||||
<input type="text" name="username" id="username" required>
|
||||
</form>
|
||||
<script>
|
||||
$("input").keypress(function(event) {
|
||||
var content = $('#username').val();
|
||||
if (event.which == 13 && /\S/.test(content)) {
|
||||
event.preventDefault();
|
||||
$("form").submit();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<body>
|
||||
</html>
|
@ -24,9 +24,9 @@
|
||||
|
||||
<nav>
|
||||
<div class="nav-wrapper container">
|
||||
<a href="/" class="brand-logo"><b>Titan</b>Embeds</a>
|
||||
<a href="/" class="brand-logo"><b>Titan</b>Embeds <span class="betatag">BETA</span></a>
|
||||
<ul id="nav-mobile" class="right">
|
||||
<li><a href="#" class="waves-effect btn z-depth-3">Visit Us!</a></li> <!-- TODO: Add discord guild invite -->
|
||||
<li><a href="{{url_for("embed.guild_embed", guild_id="295085744249110529")}}" class="waves-effect btn z-depth-3">Visit Us!</a></li> <!-- TODO: Add discord guild invite -->
|
||||
{% if session['unauthenticated'] is defined and not session['unauthenticated'] %}
|
||||
<li><a id="menu_drop" data-activates="menu_dropdown" class="waves-effect btn z-depth-3 btn-floating dropdown-button avatar_menu" style='background-image: url(" {{ session['avatar'] }} ")'></a></li>
|
||||
{% else %}
|
||||
|
Reference in New Issue
Block a user