Merge branch 'LQDJudge:master' into master

This commit is contained in:
Bao Le 2023-10-05 19:58:52 +08:00 committed by GitHub
commit e49eb1ab2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 214 additions and 237 deletions

View file

@ -485,6 +485,9 @@ META_REMOTE_ADDRESS_KEY = "REMOTE_ADDR"
DEFAULT_AUTO_FIELD = "django.db.models.AutoField" DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
# Chunk upload
CHUNK_UPLOAD_DIR = "/tmp/chunk_upload_tmp"
try: try:
with open(os.path.join(os.path.dirname(__file__), "local_settings.py")) as f: with open(os.path.join(os.path.dirname(__file__), "local_settings.py")) as f:
exec(f.read(), globals()) exec(f.read(), globals())

View file

@ -168,7 +168,7 @@ class CommentedDetailView(TemplateResponseMixin, SingleObjectMixin, View):
) )
def _get_queryset(self, target_comment): def _get_queryset(self, target_comment):
if target_comment != None: if target_comment:
queryset = target_comment.get_descendants(include_self=True) queryset = target_comment.get_descendants(include_self=True)
queryset = ( queryset = (
queryset.select_related("author__user") queryset.select_related("author__user")
@ -217,11 +217,11 @@ class CommentedDetailView(TemplateResponseMixin, SingleObjectMixin, View):
context["has_comments"] = queryset.exists() context["has_comments"] = queryset.exists()
context["comment_lock"] = self.is_comment_locked() context["comment_lock"] = self.is_comment_locked()
context["comment_list"] = queryset context["comment_list"] = list(queryset)
context["vote_hide_threshold"] = settings.DMOJ_COMMENT_VOTE_HIDE_THRESHOLD context["vote_hide_threshold"] = settings.DMOJ_COMMENT_VOTE_HIDE_THRESHOLD
if queryset.exists(): if queryset.exists():
context["comment_root_id"] = queryset[0].id context["comment_root_id"] = context["comment_list"][0].id
else: else:
context["comment_root_id"] = 0 context["comment_root_id"] = 0
context["comment_parent_none"] = 1 context["comment_parent_none"] = 1
@ -234,4 +234,5 @@ class CommentedDetailView(TemplateResponseMixin, SingleObjectMixin, View):
context["limit"] = DEFAULT_OFFSET context["limit"] = DEFAULT_OFFSET
context["comment_count"] = comment_count context["comment_count"] = comment_count
context["profile"] = self.request.profile
return context return context

View file

@ -35,7 +35,7 @@ def save_upload(f, path):
# pass callback function to post_upload # pass callback function to post_upload
def handle_upload(f, fileattrs, upload_dir, post_upload=None): def handle_upload(f, fileattrs, upload_dir, post_upload=None):
chunks_dir = os.path.join(tempfile.gettempdir(), "chunk_upload_tmp") chunks_dir = settings.CHUNK_UPLOAD_DIR
if not os.path.exists(os.path.dirname(chunks_dir)): if not os.path.exists(os.path.dirname(chunks_dir)):
os.makedirs(os.path.dirname(chunks_dir)) os.makedirs(os.path.dirname(chunks_dir))
chunked = False chunked = False

View file

@ -15,12 +15,11 @@ from django.http import (
HttpResponseBadRequest, HttpResponseBadRequest,
HttpResponseForbidden, HttpResponseForbidden,
) )
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404, render
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from django.views.decorators.http import require_POST from django.views.decorators.http import require_POST
from django.views.generic import DetailView, UpdateView from django.views.generic import DetailView, UpdateView
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.template import loader
from reversion import revisions from reversion import revisions
from reversion.models import Version from reversion.models import Version
@ -42,11 +41,6 @@ __all__ = [
@login_required @login_required
# def get_more_reply(request, id):
# queryset = Comment.get_pk(id)
def vote_comment(request, delta): def vote_comment(request, delta):
if abs(delta) != 1: if abs(delta) != 1:
return HttpResponseBadRequest( return HttpResponseBadRequest(
@ -156,6 +150,7 @@ def get_comments(request, limit=10):
revisions=Count("versions", distinct=True), revisions=Count("versions", distinct=True),
)[offset : offset + limit] )[offset : offset + limit]
) )
profile = None
if request.user.is_authenticated: if request.user.is_authenticated:
profile = request.profile profile = request.profile
queryset = queryset.annotate( queryset = queryset.annotate(
@ -164,10 +159,11 @@ def get_comments(request, limit=10):
new_offset = offset + min(len(queryset), limit) new_offset = offset + min(len(queryset), limit)
comment_html = loader.render_to_string( return render(
request,
"comments/content-list.html", "comments/content-list.html",
{ {
"request": request, "profile": profile,
"comment_root_id": comment_root_id, "comment_root_id": comment_root_id,
"comment_list": queryset, "comment_list": queryset,
"vote_hide_threshold": settings.DMOJ_COMMENT_VOTE_HIDE_THRESHOLD, "vote_hide_threshold": settings.DMOJ_COMMENT_VOTE_HIDE_THRESHOLD,
@ -181,8 +177,6 @@ def get_comments(request, limit=10):
}, },
) )
return HttpResponse(comment_html)
def get_show_more(request): def get_show_more(request):
return get_comments(request) return get_comments(request)

View file

@ -182,6 +182,9 @@ header {
cursor: pointer; cursor: pointer;
padding: 3.5px; padding: 3.5px;
} }
img {
border-radius: 50%;
}
} }
#nav-shadow { #nav-shadow {
@ -539,7 +542,11 @@ math {
@media (max-width: 799px) { @media (max-width: 799px) {
#navigation { #navigation {
height: 36px; height: $navbar_height_mobile;
}
#content {
margin-top: $navbar_height_mobile;
} }
#navicon { #navicon {
@ -637,11 +644,11 @@ math {
} }
#chat-icon { #chat-icon {
color: $theme_color; color: darkgreen;
} }
#chat-icon:hover { #chat-icon:hover {
color: green; color: $theme_color;
} }
#nav-lang-icon { #nav-lang-icon {

