Files
website-v2/templates/base.html

509 lines
16 KiB
HTML

{% load static %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}">
<head>
{% if not disable_plausible %}
<script defer
data-domain="boost.org"
src="https://plausible.io/js/script.manual.js"></script>
{% endif %}
<title>{% block title %}Boost{% endblock %}</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="{% block description %}{% endblock %}">
<meta name="keywords" content="{% block keywords %}{% endblock %}">
<meta name="author" content="{% block author %}Boost C++ Libraries{% endblock %}">
<link rel="shortcut icon" href="{% static 'img/Boost_Symbol_Transparent.svg' %}" type="image/x-icon">
<meta class="meta-theme" name="theme-color" content="#FAFAFA" data-dark="#18181B" data-light="#FAFAFA">
<meta class="meta-theme" name="color-scheme" content="light" data-dark="dark" data-light="light">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
{% if canonical_uri %}<link rel="canonical" href="{{ canonical_uri }}">{% endif %}
<script src="https://cdn.jsdelivr.net/npm/@ryangjchandler/alpine-clipboard@2.x.x/dist/alpine-clipboard.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/@alpinejs/persist@3.x.x/dist/cdn.min.js" defer></script>
<script src="//unpkg.com/alpinejs" defer></script>
<script src="https://unpkg.com/htmx.org@1.9.12" integrity="sha384-ujb1lZYygJmzgSwoxRggbCHcjc0rB2XoQrxeTUQyRjrOnlCoYta87iKBWq3EsdM2" crossorigin="anonymous"></script>
<!-- TODO bring this local if we like it -->
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<script src="{% static 'js/theme_handling.js' %}"></script>
<script src="{% static 'js/scroll-to-link.js' %}" defer></script>
<script src="{% static 'js/utils.js' %}"></script>
<script src="{% static 'js/boost-gecko/main.C3hPHS6-.js' %}" defer></script>
{% block extra_head %}
<link href="{% static 'css/styles.css' %}" rel="stylesheet">
<link href="{% static 'css/components.css' %}" rel="stylesheet">
{% comment %} <link rel="preload" as="style" href="{% static 'css/fonts.css' %}" rel="stylesheet"> {% endcomment %}
<link href="{% static 'css/boostlook.css' %}" rel="stylesheet">
{% endblock %}
{% block css %}{% endblock css %}
<style>
{% comment %} @import url({% static 'css/fonts.css' %}); {% endcomment %}
{% include "includes/_css_variables.css" %}
.header-menu-bar {
padding: 0 1rem;
height: 41px;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: 0px 1px 0px #d1d1d1;
border-bottom: 1px solid #f6f6f6;
max-width: 80rem;
margin: 0 auto;
color: var(--text-color);
font-family: "Noto Sans" !important;
}
.DEBUG .header-menu-bar {
font-family: "Noto Sans", serif !important;
}
.dark .header-menu-bar {
border-bottom: 1px solid #07405f;
box-shadow: 0 1px 0 #000;
}
.header-menu-bar .left-menubar {
display: flex;
align-items: center;
justify-content: flex-start;
flex-grow: 1;
}
.header-menu-bar .right-menubar {
display: flex;
align-items: center;
justify-content: flex-end;
max-width: 9rem;
}
.header-menu-bar .logo-link {
width: 31px;
height: 31px;
}
.header-menu-bar .menu-link {
text-transform: capitalize;
text-decoration: none;
margin-left: 1rem;
font-weight: 500;
color: var(--text-color);
font-size: 18px;
}
.header-menu-bar .menu-link-right {
text-transform: capitalize;
margin-right: 1rem;
font-weight: 500;
color: var(--text-color);
font-size: 18px;
white-space: nowrap;
}
.icon-link {
display:block;
margin-left: 1rem;
cursor: pointer
}
.dark .icon-link {
opacity: 0.5;
}
.icon-link:hover,
.menu-link:hover,
.active-link,
.mobile-menu-item a:hover {
color: var(--primary-color) !important;
opacity: 1;
}
.boost-drop-shadow {
box-shadow: 2px 2px 5px 1px var(--shadow-color);
}
.guide-modal {
position: absolute;
right:0;
z-index: 10;
padding: .25rem .5rem;
margin-top: .5rem;
width: 10rem;
text-align:left;
background-color: var(--card-color);
border-radius: 0.375rem;
border: 1px solid var(--border-color);
box-shadow: 3px 3px 7px 1px var(--shadow-color);
}
.guide-modal a {
margin-left: .5rem;
display: block;
padding: .5rem 0;
font-size: .8rem;
cursor: pointer;
color: var(--text-color);
border-bottom: var(--border-color) 1px solid;
}
.guide-modal a:last-child {
border-bottom: none;
}
.guide-modal a:hover {
color: var(--primary-color);
}
#pageselector {
text-transform: capitalize;
margin-left: 1rem;
font-weight: 500;
display:flex;
position: absolute;
top: 2.25rem;
left: 1.75rem;
flex-direction: column;
z-index: 10;
color: var(--text-color);
background-color: var(--card-color);
font-size: 1rem;
padding: 0.5rem 1rem;
border-radius: 0.5rem;
}
.hide {
display: none !important;
}
.mobile-menu-item {
min-width: 10rem;
padding: .5rem 1rem;
border-bottom: var(--border-color) 1px solid;
text-transform: capitalize;
}
.mobile-menu-item:last-child {
border-bottom: none;
}
#avatar svg {
width: 1rem;
height: 1rem;
color: var(--text-color);
fill: var(--primary-color);
}
#mobileNav {
display: flex;
align-items: center;
}
#selectedpage {
display: flex;
align-items: center;
justify-content: space-between;
padding-left: 10px;
font-weight: 500;
font-size: 18px;
}
#pageName {
text-transform: capitalize;
}
#desktopNav {
display: none;
}
@media screen and (min-width: 768px) {
#mobileNav {
display: none;
}
#desktopNav {
display: flex;
}
}
/* specific to docs */
body.article {
max-width: 100% !important;
margin: 0;
padding: 0px .75rem !important;
}
body .body {
margin: 0px 1rem;
padding: 1.5rem 0rem 0;
max-width: 80rem;
}
body.article #headblock {
padding: 0.25rem 1rem !important;
}
article.card {
border-radius: .5rem;
padding-top: .5rem !important;
}
@media (min-width: 769px) {
body.article {
max-width: 80rem !important;
margin: auto;
padding: 0px 2.25rem;
border-radius: .5rem;
}
}
@media (max-width: 768px) {
body.article {
padding: 0px !important;
border-radius: 0rem !important;
margin: 0 !important;
}
body.article #headblock {
padding: 0.25rem 0.5rem !important;
}
.body {
margin: 0 !important;
padding: 0 !important;
}
.article .card {
border-radius: 0 !important;
}
}
/* asciidoc layout base */
.main-footer {
max-width: 80rem !important;
}
.link-icons {
width: 4rem;
}
.links {
padding: 0 0.5rem;
}
.source-docs-antora .doc {
padding-top: 0 !important;
}
@media screen and (max-width: 940px) {
.links {
flex-direction: column;
align-items: center;
}
}
@media screen and (max-width: 769px) {
.source-docs-asciidoc #header #toc.toc2 {
position: relative !important;
height: auto;
}
.main-footer {
margin-left: 0 !important;
margin: auto !important
}
}
.hidenav {
display: none !important;
}
.toast-text {
display: flex;
font-size: .9rem;
font-weight: 600;
align-items: center;
justify-content: center;
}
.red-delete {
display: inline;
padding: .1rem .5rem;
margin: 0 1rem;
border: 2px solid #fff;
border-radius: .3rem;
color: #fff;
font-size: .8rem;
}
.red-delete:hover {
background-color: #fff;
color: #f00;
}
.red-cancel {
display:inline;
padding: .1rem .5rem;
margin-left: 2rem;
border: 2px solid #fff;
border-radius: .3rem;
background-color: #fff;
color: var(--text-color);
font-size: .8rem;
}
.red-cancel:hover {
color: #f00;
}
</style>
<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=Noto+Sans+Mono:wdth,wght@62.5..100,100..900&family=Noto+Sans:ital,wdth,wght@0,62.5..100,100..900;1,62.5..100,100..900&display=swap" rel="stylesheet">
</head>
<body x-init="() => {const m = localStorage.getItem('colorMode');
if (m !== 'dark' && m !== 'light') return;
mode = m;
document.head.querySelectorAll('.meta-theme').forEach((el) => {
el.setAttribute('content', el.getAttribute('data-' + m));
});
}"
class="h-screen bg-gray-200 dark:bg-black{% if DEBUG %} DEBUG{% endif %}" {% block body_id %}{% endblock %}>
<div class="modal-overlay" id="modalOverlay"><div class="modal-content"><iframe id="modalFrame" class="w-full h-full rounded-xl m-0 p-0"></iframe><div class="modal-close" id="modalClose" onclick="closeModal()"><i class="fa-solid fa-xmark fa-lg"></i></div></div></div>
{% block main_content_wrapper %}<div class="max-w-7xl md:px-3 mx-auto transition-all">{% endblock %}
{% block content_header %}
{% include "includes/_header.html" %}
{% endblock %}
<div class="w-full">
{% block messages %}{% include "partials/messages.html" %}{% endblock messages %}
</div>
{% if request.user.is_authenticated and request.user.delete_permanently_at %}
<div id="messages" class="w-full text-center transition-opacity" x-data="{show: true}">
<div x-show="show" class="mx-auto text-left items-center text-white rounded text-base px-3 py-2 bg-red-500 fade show">
<button type="button"
class="float-right"
data-dismiss="alert"
aria-hidden="true"
x-on:click="show = ! show"
><i class="fas fa-times-circle"></i></button>
<div class="toast-text">
Your account is scheduled for deletion at
{{ request.user.delete_permanently_at|date:'N j, Y, P e' }}
<button class="red-cancel"><a href="{% url "profile-cancel-delete" %}">Cancel Deletion</a></button>
<button class="red-delete"><a href="{% url "profile-delete-immediately" %}">Delete Now</a></button>
</div>
</div>
</div>
{% endif %}
<div class="md:px-0 min-vh-110">
{% block content_wrapper %}
{% block subnav %}{% endblock %}
{% block content %}{% endblock %}
{% endblock %}
</div>
{% if not hide_footer %}
{% include "includes/_footer.html" %}
{% endif %}
</div>
{% block footer_js %}{% endblock %}
<script>
var r = document.querySelector(':root');
const messageVisibilitySeconds = 6;
const opacityTransitionTime = 0.15; // matches the tailwind transition-opacity time
const delay = ms => new Promise(res => setTimeout(res, ms));
function modalSize(h,w) {
var rs = getComputedStyle(r);
r.style.setProperty('--modalWidth', w);
r.style.setProperty('--modalHeight', h);
}
/********* Function to open modal ***********/
function displayModal(height,width,src) {
event.preventDefault()
let modal = document.getElementById('modalOverlay');
modal.classList.add('show-modal');
modalSize(height,width);
let modalframe = document.getElementById('modalFrame');
modalframe.setAttribute("src", src);
}
function closeModal() {
let modal = document.getElementById('modalOverlay');
modal.classList.remove('show-modal');
}
const hideMessage = async () => {
const message = document.getElementById('messages');
message.classList.add('opacity-0');
await delay(opacityTransitionTime * 1000);
const messageButton = message.querySelector('button');
if (messageButton) {
messageButton.click();
}
}
const providerMatchesLastLogin = async (provider) => {
const lastLoginProvider = localStorage.getItem('boostLoginMethod') || null;
return provider === lastLoginProvider;
}
const trackLoginUpdateCheck = async () => {
const footer = document.querySelector('footer');
if (!footer) {
return;
}
const indicator = footer.dataset.trackLoginMethod; // intentionally not cast to boolean
const loginMethod = footer.dataset.loginMethod;
if (indicator) {
if (indicator === 'True') {
localStorage.setItem('boostLoginMethod', loginMethod);
} else {
localStorage.removeItem('boostLoginMethod');
}
}
}
const changeVersionAndCategory = (event) => {
const urlPatterns = {
libraries: {
regex: /^(https?:\/\/[\S:]+\/libraries\/)([^\/]+)(\/?[a-z]*)(\/?\S*)?\/?$/,
substitution: (event) => {
switch (event.target.id) {
case 'id_category':
return `$1$2$3${event.target.value ? `/${event.target.value}` : ''}/`;
case 'id_version':
return `$1${event.target.value}$3$4`;
default:
return null;
}
}
},
library: {
regex: /^(https?:\/\/[\S:]+\/library\/)([^\/]+)\/([^\/]+)\/?$/,
substitution: (event) => `$1${event.target.value}/$3/`
},
releases: {
regex: /^(https?:\/\/[\S:]+\/releases\/)([^\/]+)?\/?$/,
substitution: (event) => `$1${event.target.value}/`
}
};
const currentUrl = window.location.href;
for (const key in urlPatterns) {
const pattern = urlPatterns[key];
if (pattern.regex.test(currentUrl)) {
const substitutionString = pattern.substitution(event);
if (substitutionString) {
window.location.href = currentUrl.replace(pattern.regex, substitutionString);
}
break;
}
}
}
const manualPlausibleTrigger = async () => {
window.plausible = window.plausible || function() {
(window.plausible.q = window.plausible.q || []).push(arguments)
}
let loc = window.parent.location.href || window.location.href;
plausible("pageview", { u: loc + window.location.search });
};
window.addEventListener('DOMContentLoaded', () => {
// resets the form on back button press
document.getElementById("id_category")?.closest('form').reset();
document.getElementById("id_version")?.closest('form').reset();
document.getElementById("id_category")?.addEventListener("change", changeVersionAndCategory);
document.getElementById("id_version")?.addEventListener("change", changeVersionAndCategory);
manualPlausibleTrigger();
});
(async () => {
await trackLoginUpdateCheck();
await delay(messageVisibilitySeconds * 1000);
await hideMessage();
})();
</script>
</body>
</html>