lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

base.html (2839B)


      1 <!DOCTYPE html>
      2 <html lang="{{ lang }}">
      3   <head>
      4     <title>{% block title %}{% endblock title %}</title>
      5     <meta charset="utf-8">
      6     <meta name="viewport" content="width=device-width, initial-scale=1.0">
      7     <!-- For browsers without prefers-color-scheme, change theme based on time of day -->
      8     <script type="text/javascript">
      9       if (window.matchMedia('(prefers-color-scheme: dark)').media === 'not all') {
     10         document.documentElement.style.display = 'none';
     11         var hour = new Date().getHours();
     12         var sheet = (hour >= 20 || hour < 6) ? "/dark.css" : "/light.css";
     13         document.head.insertAdjacentHTML(
     14           'beforeend',
     15           '<link rel="stylesheet" type="text/css" href="'+sheet+'" onload="document.documentElement.style.display = \'\'">'
     16         );
     17       }
     18     </script>
     19     <!-- For browsers without JS, load the light theme -->
     20     <noscript><link rel="stylesheet" type="text/css" href="/light.css"></noscript>
     21     <!-- For browsers supporting prefers-color-scheme, use that -->
     22     <link rel="stylesheet" type="text/css" href="/dark.css" media="(prefers-color-scheme: dark)">
     23     <link rel="stylesheet" type="text/css" href="/light.css" media="(prefers-color-scheme: light)">
     24     {% block scripts %}{% endblock scripts %}
     25 
     26     <!-- PWA stuff -->
     27     <link rel="manifest" href="/manifest.json">
     28     <script src="/sw.js"></script>
     29     <script>
     30       if ('serviceWorker' in navigator) {
     31         navigator.serviceWorker.register('/sw.js')
     32           .then(function(registration) {
     33             console.log('Registration successful, scope is:', registration.scope);
     34           })
     35           .catch(function(error) {
     36             console.log('Service worker registration failed, error:', error);
     37           });
     38       }
     39     </script>
     40   </head>
     41   <body>
     42     {% if page %}
     43     <img src="https://stats.alex.balgavy.eu/count?p={{ config.base_url | replace(from='https://', to='/') }}{{ page.path }}&t={{ page.title }}">
     44     {% elif section %}
     45     <img src="https://stats.alex.balgavy.eu/count?p={{ config.base_url | replace(from='https://', to='/') }}{{ section.path }}&t={{ section.title }}">
     46     {% endif %}
     47 
     48     {% if config.extra.debug %}
     49     <div>
     50       <font size="1px" face="courier">
     51         <pre>{{ __tera_context | striptags }}</pre>
     52       </font>
     53     </div>
     54     {% endif %}
     55     <div class="wrapper">
     56       <header>
     57         {% block sidebar %}
     58         {% endblock sidebar %}
     59         <noscript>
     60           <p>
     61             In GUI browsers, I have this page themed dynamically, so when it's dark outside, you'll get a dark theme.
     62             You need JS enabled if you want the dynamic theme; I don't run any JS-based analytics or tracking.
     63           </p>
     64         </noscript>
     65       </header>
     66       <section>
     67         {% block content %}{% endblock content %}
     68       </section>
     69     </div>
     70   </body>
     71 </html>