View file

@ -52,11 +52,15 @@
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
flex-grow: 1; flex-grow: 1;
padding-left: 0.5em;
} }
#chat-input { #chat-input {
color: black; color: black;
border: 2px solid #e4a81c; border: 2px solid black;
}
#chat-input::placeholder {
color: grey;
} }
#chat-online-content { #chat-online-content {
padding: 0; padding: 0;
@ -74,14 +78,14 @@
#chat-container { #chat-container {
display: flex; display: flex;
width: 100%; width: 100%;
height: calc(100vh - 3em); height: calc(100vh - $navbar_height);
border: 1px solid #ccc; border: 1px solid #ccc;
/*border-radius: 0 4px 0 0;*/ /*border-radius: 0 4px 0 0;*/
border-bottom: 0; border-bottom: 0;
} }
#chat-online { #chat-online {
margin: 0; margin: 0;
width: 35%; width: 30%;
} }
#chat-area { #chat-area {
flex-grow: 1; flex-grow: 1;
@ -91,12 +95,12 @@
font-family: "Noto Sans", Arial, "Lucida Grande", sans-serif; font-family: "Noto Sans", Arial, "Lucida Grande", sans-serif;
} }
.info-pic { .info-pic {
height: 100%; height: 95%;
} }
.info-name { .info-name {
margin-left: 10px; margin-left: 10px;
font-size: 2em; font-size: 1.8em;
font-weight: bold !important; font-weight: bold !important;
display: flex; display: flex;
align-items: center; align-items: center;
@ -111,21 +115,6 @@
position: relative; position: relative;
z-index: 100; z-index: 100;
} }
#refresh-button {
padding: 0;
margin-left: auto;
margin-right: 0.3em;
background: transparent;
border: none;
height: 1.5em;
width: 1.5em;
}
#refresh-button:hover {
background: lightgreen;
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
transition: 1.5s ease-in-out;
}
.status-pic { .status-pic {
height: 32px; height: 32px;
width: 32px; width: 32px;
@ -135,6 +124,7 @@
position: relative; position: relative;
display: inline-flex; display: inline-flex;
flex: 0 0 auto; flex: 0 0 auto;
align-items: center;
} }
.status-circle { .status-circle {
position: absolute; position: absolute;
@ -166,11 +156,11 @@
} }
.message-text { .message-text {
padding: 0.4em 0.6em 0.5em; padding: 0.4em 0.6em 0.5em;
border-radius: 15px; border-radius: 20px;
max-width: 70%; max-width: 70%;
width: fit-content; width: fit-content;
font-size: 1.05rem; font-size: 1rem;
line-height: 1.3; line-height: 1.2;
} }
.message-text-other { .message-text-other {
background: #eeeeee; background: #eeeeee;
@ -181,10 +171,11 @@
color: white; color: white;
} }
.chat-input-icon { .chat-input-icon {
color: $theme_color; color: white;
background-color: #3c8262;
} }
.chat-input-icon:hover { .chat-input-icon:hover {
background: lightgray; background: #57b28b;
} }
.chat { .chat {
.active-span { .active-span {
@ -193,12 +184,16 @@
} }
.unread-count { .unread-count {
float: right;
color: white; color: white;
background-color: darkcyan; background-color: darkcyan;
border-radius: 2px; border-radius: 50%;
padding: 0 0.5em; align-self: center;
align-self: flex-end; flex: 0 0 1.25rem;
height: 1.25rem;
font-size: smaller;
display: flex;
align-items: center;
justify-content: center;
} }
#setting-content { #setting-content {
display: none; display: none;
@ -224,6 +219,7 @@
@media (max-width: 799px) { @media (max-width: 799px) {
#chat-area { #chat-area {
height: calc(100vh - 120px); height: calc(100vh - $navbar_height_mobile);
max-height: -webkit-fill-available;
} }
} }

