From a767e1128881cd79f9e943e72fcfb0b680d5bdff Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sun, 9 Apr 2017 10:49:28 -0700 Subject: [PATCH] Responsive message box, finally with CSS --- titanembeds/static/css/embedstyle.css | 8 ++++++++ titanembeds/static/js/embed.js | 12 ------------ titanembeds/templates/embed.html.j2 | 4 ++-- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/titanembeds/static/css/embedstyle.css b/titanembeds/static/css/embedstyle.css index 51d59ce..e76a490 100644 --- a/titanembeds/static/css/embedstyle.css +++ b/titanembeds/static/css/embedstyle.css @@ -5,6 +5,7 @@ color: white; main { min-height: calc(100vh - 80px); +overflow-x: hidden; } footer { @@ -112,6 +113,13 @@ color: #90a4ae; width: 100%; position: relative; margin: 10px; +white-space: nowrap; +overflow: hidden; +} + +#messageboxouter { + width: 100%; + overflow: hidden; } .currentuserchip { diff --git a/titanembeds/static/js/embed.js b/titanembeds/static/js/embed.js index d6a4943..0d199f2 100644 --- a/titanembeds/static/js/embed.js +++ b/titanembeds/static/js/embed.js @@ -23,12 +23,6 @@ function element_in_view(element, fullyInView) { } } -function resize_messagebox() { - var namebox_width = $("#nameplate").outerWidth(true); - var screen_width = $(document).width(); - $("#messageboxouter").width(screen_width - namebox_width - 40); -} - function query_guild() { var funct = $.ajax({ dataType: "json", @@ -79,7 +73,6 @@ function post(channel_id, content) { } $(function(){ - resize_messagebox(); $("#loginmodal").modal({ dismissible: false, // Modal can be dismissed by clicking outside of the modal opacity: .5, // Opacity of modal background @@ -346,7 +339,6 @@ function update_embed_userchip(authenticated, avatar, username, userid) { $("#currentuserimage").hide(); $("#currentusername").text(username + "#" + userid); } - resize_messagebox(); } $("#discordlogin_btn").click(function() { @@ -408,10 +400,6 @@ $("#messagebox").keyup(function(event){ } }); -$(window).resize(function() { - resize_messagebox(); -}); - $('#guild-btn').sideNav({ menuWidth: 300, // Default is 300 edge: 'left', // Choose the horizontal origin diff --git a/titanembeds/templates/embed.html.j2 b/titanembeds/templates/embed.html.j2 index 9b8f4a4..08ce0e5 100644 --- a/titanembeds/templates/embed.html.j2 +++ b/titanembeds/templates/embed.html.j2 @@ -88,8 +88,8 @@ -