NDOJ/templates/base.html

419 lines
18 KiB
HTML
Raw Permalink Normal View History

2020-01-21 06:35:58 +00:00
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}">
2023-01-27 23:11:10 +00:00
<head>
2020-01-21 06:35:58 +00:00
<title>{% block title %}{{ title }} - {{ SITE_LONG_NAME }}{% endblock %}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
{% if misc_config.meta_keywords %}
2023-01-27 23:11:10 +00:00
<meta name="keywords" content="{{ misc_config.meta_keywords }}">
2020-01-21 06:35:58 +00:00
{% endif %}
{% if meta_description %}
2023-01-27 23:11:10 +00:00
<meta name="description" content="{{ meta_description }}">
2020-01-21 06:35:58 +00:00
{% endif %}
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1">
<!-- Favicons-->
<link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#FFBB33">
<meta name="msapplication-TileImage" content="/mstile-144x144.png">
{# Chrome 39 for Android colour #}
<meta name="theme-color" content="#FFBB33">
{% if og_image %}
2023-01-27 23:11:10 +00:00
<meta property="og:image" content="{{ request.build_absolute_uri(og_image) }}">
2020-01-21 06:35:58 +00:00
{% endif %}
{% block og_title %}{% endblock %}
<meta property="og:site_name" content="{{ SITE_LONG_NAME }}">
<meta property="og:url"
2023-01-27 23:11:10 +00:00
content="{{ DMOJ_SCHEME }}://{{ DMOJ_CANONICAL|default(site.domain) }}{{ request.get_full_path() }}">
2020-01-21 06:35:58 +00:00
{% if meta_description %}
2023-01-27 23:11:10 +00:00
<meta property="og:description" content="{{ meta_description }}">
2020-01-21 06:35:58 +00:00
{% endif %}
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script>window.bad_browser = true</script>
<![endif]-->
{% block meta %}{% endblock %}
{% if not INLINE_FONTAWESOME %}
2023-01-27 23:11:10 +00:00
<link rel="stylesheet" href="{{ FONTAWESOME_CSS }}">
2020-01-21 06:35:58 +00:00
{% endif %}
<link rel="stylesheet" type="text/css" href="{{ static('markdown.css') }}">
2020-01-21 06:35:58 +00:00
{% compress css %}
2023-01-27 23:11:10 +00:00
<link rel="stylesheet" href="{{ static('style.css') }}">
2024-01-19 01:46:41 +00:00
{% if INLINE_FONTAWESOME %}
<link rel="stylesheet" href="{{ static('fontawesome/css/all.min.css') }}">
{% endif %}
2023-01-27 23:11:10 +00:00
<link rel="stylesheet" type="text/css" href="{{ static('libs/featherlight/featherlight.min.css') }}">
<link rel="stylesheet" type="text/css" href="{{ static('libs/clipboard/tooltip.css') }}">
<link rel="stylesheet" type="text/css" href="{{ static('libs/select2/select2.css') }}">
<link rel="stylesheet" type="text/css" href="{{ static('icofont/icofont.min.css') }}">
2020-01-21 06:35:58 +00:00
{% endcompress %}
2024-06-25 01:13:15 +00:00
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Fira+Code&family=Noto+Sans&display=swap" rel="stylesheet">
2020-01-21 06:35:58 +00:00
<link rel="canonical"
2023-01-27 23:11:10 +00:00
href="{{ DMOJ_SCHEME }}://{{ DMOJ_CANONICAL|default(site.domain) }}{{ request.get_full_path() }}">
2020-01-21 06:35:58 +00:00
{% if request.user.is_impersonate %}
2023-01-27 23:11:10 +00:00
<style>
#nav-container {
background: #893e89 !important;
}
</style>
2020-01-21 06:35:58 +00:00
{% endif %}
2024-06-24 19:56:00 +00:00
{% if use_darkmode %}
<link rel="stylesheet" href="{{ static('darkmode.css') }}">
<link rel="stylesheet" href="{{ static('darkmode-svg.css') }}">
{% endif %}
2020-01-21 06:35:58 +00:00
<noscript>
2023-01-27 23:11:10 +00:00
<style>
#content {
margin: 80px auto auto;
}
2020-01-21 06:35:58 +00:00
2023-01-27 23:11:10 +00:00
#navigation {
top: 27px;
}
</style>
2020-01-21 06:35:58 +00:00
</noscript>
2023-09-02 00:42:58 +00:00
{% if request.profile.css_background %}
<style>
@media(min-width: 800px) {
#page-container {
background: {{request.profile.css_background|safe}};
2024-05-03 23:06:07 +00:00
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
2023-09-02 00:42:58 +00:00
}
}
</style>
{% endif %}
2023-12-22 05:09:04 +00:00
{% if not INLINE_JQUERY %}
<script src="{{ JQUERY_JS }}"></script>
{% else %}
<script src="{{ static('libs/jquery-3.4.1.min.js') }}"></script>
{% endif %}
2023-01-27 23:11:10 +00:00
</head>
<body>
<svg width="0" height="0" style="display: block">
<defs>
2020-01-21 06:35:58 +00:00
<clipPath id="rating-clip"><circle cx="8" cy="8" r="7"/></clipPath>
2023-01-27 23:11:10 +00:00
</defs>
</svg>
<nav id="navigation" class="unselectable">
2023-09-20 06:39:14 +00:00
<div id="nav-container" style="display: flex">
2023-09-01 23:52:25 +00:00
<span id="navicon"><i class="fa fa-bars"></i></span>
2020-01-21 06:35:58 +00:00
<ul id="nav-list">
2023-09-21 17:25:02 +00:00
<li class="home-nav-element"><a href="{{ url('home') }}">{% include "site-logo-fragment.html" %}</a></li>
2023-01-27 23:11:10 +00:00
<li class="home-menu-item"><a href="{{ url('home') }}" class="nav-home">{{ _('Home') }}</a></li>
{% for node in mptt_tree(nav_bar) recursive %}
<li>
2023-09-20 06:39:14 +00:00
<a href="{{ node.path }}" id="fa-icon-links" class="normal-text nav-{{ node.key }}{% if node.key in nav_tab %} active{% endif %}">
2023-09-20 04:01:22 +00:00
<span class="nav-fa-icon{{'-active' if node.key in nav_tab else''}}">
{% if node.key == "problems" %} <i class="fa fa-puzzle-piece"></i> {% endif %}
2023-09-20 06:39:14 +00:00
{% if node.key == "submit" %} <i class="fa fa-code"></i> {% endif %}
2023-09-20 04:01:22 +00:00
{% if node.key == "user" %} <i class="fa fa-user"></i> {% endif %}
{% if node.key == "contest" %} <i class="fa fa-ranking-star"></i> {% endif %}
{% if node.key == "group" %} <i class="fa fa-building-columns"></i> {% endif %}
2023-09-20 06:39:14 +00:00
{% if node.key == "about" %} <i class="fa fa-at"></i> {% endif %}
2023-09-20 04:01:22 +00:00
</span>
2023-01-27 23:11:10 +00:00
{{ user_trans(node.label) }}
{% if not node.is_leaf_node %}
<div href="javascript:void(0)" class="nav-expand">></div>
{% endif %}
</a>
{% with children=node.get_children() %}
{% if children %}<ul>{{ loop(children) }}</ul>{% endif %}
{% endwith %}
</li>
{% endfor %}
2020-01-21 06:35:58 +00:00
</ul>
2023-09-20 04:01:22 +00:00
2023-09-20 06:39:14 +00:00
<div style="display: flex; font-size: larger; align-items: center; height: 100%; gap: 1em;">
{% if request.user.is_authenticated %}
<span title="{{_('Chat')}}">
<a id="chat-icon" href="{{ url('chat', '') }}" class="fab fa-weixin navbar-icon" aria-hidden="true" style="font-size: 22.5px;">
2023-09-20 06:39:14 +00:00
{% set unread_chat = request.profile.count_unread_chat_boxes %}
{% if unread_chat %}
<sub class="unread_boxes">{{unread_chat}}</sub>
2023-09-20 04:01:22 +00:00
{% endif %}
2023-09-20 06:39:14 +00:00
</a>
2020-07-03 02:50:31 +00:00
</span>
2023-09-20 06:39:14 +00:00
{% set unseen_cnt = request.profile.count_unseen_notifications %}
<span title="{{_('Notification')}}" class="{{ 'notification-open' if unseen_cnt > 0 }}">
<a href="{{ url('notification') }}" class="far fa-bell navbar-icon" id="notification" aria-hidden="true" style="font-size: 22.5px;">
2023-09-20 06:39:14 +00:00
{% if unseen_cnt > 0 %}
<sub class="unread_boxes">{{unseen_cnt}}</sub>
{% endif %}
</a>
2023-01-27 23:11:10 +00:00
</span>
2023-09-20 06:39:14 +00:00
{% endif %}
<span title="{{_('Language')}}">
<div class="navbar-icon" id="nav-lang-icon" aria-hidden="true" style="font-size: 22.5px;">
{% if LANGUAGE_CODE == "vi" %}
<h4 class="black nav-right-text">Tiếng Việt</h4>
{% endif %}
{% if LANGUAGE_CODE == "en" %}
<h4 class="black nav-right-text">English</h4>
{% endif %}
</div>
<div id="lang-dropdown" class="dropdown" role="tooltip">
{% for language in language_info_list(LANGUAGES) %}
<div value="{{ language.code }}"
class="dropdown-item lang-dropdown-item" style="{{'font-weight: bold' if language.code == LANGUAGE_CODE}}">
{{ language.name_local }}
</div>
{% endfor %}
2023-11-28 03:47:12 +00:00
<div class="popper-arrow" data-popper-arrow></div>
2023-09-20 06:39:14 +00:00
</div>
</span>
<span title="{{_('Dark Mode')}}">
<a class="far fa-moon navbar-icon black" id="nav-darkmode-icon" aria-hidden="true" href="?darkmode=1" style="font-size: 22.5px;"></a>
2023-01-27 23:11:10 +00:00
</span>
{% if request.user.is_authenticated %}
2023-09-20 06:39:14 +00:00
<span id="user-links">
2024-04-12 06:51:57 +00:00
<img class="user-img" src="{{ gravatar(request.profile, 32) }}" height="24" width="24">
2023-09-20 06:39:14 +00:00
<i class="fa fa-angle-down" style="font-size: 18px; padding-top: 8px;"></i>
2023-01-27 23:11:10 +00:00
</span>
<div class="dropdown" id="userlink_dropdown" role="tooptip">
2023-11-28 03:47:12 +00:00
<div class="popper-arrow" data-popper-arrow></div>
2023-08-24 16:10:39 +00:00
<a href="{{ url('user_page') }}">
<div class="dropdown-item"><i class="fa fa-user"></i> {{ _('Profile') }}</div>
2023-08-24 16:10:39 +00:00
</a>
2023-01-27 23:11:10 +00:00
{% if request.user.is_staff or request.user.is_superuser %}
2023-08-24 16:10:39 +00:00
<a href="{{ url('admin:index') }}">
<div class="dropdown-item"><i class="fa fa-user-shield"></i> {{ _('Admin') }}</div>
2023-08-24 16:10:39 +00:00
</a>
2023-01-27 23:11:10 +00:00
{% endif %}
{% if request.user.is_superuser %}
2023-08-24 16:10:39 +00:00
<a href="{{ url('internal_problem') }}">
<div class="dropdown-item"><i class="fa fa-circle-info"></i> {{ _('Internal') }}</div>
2023-08-24 16:10:39 +00:00
</a>
<a href="{{ url('site_stats') }}">
<div class="dropdown-item"><i class="fa fa-chart-pie"></i> {{ _('Stats') }}</div>
2023-08-24 16:10:39 +00:00
</a>
2023-01-27 23:11:10 +00:00
{% endif %}
<a href="{{ url('user_bookmark') }}">
<div class="dropdown-item"><i class="fa fa-bookmark"></i> {{ _('Bookmarks') }}</div>
</a>
2023-08-24 16:10:39 +00:00
<a href="{{ url('user_edit_profile') }}">
<div class="dropdown-item"><i class="fa fa-gear"></i> {{ _('Settings') }}</div>
2023-08-24 16:10:39 +00:00
</a>
2023-01-27 23:11:10 +00:00
{% if request.user.is_impersonate %}
2024-06-24 19:56:00 +00:00
<a href="{{ url('impersonate-stop') }}" data-force_new_page="1">
<div class="dropdown-item"><i class="fa fa-eye"></i> {{_('Stop impersonating')}}</div>
2023-08-24 16:10:39 +00:00
</a>
2023-01-27 23:11:10 +00:00
{% else %}
2023-08-24 16:10:39 +00:00
<a href="#" id="logout" class="red">
<div class="dropdown-item"><i class="fa fa-right-from-bracket"></i>
2023-08-24 16:10:39 +00:00
{{ _('Log out') }}
<form id="logout-form" action="{{ url('auth_logout') }}" method="POST">
{% csrf_token %}
</form>
</div>
</a>
2023-01-27 23:11:10 +00:00
{% endif %}
</div>
{% else %}
2023-09-20 06:39:14 +00:00
<span class="anon">
<a href="{{ url('auth_login') }}?next={{ LOGIN_RETURN_PATH|urlencode }}"><h4 class="nav-right-text">{{ _('Log in') }}</h4></a>
<a href="{{ url('registration_register') }}"><h4 class="nav-right-text">{{ _('Sign up') }}</h4></a>
2023-01-27 23:11:10 +00:00
</span>
{% endif %}
2020-07-03 02:50:31 +00:00
</div>
2023-01-27 23:11:10 +00:00
</div>
<div id="nav-shadow"></div>
</nav>
2023-09-01 23:09:30 +00:00
<div id="loading-bar"></div>
2023-01-27 23:11:10 +00:00
{% if request.in_contest %}
<div id="contest-info">
2022-01-10 11:13:46 +00:00
<div id="contest-info-main">
2023-01-27 23:11:10 +00:00
<a href="{{ url('contest_view', request.participation.contest.key) }}" style="vertical-align: middle; display: inline">
{{ request.participation.contest.name }} -
{% if request.participation.spectate %}
{{ _('spectating') }}
{% elif request.participation.end_time %}
<div id="contest-time-remaining" data-secs="{{request.participation.end_time}}">
{{ request.participation.time_remaining|timedelta("localized") }}
</div>
2020-01-21 06:35:58 +00:00
{% else %}
2023-01-27 23:11:10 +00:00
{{ _('virtual') }}
2020-01-21 06:35:58 +00:00
{% endif %}
2023-01-27 23:11:10 +00:00
</a>
2022-01-10 11:13:46 +00:00
</div>
2023-01-27 23:11:10 +00:00
<div id="contest-info-toggle" class="{{'contest-info-toggle-mode-on' if request.contest_mode else 'contest-info-toggle-mode-off'}}">
{% if request.contest_mode %}
<i class="fa fa-toggle-on white"></i> {{_('In contest')}}
2023-01-27 23:11:10 +00:00
{% else %}
<i class="fa fa-toggle-off white"></i> {{_('Out contest')}}
2023-01-27 23:11:10 +00:00
{% endif %}
</div>
</div>
{% endif %}
<div id="page-container">
2024-06-24 19:56:00 +00:00
<div id="media">
{% block media %}{% endblock %}
</div>
2023-01-27 23:11:10 +00:00
<noscript>
2020-01-21 06:35:58 +00:00
<div id="noscript">{{ _('This site works best with JavaScript enabled.') }}</div>
2023-01-27 23:11:10 +00:00
</noscript>
2023-02-08 05:14:48 +00:00
<main id="content" class="{{'wrapper' if layout != 'no_wrapper'}}">
2020-01-21 06:35:58 +00:00
{% block title_row %}
2023-01-27 23:11:10 +00:00
<h2 class="title-row">
{% block content_title %}
{% if content_title %}{{ content_title }}{% else %}{{ title }}{% endif %}
{% endblock %}
</h2>
2020-01-21 06:35:58 +00:00
{% endblock %}
{% block header %}{% endblock %}
{% block title_ruler %}
2023-01-27 23:11:10 +00:00
<hr>
2020-01-21 06:35:58 +00:00
{% endblock %}
<div id="content-body">{% block body %}{% endblock %}</div>
2023-01-27 23:11:10 +00:00
</main>
2020-01-21 06:35:58 +00:00
2023-01-27 23:11:10 +00:00
{% if i18n_config.announcement %}
2020-01-21 06:35:58 +00:00
<div id="announcement">{{ i18n_config.announcement|safe }}</div>
2023-01-27 23:11:10 +00:00
{% endif %}
2020-01-21 06:35:58 +00:00
2023-11-02 00:14:21 +00:00
{% compress js %}
<script>{{ inlinei18n(LANGUAGE_CODE)|safe }}</script>
2024-04-12 06:51:57 +00:00
<script src="{{ static('libs/popper.min.js') }}"></script>
2023-11-02 00:14:21 +00:00
<script src="{{ static('libs/jquery-cookie.js') }}"></script>
<script src="{{ static('libs/jquery-taphold.js') }}"></script>
<script src="{{ static('libs/jquery.unveil.js') }}"></script>
<script src="{{ static('libs/moment.js') }}"></script>
<script src="{{ static('libs/select2/select2.js') }}"></script>
<script src="{{ static('libs/clipboard/clipboard.js') }}"></script>
{% include "extra_js.html" %}
<script src="{{ static('common.js') }}"></script>
<script src="{{ static('libs/clipboard/tooltip.js') }}"></script>
<script type="text/javascript" src="{{ static('libs/featherlight/featherlight.min.js') }}"></script>
2023-11-02 00:14:21 +00:00
<script>
moment.locale('{{ LANGUAGE_CODE }}');
$(function () {
$('img.unveil').unveil(200);
});
</script>
{% endcompress %}
2024-06-24 19:56:00 +00:00
<div id="js_media">
{% block js_media %}{% endblock %}
</div>
2023-11-02 00:14:21 +00:00
{% if request.in_contest %}
<script>$(function () {
if ($("#contest-time-remaining").length) {
count_down($("#contest-time-remaining"));
}
var selected = null,
x_pos = 0, y_pos = 0,
x_elem = 0, y_elem = 0;
$('#contest-info').mousedown(function () {
selected = $(this);
x_elem = x_pos - selected.offset().left;
y_elem = y_pos - (selected.offset().top - $(window).scrollTop());
return false;
});
if (localStorage.getItem("contest_timer_position")) {
data = localStorage.getItem("contest_timer_position").split(":");
$("#contest-info").css({
left: data[0],
top: data[1]
});
}
$("#contest-info").show();
$("#contest-info-toggle").on('click', function() {
$.post("{{url('contest_mode_ajax')}}", function() {
window.location.reload();
})
});
$(document).mousemove(function (e) {
x_pos = e.screenX;
y_pos = e.screenY;
if (selected !== null) {
left_px = (x_pos - x_elem);
top_px = (y_pos - y_elem);
left_px = Math.max(Math.min(left_px, window.innerWidth), 0) / window.innerWidth * 100 + '%';
top_px = Math.max(Math.min(top_px, window.innerHeight), 0) / window.innerHeight * 100 + '%';
localStorage.setItem("contest_timer_position", left_px + ":" + top_px);
selected.css({
left: left_px,
top: top_px
});
}
});
$(document).mouseup(function () {
selected = null;
})
});
</script>
{% endif %}
{% if request.user.is_authenticated %}
<script>
window.user = {
email: '{{ request.user.email|escapejs }}',
id: '{{ request.user.id|escapejs }}',
name: '{{ request.user.username|escapejs }}'
};
</script>
{% else %}
<script>window.user = {};</script>
{% endif %}
{% if misc_config.analytics %}
{{ misc_config.analytics|safe }}
{% endif %}
2024-06-24 19:56:00 +00:00
<div id="bodyend">
{% block bodyend %}{% endblock %}
2023-11-02 00:14:21 +00:00
</div>
2024-02-05 23:02:49 +00:00
<script src="{{ static('katex_config.js') }}"></script>
{% include "katex-load.html" %}
2023-01-27 23:11:10 +00:00
{% block footer %}
<footer>
<span id="footer-content">
2020-01-21 06:35:58 +00:00
<br>
2023-10-16 22:37:52 +00:00
<a class="background-footer" target="_blank" href="https://dmoj.ca">proudly powered by <b>DMOJ</b></a>|<a target="_blank" href="https://github.com/LQDJudge/online-judge"> developed by LQDJudge team</a>
2020-01-21 06:35:58 +00:00
{% if i18n_config.footer %}
2023-01-27 23:11:10 +00:00
{{ i18n_config.footer|safe }} |
2020-01-21 06:35:58 +00:00
{% endif %}
2022-09-01 23:39:19 +00:00
<form action="{{ url('set_language') }}" method="post" style="display: inline" id="form-lang">
2023-01-27 23:11:10 +00:00
{% csrf_token %}
<input name="next" type="hidden" value="{{ request.get_full_path() }}">
<select name="language" onchange="form.submit()" style="height: 1.5em">
2020-01-21 06:35:58 +00:00
{% for language in language_info_list(LANGUAGES) %}
2023-01-27 23:11:10 +00:00
<option value="{{ language.code }}" {% if language.code == LANGUAGE_CODE %}selected{% endif %}>
{{ language.name_local }} ({{ language.code }})
</option>
2020-01-21 06:35:58 +00:00
{% endfor %}
2023-01-27 23:11:10 +00:00
</select>
</form>
</span>
</footer>
{% endblock %}
</div>
</body>
2020-01-21 06:35:58 +00:00
</html>