View file

@ -386,6 +386,11 @@ function onWindowReady() {
}); });
}); });
$('a').click(function() { $('a').click(function() {
var href = $(this).attr('href');
if (!href || href === '#' || href.startsWith("javascript")) {
return;
}
$("#loading-bar").show(); $("#loading-bar").show();
$("#loading-bar").animate({ width: "100%" }, 2000, function() { $("#loading-bar").animate({ width: "100%" }, 2000, function() {
$(this).hide().css({ width: 0}); $(this).hide().css({ width: 0});

View file

@ -1,7 +1,7 @@
@import "vars"; @import "vars";
.list-contest { .list-contest {
box-shadow: 0px 4px 8px rgba(4, 83, 67, 0.2), 0px 6px 20px rgba(4, 83, 67, 0.19); box-shadow: 0px 1px 2px lightgrey, 0px 1px 5px lightgrey;
border-radius: 15px; border-radius: 15px;
padding: 20px; padding: 20px;
margin-bottom: 20px; margin-bottom: 20px;

View file

@ -1712,10 +1712,10 @@ noscript #noscript {
color: rgb(178, 171, 161); color: rgb(178, 171, 161);
} }
#chat-icon { #chat-icon {
color: rgb(249, 146, 97); color: rgb(200, 196, 189);
} }
#chat-icon:hover { #chat-icon:hover {
color: rgb(114, 255, 114); color: rgb(249, 146, 97);
} }
#nav-lang-icon { #nav-lang-icon {
color: rgb(51, 125, 255); color: rgb(51, 125, 255);
@ -2922,8 +2922,8 @@ a.voted {
color: rgb(152, 143, 129); color: rgb(152, 143, 129);
} }
.list-contest { .list-contest {
box-shadow: rgba(3, 66, 54, 0.2) 0px 4px 8px, box-shadow: rgb(49, 53, 55) 0px 1px 2px,
rgba(3, 66, 54, 0.19) 0px 6px 20px; rgb(49, 53, 55) 0px 1px 5px;
} }
#contest-calendar th { #contest-calendar th {
border-bottom-color: rgb(62, 68, 70); border-bottom-color: rgb(62, 68, 70);
@ -3058,7 +3058,13 @@ a.voted {
} }
#chat-input { #chat-input {
color: rgb(232, 230, 227); color: rgb(232, 230, 227);
border-color: rgb(159, 117, 19); border-color: rgb(140, 130, 115);
}
#chat-input::-webkit-input-placeholder {
color: rgb(152, 143, 129);
}
#chat-input::placeholder {
color: rgb(152, 143, 129);
} }
.selected-status-row { .selected-status-row {
background-color: rgb(49, 53, 55); background-color: rgb(49, 53, 55);
@ -3077,15 +3083,6 @@ a.voted {
#chat-info { #chat-info {
box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 3px; box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 3px;
} }
#refresh-button {
background-image: initial;
background-color: transparent;
border-color: initial;
}
#refresh-button:hover {
background-image: initial;
background-color: rgb(40, 111, 17);
}
.status-circle { .status-circle {
stroke: rgb(232, 230, 227); stroke: rgb(232, 230, 227);
} }
@ -3104,11 +3101,12 @@ a.voted {
color: rgb(232, 230, 227); color: rgb(232, 230, 227);
} }
.chat-input-icon { .chat-input-icon {
color: rgb(249, 146, 97); color: rgb(232, 230, 227);
background-color: rgb(48, 104, 78);
} }
.chat-input-icon:hover { .chat-input-icon:hover {
background-image: initial; background-image: initial;
background-color: rgb(49, 53, 55); background-color: rgb(62, 136, 112);
} }
.chat .active-span { .chat .active-span {
color: rgb(169, 162, 151); color: rgb(169, 162, 151);
@ -3873,64 +3871,11 @@ mjx-assistive-mml {
mjx-stretchy-v > mjx-ext { mjx-stretchy-v > mjx-ext {
border-color: transparent; border-color: transparent;
} }
.noUi-target, .recently-attempted ul {
.noUi-target * { list-style-image: initial;
-webkit-tap-highlight-color: transparent;
} }
.noUi-target { .organization-row:last-child {
background-image: initial; border-bottom-color: initial;
background-color: rgb(27, 29, 30);
border-color: rgb(60, 65, 68);
box-shadow: rgb(32, 35, 37) 0px 1px 1px inset,
rgb(62, 68, 70) 0px 3px 6px -5px;
}
.noUi-connect {
background-image: initial;
background-color: rgb(50, 147, 140);
box-shadow: rgba(38, 42, 43, 0.45) 0px 0px 3px inset;
}
.noUi-handle {
border-color: rgb(59, 64, 66);
background-image: initial;
background-color: rgb(24, 26, 27);
box-shadow: rgb(24, 26, 27) 0px 0px 1px inset,
rgb(35, 38, 40) 0px 1px 7px inset,
rgb(62, 68, 70) 0px 3px 6px -3px;
}
.noUi-active {
box-shadow: rgb(24, 26, 27) 0px 0px 1px inset,
rgb(43, 47, 49) 0px 1px 7px inset,
rgb(62, 68, 70) 0px 3px 6px -3px;
}
.noUi-handle::after,
.noUi-handle::before {
background-image: initial;
background-color: rgb(38, 41, 42);
}
[disabled] .noUi-connect {
background-image: initial;
background-color: rgb(64, 69, 72);
}
.noUi-pips {
color: rgb(168, 160, 149);
}
.noUi-value-sub {
color: rgb(200, 195, 188);
}
.noUi-marker {
background-image: initial;
background-color: rgb(53, 57, 59);
}
.noUi-marker-large,
.noUi-marker-sub {
background-image: initial;
background-color: rgb(72, 78, 81);
}
.noUi-tooltip {
border-color: rgb(59, 64, 66);
background-image: initial;
background-color: rgb(24, 26, 27);
color: rgb(232, 230, 227);
} }
/* Override Style */ /* Override Style */

View file

@ -12,3 +12,4 @@ $table_header_rounding: 6px;
$monospace-fonts: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace; $monospace-fonts: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace;
$navbar_height: 50px; $navbar_height: 50px;
$navbar_height_mobile: 36px;

View file

@ -59,17 +59,8 @@
{% block body %} {% block body %}
<div class="chat"> <div class="chat">
<div id="mobile" class="tabs">
<ul>
<li id="chat-tab" class="tab active"><a href="#">
<i class="tab-icon fa fa-comments"></i> {{ _('Chat') }}
</a></li>
<li id="online-tab" class="tab"><a href="#"><i class="tab-icon fa fa-wifi"></i> {{ _('Online Users') }}</a></li>
</ul>
</div>
<div id="chat-container"> <div id="chat-container">
<div id="chat-online" class="chat-right-panel sidebox"> <div id="chat-online" class="chat-left-panel sidebox">
<div id="chat-online-content"> <div id="chat-online-content">
<div id="search-container"> <div id="search-container">
<form id="chat-search-form" name="form" action="{{ url('get_or_create_room') }}" method="post"> <form id="chat-search-form" name="form" action="{{ url('get_or_create_room') }}" method="post">
@ -83,7 +74,7 @@
</div> </div>
</div> </div>
</div> </div>
<div id="chat-area" class="chat-left-panel"> <div id="chat-area" class="chat-right-panel">
<div id="chat-info"> <div id="chat-info">
{% include 'chat/user_online_status.html' %} {% include 'chat/user_online_status.html' %}
</div> </div>
@ -98,7 +89,7 @@
<div class="chat-input-icon" id="emoji-button" href="#" title="{{_('Emoji')}}"><i class="icofont-slightly-smile"></i> <div class="chat-input-icon" id="emoji-button" href="#" title="{{_('Emoji')}}"><i class="icofont-slightly-smile"></i>
</div> </div>
<div class="chat-input-icon" id="submit-button"> <div class="chat-input-icon" id="submit-button">
<i class="fa fa-play"></i> <i class="fa fa-arrow-right"></i>
</div> </div>
</div> </div>
<div class="tooltip" role="tooltip"> <div class="tooltip" role="tooltip">

View file

@ -6,6 +6,7 @@
#content { #content {
padding-top: 0; padding-top: 0;
margin-bottom: 0;
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
@ -57,7 +58,7 @@
.profile-pic { .profile-pic {
height: 2.6em; height: 2.6em;
width: 2.6em; width: 2.6em;
border-radius: 0.3em; border-radius: 50%;
margin-top: 0.1em; margin-top: 0.1em;
float: left; float: left;
} }
@ -106,6 +107,16 @@
#setting { #setting {
position: relative; position: relative;
} }
#setting-button {
height: 2.3em;
width: 2.5em;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
padding-top: 2px;
}
.status-user { .status-user {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -122,15 +133,20 @@
align-items: center; align-items: center;
gap: 1em; gap: 1em;
} }
::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
text-align: left;
}
#chat-input { #chat-input {
padding: 10px 20px; padding: 10px 20px;
font-size: 16px; font-size: 16px;
border-radius: 20px; border-radius: 100px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
transition: box-shadow 0.3s ease-in-out; transition: box-shadow 0.3s ease-in-out;
width: 80%; width: 80%;
resize: none; resize: none;
height: 100%; height: 80%;
max-height: 200px;
overflow-y: auto;
} }
#chat-input:focus { #chat-input:focus {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
@ -162,11 +178,13 @@
stroke-width: 1; stroke-width: 1;
} }
.info-pic { .info-pic {
border-radius: 5px; border-radius: 50%;
margin-left: 1em;
} }
#chat-info { #chat-info {
height: 3em; height: 3em;
padding-left: 0.75em;
display: flex;
align-items: center;
} }
@media (min-width: 800px) { @media (min-width: 800px) {
@ -175,10 +193,10 @@
overflow:hidden; overflow:hidden;
} }
#chat-input-container { #chat-input-container {
padding-left: 5%; padding-left: 3%;
} }
#chat-area { .back-button {
padding-bottom: 1.5em; display: none;
} }
} }
@media (max-width: 799px) { @media (max-width: 799px) {
@ -186,15 +204,16 @@
max-width: 100%; max-width: 100%;
overflow-x: hidden; overflow-x: hidden;
} }
#mobile ul {
width: 100%;
}
.info-pic {
margin-left: 0.5em;
}
.active-span { .active-span {
display: none; display: none;
} }
#chat-area {
display: none;
}
.back-button {
margin-right: 1em;
font-size: 1.5em;
}
} }
</style> </style>
{% endcompress %} {% endcompress %}

