all repos — legit @ 396548546ed56088cc837080fe44a963199ed7ff

Unnamed repository; edit this file 'description' to name the repository.

templates/head.html (view raw)

 1{{ define "head" }}
 2  <head>
 3    <meta charset="utf-8">
 4    <meta name="viewport" content="width=device-width, initial-scale=1">
 5    <link rel="stylesheet" href="/static/style.css" type="text/css">
 6    <link rel="icon" type="{{ .meta.FaviconType }}" href="{{ .meta.FaviconHref }}">
 7    {{ if .parent }}
 8    <title>{{ .meta.Title }} &mdash; {{ .name }} ({{ .ref }}): {{ .parent }}/</title>
 9
10    {{ else if .path }}
11    <title>{{ .meta.Title }} &mdash; {{ .name }} ({{ .ref }}): {{ .path }}</title>
12    {{ else if .files }}
13    <title>{{ .meta.Title }} &mdash; {{ .name }} ({{ .ref }})</title>
14    {{ else if .commit }}
15    <title>{{ .meta.Title }} &mdash; {{ .name }}: {{ .commit.This }}</title>
16    {{ else if .branches }}
17    <title>{{ .meta.Title }} &mdash; {{ .name }}: refs</title>
18    {{ else if .commits }}
19    {{ if .log }}
20    <title>{{ .meta.Title }} &mdash; {{ .name }}: log</title>
21    {{ else }}
22    <title>{{ .meta.Title }} &mdash; {{ .name }}</title>
23    {{ end }}
24    {{ else }}
25    <title>{{ .meta.Title }}</title>
26    {{ end }}
27    {{ if and .servername .gomod }}
28    <meta name="go-import" content="{{ .servername}}/{{ .name }} git https://{{ .servername }}/{{ .name }}">
29    {{ end }}
30    <!-- other meta tags here -->
31    <script>
32    (function() {
33      function getCookie(name) {
34        var m = document.cookie.match('(?:^|;)\\s*' + name + '\\s*=\\s*([^;]*)');
35        return m ? m[1] : null;
36      }
37      var theme = getCookie('theme') || 'system';
38
39      // Apply theme to <html> immediately (prevents flash of wrong theme)
40      if (theme === 'dark') document.documentElement.setAttribute('data-theme', 'dark');
41      else if (theme === 'light') document.documentElement.setAttribute('data-theme', 'light');
42      else document.documentElement.removeAttribute('data-theme');
43
44      function updateButton(t) {
45        var btn = document.getElementById('theme-toggle');
46        if (btn) {
47          btn.className = 'theme-' + t;
48          btn.textContent = t;
49        }
50      }
51
52      // Update button once DOM is ready
53      if (document.readyState === 'loading') {
54        document.addEventListener('DOMContentLoaded', function() { updateButton(theme); });
55      } else {
56        updateButton(theme);
57      }
58
59      window.__themeState = theme;
60      window.__themeApply = function(t) {
61        if (t === 'dark') document.documentElement.setAttribute('data-theme', 'dark');
62        else if (t === 'light') document.documentElement.setAttribute('data-theme', 'light');
63        else document.documentElement.removeAttribute('data-theme');
64        updateButton(t);
65        window.__themeState = t;
66      };
67    })();
68    function cycleTheme() {
69      var cur = window.__themeState || 'system';
70      var next = cur === 'system' ? 'light' : cur === 'light' ? 'dark' : 'system';
71      document.cookie = 'theme=' + next + '; path=/; max-age=31536000; SameSite=Lax';
72      window.__themeApply(next);
73    }
74    </script>
75  </head>
76{{ end }}