Spaces:
Runtime error
Runtime error
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| {% if title %} | |
| <title>{{ title }} - Microblog</title> | |
| {% else %} | |
| <title>{{ _('Welcome to Microblog') }}</title> | |
| {% endif %} | |
| <link | |
| href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" | |
| rel="stylesheet" | |
| integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" | |
| crossorigin="anonymous"> | |
| </head> | |
| <body> | |
| <nav class="navbar navbar-expand-lg bg-body-tertiary"> | |
| <div class="container"> | |
| <a class="navbar-brand" href="{{ url_for('main.index') }}">Microblog</a> | |
| <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> | |
| <span class="navbar-toggler-icon"></span> | |
| </button> | |
| <div class="collapse navbar-collapse" id="navbarSupportedContent"> | |
| <ul class="navbar-nav me-auto mb-2 mb-lg-0"> | |
| <li class="nav-item"> | |
| <a class="nav-link" aria-current="page" href="{{ url_for('main.index') }}">{{ _('Home') }}</a> | |
| </li> | |
| <li class="nav-item"> | |
| <a class="nav-link" aria-current="page" href="{{ url_for('main.explore') }}">{{ _('Explore') }}</a> | |
| </li> | |
| {% if g.search_form %} | |
| <form class="navbar-form navbar-left" method="get" action="{{ url_for('main.search') }}"> | |
| <div class="form-group"> | |
| {{ g.search_form.q(size=20, class='form-control', placeholder=g.search_form.q.label.text) }} | |
| </div> | |
| </form> | |
| {% endif %} | |
| </ul> | |
| <ul class="navbar-nav mb-2 mb-lg-0"> | |
| {% if current_user.is_anonymous %} | |
| <li class="nav-item"> | |
| <a class="nav-link" aria-current="page" href="{{ url_for('auth.login') }}">{{ _('Login') }}</a> | |
| </li> | |
| {% else %} | |
| <li class="nav-item"> | |
| <a class="nav-link" aria-current="page" href="{{ url_for('main.user', username=current_user.username) }}">{{ _('Profile') }}</a> | |
| </li> | |
| <li class="nav-item"> | |
| <a class="nav-link" aria-current="page" href="{{ url_for('auth.logout') }}">{{ _('Logout') }}</a> | |
| </li> | |
| {% endif %} | |
| </ul> | |
| </div> | |
| </div> | |
| </nav> | |
| <div class="container mt-3"> | |
| {% with messages = get_flashed_messages() %} | |
| {% if messages %} | |
| {% for message in messages %} | |
| <div class="alert alert-info" role="alert">{{ message }}</div> | |
| {% endfor %} | |
| {% endif %} | |
| {% endwith %} | |
| {% block content %}{% endblock %} | |
| </div> | |
| <script | |
| src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" | |
| integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" | |
| crossorigin="anonymous"> | |
| </script> | |
| {{ moment.include_moment() }} | |
| {{ moment.lang(g.locale) }} | |
| <script> | |
| async function translate(sourceElem, destElem, sourceLang, destLang) { | |
| document.getElementById(destElem).innerHTML = | |
| '<img src="{{ url_for('static', filename='loading.gif') }}">'; | |
| const response = await fetch('/translate', { | |
| method: 'POST', | |
| headers: {'Content-Type': 'application/json; charset=utf-8'}, | |
| body: JSON.stringify({ | |
| text: document.getElementById(sourceElem).innerText, | |
| source_language: sourceLang, | |
| dest_language: destLang | |
| }) | |
| }) | |
| const data = await response.json(); | |
| document.getElementById(destElem).innerText = data.text; | |
| } | |
| </script> | |
| </body> | |
| </html> | |