View file

@ -279,6 +279,21 @@
$("#click_space_" + window.other_user_id).addClass("selected-status-row"); $("#click_space_" + window.other_user_id).addClass("selected-status-row");
} }
function show_right_panel() {
if (isMobile) {
$('.chat-left-panel').hide();
$('#chat-area').css('display', 'flex');
$('#chat-box').scrollTop($('#chat-box')[0].scrollHeight);
}
}
function hide_right_panel() {
if (isMobile) {
$('.chat-left-panel').show();
$('#chat-area').hide();
}
}
function load_room(encrypted_user) { function load_room(encrypted_user) {
if (window.lock_click_space) return; if (window.lock_click_space) return;
@ -288,6 +303,7 @@
update_last_seen(); update_last_seen();
refresh_status(); refresh_status();
$('#chat-input').focus(); $('#chat-input').focus();
show_right_panel();
} }
window.lock_click_space = true; window.lock_click_space = true;
if (encrypted_user) { if (encrypted_user) {
@ -314,6 +330,7 @@
function register_click_space() { function register_click_space() {
$('.click_space').on('click', function(e) { $('.click_space').on('click', function(e) {
if ($(this).attr('id') == 'click_space_' + window.other_user_id) { if ($(this).attr('id') == 'click_space_' + window.other_user_id) {
show_right_panel();
return; return;
} }
var other_user = $(this).attr('value'); var other_user = $(this).attr('value');
@ -323,10 +340,10 @@
if (window.room_id) { if (window.room_id) {
load_room(null); load_room(null);
} }
else {
show_right_panel();
}
}); });
if (isMobile) {
$('#chat-tab a').click();
}
} }
function update_last_seen() { function update_last_seen() {
@ -439,26 +456,6 @@
return true return true
}); });
$('#chat-tab').find('a').click(function (e) {
e.preventDefault();
$('#chat-tab').addClass('active');
$('#online-tab').removeClass('active');
$('.chat-left-panel').show();
$('.chat-right-panel').hide();
});
$('#online-tab').find('a').click(function (e) {
e.preventDefault();
$('#online-tab').addClass('active');
$('#chat-tab').removeClass('active');
$('.chat-left-panel').hide();
$('.chat-right-panel').show();
});
$('#refresh-button').on('click', function(e) {
e.preventDefault();
refresh_status();
});
setInterval(refresh_status, 2 * 60 * 1000); setInterval(refresh_status, 2 * 60 * 1000);
$('#chat-box').scrollTop($('#chat-box')[0].scrollHeight); $('#chat-box').scrollTop($('#chat-box')[0].scrollHeight);
@ -466,7 +463,7 @@
const button = document.querySelector('#emoji-button'); const button = document.querySelector('#emoji-button');
const tooltip = document.querySelector('.tooltip'); const tooltip = document.querySelector('.tooltip');
Popper.createPopper(button, tooltip, { Popper.createPopper(button, tooltip, {
placement: 'left-end', placement: isMobile ? 'auto-end' : 'left-end',
}); });
function toggleEmoji() { function toggleEmoji() {
@ -558,5 +555,16 @@
} }
register_setting(); register_setting();
color_selected_room(); color_selected_room();
$('#chat-input').on('input', function() {
if (this.scrollHeight > this.clientHeight) {
this.style.height = (this.scrollHeight) + 'px';
$(this).css('border-radius', '30px');
} else {
$(this).css('height', '80%');
}
});
$('#submit-button').on('click', submit_chat);
}); });
</script> </script>

