base.html (5610B)
1 {% from "_listing.html" import footer_stats %} 2 {% from "_skeleton.html" import file_skeleton %} 3 {#- Shared page layout. Child templates set `page_title` (and optionally `page_description`) at the top level and 4 fill `head_extra`, `page_class`, `content` and `scripts`. Everything shared (head, header, breadcrumb, footer, 5 dialogs, toasts) lives here so a change is made once. 6 The three pieces the fast-navigation code depends on are kept intact: the <!--@breadcrumb--> slot 7 (_breadcrumb.html), the <!--@stats--> slot (footer below) and <meta name="cdn-fast"> opt-out. -#} 8 {% set site_name = 'amit/cdn' %} 9 {% set full_title = (page_title ~ ' · ' ~ site_name) if page_title else site_name %} 10 {% set description = page_description or "Static file host for amit's projects. Browse, upload, and grab direct links." %} 11 <!DOCTYPE html> 12 <html lang="en"> 13 <head> 14 <meta charset="UTF-8"> 15 <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"> 16 <title>{{ full_title }}</title> 17 <meta name="description" content="{{ description }}"> 18 19 <link rel="icon" href="/favicon.ico" sizes="any"> 20 <link rel="icon" type="image/png" sizes="32x32" href="/static/icons/favicon-32x32.png"> 21 <link rel="icon" type="image/png" sizes="16x16" href="/static/icons/favicon-16x16.png"> 22 <link rel="icon" type="image/svg+xml" href="/static/icons/logo.svg"> 23 <link rel="apple-touch-icon" sizes="180x180" href="/static/icons/apple-touch-icon.png"> 24 25 <link rel="manifest" href="/static/manifest.json"> 26 <meta name="theme-color" content="#fafaf9" media="(prefers-color-scheme: light)"> 27 <meta name="theme-color" content="#0f1012" media="(prefers-color-scheme: dark)"> 28 <meta name="color-scheme" content="light dark"> 29 <meta name="apple-mobile-web-app-capable" content="yes"> 30 <meta name="mobile-web-app-capable" content="yes"> 31 <meta name="apple-mobile-web-app-status-bar-style" content="default"> 32 <meta name="apple-mobile-web-app-title" content="{{ site_name }}"> 33 34 <meta property="og:site_name" content="{{ site_name }}"> 35 <meta property="og:title" content="{{ full_title }}"> 36 <meta property="og:description" content="{{ description }}"> 37 <meta property="og:image" content="{{ (cdn_base_url ~ '/static/icons/og-logo.png') if cdn_base_url else '/static/icons/og-logo.png' }}"> 38 <meta property="og:type" content="website"> 39 <meta name="twitter:card" content="summary"> 40 41 {#- Applies the saved (or system) colour theme before first paint, so there is no flash. Identical on every 42 page, so Turbo treats it as already-run. app.js owns the toggle. -#} 43 <script> 44 (function () { 45 document.documentElement.setAttribute('data-js', ''); 46 try { 47 var t = localStorage.getItem('cdn_theme'); 48 if (t !== 'light' && t !== 'dark') t = matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; 49 document.documentElement.setAttribute('data-theme', t); 50 if (localStorage.getItem('cdn_notice_off_v1') === '1') document.documentElement.setAttribute('data-notice', 'off'); 51 } catch (e) {} 52 })(); 53 </script> 54 55 <script type="module" src="https://cdn.jsdelivr.net/npm/@hotwired/turbo@8.0.4/dist/turbo.es2017-esm.js"></script> 56 <link rel="stylesheet" href="/static/app.css?v={{ asset_v }}"> 57 <script src="/static/app.js?v={{ asset_v }}" defer></script> 58 <script src="/static/prefetch.js" defer></script> 59 <script src="/static/fasttree.js" defer></script> 60 {% block head_extra %}{% endblock %} 61 </head> 62 <body data-page="{{ page }}"> 63 <a class="skip-link" href="#main">Skip to content</a> 64 {% include "_navbar.html" %} 65 {% include "_breadcrumb.html" %} 66 67 <main id="main" class="page {% block page_class %}{% endblock %}" tabindex="-1"> 68 {% block content %}{% endblock %} 69 </main> 70 71 <footer class="site-footer"> 72 <div class="site-footer__inner"> 73 <p class="site-footer__about"> 74 amit/cdn · built by <a href="https://github.com/notamitgamer">notamitgamer</a><br> 75 nothing here is a permanent fixture. 76 </p> 77 {% if skeleton %}<!--@stats-->{% elif repo_file_count is defined and repo_file_count is not none %} 78 {{ footer_stats(repo_file_count, '' if repo_file_count == 1 else 's', repo_size_str) }} 79 {% endif %} 80 </div> 81 </footer> 82 83 <dialog id="zip-dialog" class="dialog" aria-labelledby="zip-dialog-title"> 84 <div class="dialog__body"> 85 <h2 id="zip-dialog-title">Download as .zip</h2> 86 <p id="zip-dialog-text"></p> 87 <div class="dialog__actions"> 88 <button type="button" class="btn" data-action="dialog-close">Cancel</button> 89 <a href="#" class="btn btn-primary" id="zip-dialog-confirm" data-turbo="false" data-action="dialog-close">Download (.zip)</a> 90 </div> 91 </div> 92 </dialog> 93 <dialog id="error-dialog" class="dialog" aria-labelledby="error-dialog-title"> 94 <div class="dialog__body"> 95 <h2 id="error-dialog-title">Something went wrong</h2> 96 <p id="error-dialog-text"></p> 97 <div class="dialog__actions"> 98 <button type="button" class="btn" data-action="dialog-close">Close</button> 99 </div> 100 </div> 101 </dialog> 102 103 <template id="file-skel-tpl">{{ file_skeleton() }}</template> 104 <div id="toasts" class="toasts" role="status" aria-live="polite"></div> 105 {% block scripts %}{% endblock %} 106 </body> 107 </html>