View file

@ -5,8 +5,10 @@
<span style="padding-left:0.5em"> <span style="padding-left:0.5em">
<b>{{_('Lobby')}}</b> <b>{{_('Lobby')}}</b>
</span> </span>
<span class="spacer"> <span class="spacer" style="display:flex;justify-content: flex-end;">
<span class="unread-count" id="unread-count-lobby">{{unread_count_lobby if unread_count_lobby}}</span> {% if unread_count_lobby and unread_count_lobby > 0 %}
<span class="unread-count" id="unread-count-lobby">{{unread_count_lobby}}</span>
{% endif %}
</span> </span>
</li> </li>
{% for section in status_sections %} {% for section in status_sections %}
@ -37,9 +39,11 @@
</span> </span>
{% endif %} {% endif %}
</div> </div>
<span class="unread-count" id="unread-count-{{user.user.id}}"> {% if user.unread_count and user.unread_count > 0 %}
{{user.unread_count if user.unread_count}} <span class="unread-count" id="unread-count-{{user.user.id}}">
</span> {{user.unread_count}}
</span>
{% endif %}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View file

@ -1,11 +1,18 @@
<div onclick="hide_right_panel()" class="back-button">
<i class="fa fa-arrow-left"></i>
</div>
{% if other_user %} {% if other_user %}
<div class="status-container" style="height: 100%"> <div class="status-container" style="height: 3em; width: 3em;">
<img src="{{ gravatar(other_user, 135) }}" class="info-pic"> <img src="{{ gravatar(other_user, 135) }}" class="info-pic">
<svg style="position:absolute; height:100%; width: 100%; transform: rotate(180deg);" > <svg style="position:absolute; height:100%; width: 100%; transform: rotate(180deg);" >
<circle class="info-circle" <circle class="info-circle"
fill="{{'green' if other_online else 'red'}}"/> fill="{{'green' if other_online else 'red'}}"/>
</svg> </svg>
</div> </div>
{% else %}
<div class="status-container" style="height: 3em;">
<img src="{{ static('icons/logo.png') }}" class="info-pic" style="border-radius: 0px;">
</div>
{% endif %} {% endif %}
<span class="info-name username"> <span class="info-name username">
{% if other_user %} {% if other_user %}
@ -21,9 +28,9 @@
{% if other_user %} {% if other_user %}
<span style="margin-right: 0.3em" id="setting"> <span style="margin-right: 0.3em" id="setting">
<button class="control-button small" style="height:100%;" id="setting-button"> <div class="control-button small" style="" id="setting-button">
<i class="fa fa-ellipsis-h"></i> <i class="fa fa-ellipsis-h"></i>
</button> </div>
<div id="setting-content"> <div id="setting-content">
<li> <li>
<a href="{{url('toggle_ignore', other_user.id)}}" class=" {{'green' if is_ignored else 'red'}}"> <a href="{{url('toggle_ignore', other_user.id)}}" class=" {{'green' if is_ignored else 'red'}}">

View file

@ -1,13 +1,10 @@
{% set logged_in = request.user.is_authenticated %}
{% set profile = request.profile if logged_in else None %}
{% for node in mptt_tree(comment_list) recursive %} {% for node in mptt_tree(comment_list) recursive %}
<li id="comment-{{ node.id }}" data-revision="{{ node.revisions - 1 }}" data-max-revision="{{ node.revisions - 1 }}" <li id="comment-{{ node.id }}" data-revision="{{ node.revisions - 1 }}" data-max-revision="{{ node.revisions - 1 }}"
data-revision-ajax="{{ url('comment_revision_ajax', node.id) }}" class="comment"> data-revision-ajax="{{ url('comment_revision_ajax', node.id) }}" class="comment">
<div class="comment-display{% if node.score <= vote_hide_threshold %} bad-comment{% endif %}"> <div class="comment-display{% if node.score <= vote_hide_threshold %} bad-comment{% endif %}">
<div class="info"> <div class="info">
<div class="vote"> <div class="vote">
{% if logged_in %} {% if profile %}
<a href="javascript:comment_upvote({{ node.id }})" <a href="javascript:comment_upvote({{ node.id }})"
class="upvote-link fa fa-chevron-up fa-fw{% if node.vote_score == 1 %} voted{% endif %}"></a> class="upvote-link fa fa-chevron-up fa-fw{% if node.vote_score == 1 %} voted{% endif %}"></a>
{% else %} {% else %}
@ -16,7 +13,7 @@
{% endif %} {% endif %}
<br> <br>
<div class="comment-score">{{ node.score }}</div> <div class="comment-score">{{ node.score }}</div>
{% if logged_in %} {% if profile %}
<a href="javascript:comment_downvote({{ node.id }})" <a href="javascript:comment_downvote({{ node.id }})"
class="downvote-link fa fa-chevron-down fa-fw{% if node.vote_score == -1 %} voted{% endif %}"></a> class="downvote-link fa fa-chevron-down fa-fw{% if node.vote_score == -1 %} voted{% endif %}"></a>
{% else %} {% else %}
@ -55,7 +52,7 @@
<a href="?comment-id={{node.id}}#comment-{{ node.id }}" title="{{ _('Link') }}" class="comment-link"> <a href="?comment-id={{node.id}}#comment-{{ node.id }}" title="{{ _('Link') }}" class="comment-link">
<i class="fa fa-link fa-fw"></i> <i class="fa fa-link fa-fw"></i>
</a> </a>
{% if logged_in and not comment_lock %} {% if profile and not comment_lock %}
{% set can_edit = node.author.id == profile.id and not profile.mute %} {% set can_edit = node.author.id == profile.id and not profile.mute %}
{% if can_edit %} {% if can_edit %}
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}" <a data-featherlight="{{ url('comment_edit_ajax', node.id) }}"

View file

@ -3,7 +3,7 @@
<h2 id="comment-header"> <h2 id="comment-header">
<i style="padding-right: 0.3em" class="fa fa-comments"></i>{{ _('Comments') }} <i style="padding-right: 0.3em" class="fa fa-comments"></i>{{ _('Comments') }}
{% if can_comment %} {% if can_comment %}
<a href="" id="write-comment" style="float: right; font-size: 0.6em; margin-right: -26px;"> {{ _('Write comment') }} </a> <a href="#" id="write-comment" style="float: right; font-size: 0.6em; margin-right: -26px;"> {{ _('Write comment') }} </a>
{% endif %} {% endif %}
</h2> </h2>
{% if can_comment %} {% if can_comment %}

View file

@ -30,7 +30,7 @@
{% endif %} {% endif %}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
let loading_gif = "<img src=\"{{static('loading.gif')}}\" style=\"height: 1.5em; margin-bottom: 3px\" class=\"loading\">"; let loading_gif = "<img src=\"{{static('loading.gif')}}\" style=\"height: 3em; margin-bottom: 3px\" class=\"loading\">";
window.reply_comment = function (parent) { window.reply_comment = function (parent) {
var $comment_reply = $('#comment-' + parent + '-reply'); var $comment_reply = $('#comment-' + parent + '-reply');
var reply_id = 'reply-' + parent; var reply_id = 'reply-' + parent;
@ -186,6 +186,7 @@
var $comment = $("#comment-" + id + "-children"); var $comment = $("#comment-" + id + "-children");
$comment.append(data); $comment.append(data);
} }
MathJax.typeset($('#comments')[0]);
} }
}) })
} }

View file

@ -112,56 +112,54 @@
{% endblock %} {% endblock %}
{% macro contest_head(contest) %} {% macro contest_head(contest) %}
{% spaceless %} <a href="{{ url('contest_view', contest.key) }}" class="contest-list-title" style="margin-right: 5px;">
<a href="{{ url('contest_view', contest.key) }}" class="contest-list-title" style="margin-right: 5px;"> {{contest.name}}
{{- contest.name -}} </a>
</a> <br>
<br> <div class="contest-tags" style="margin-top: 5px;">
<div class="contest-tags" style="margin-top: 5px;"> {% if not contest.is_visible %}
{% if not contest.is_visible %} <span class="contest-tag contest-tag-hidden">
<span class="contest-tag contest-tag-hidden"> <i class="fa fa-eye-slash"></i> {{ _('hidden') }}
<i class="fa fa-eye-slash"></i> {{ _('hidden') }} </span>
</span> {% endif %}
{% if contest.is_editable %}
<span class="contest-tag contest-tag-edit">
<a href="{{ url('organization_contest_edit', organization.id, organization.slug, contest.key) }}" class="white">
<i class="fa fa-edit"></i> {{ _('Edit') }}
</a>
</span>
{% endif %}
{% if contest.is_private %}
<span class="contest-tag contest-tag-private">
<i class="fa fa-lock"></i> {{ _('private') }}
</span>
{% endif %}
{% if not hide_contest_orgs %}
{% if contest.is_organization_private %}
{% for org in contest.organizations.all() %}
<span class="contest-tag contest-tag-org">
<a href="{{ org.get_absolute_url() }}">
<i class="fa fa-lock"></i> {{ org.name }}
</a>
</span>
{% endfor %}
{% endif %} {% endif %}
{% if contest.is_editable %} {% endif %}
<span class="contest-tag contest-tag-edit"> {% if contest.is_rated %}
<a href="{{ url('organization_contest_edit', organization.id, organization.slug, contest.key) }}" class="white"> <span class="contest-tag contest-tag-rated">
<i class="fa fa-edit"></i> {{ _('Edit') }} <i class="fa fa-bar-chart"></i> {{ _('rated') }}
</a> </span>
</span> {% endif %}
{% endif %} {% for tag in contest.tags.all() %}
{% if contest.is_private %} <span style="background-color: {{ tag.color }}" class="contest-tag">
<span class="contest-tag contest-tag-private"> <a href="{{ url('contest_tag', tag.name) }}"
<i class="fa fa-lock"></i> {{ _('private') }} style="color: {{ tag.text_color }}"
</span> data-featherlight="{{ url('contest_tag_ajax', tag.name) }}">
{% endif %} {{- tag.name -}}
{% if not hide_contest_orgs %} </a>
{% if contest.is_organization_private %} </span>
{% for org in contest.organizations.all() %} {% endfor %}
<span class="contest-tag contest-tag-org"> </div>
<a href="{{ org.get_absolute_url() }}">
<i class="fa fa-lock"></i> {{ org.name }}
</a>
</span>
{% endfor %}
{% endif %}
{% endif %}
{% if contest.is_rated %}
<span class="contest-tag contest-tag-rated">
<i class="fa fa-bar-chart"></i> {{ _('rated') }}
</span>
{% endif %}
{% for tag in contest.tags.all() %}
<span style="background-color: {{ tag.color }}" class="contest-tag">
<a href="{{ url('contest_tag', tag.name) }}"
style="color: {{ tag.text_color }}"
data-featherlight="{{ url('contest_tag_ajax', tag.name) }}">
{{- tag.name -}}
</a>
</span>
{% endfor %}
</div>
{% endspaceless %}
{% endmacro %} {% endmacro %}
{% macro time_left(contest, padding_top = true) %} {% macro time_left(contest, padding_top = true) %}