aboutsummaryrefslogtreecommitdiffstats
path: root/internal/port/tpl/startpage.html
diff options
context:
space:
mode:
authorFeuerfuchs <git@feuerfuchs.dev>2020-05-18 16:12:43 +0200
committerFeuerfuchs <git@feuerfuchs.dev>2020-05-18 16:12:43 +0200
commitac770231436f8a17d348a6a0ab934429df3c57d0 (patch)
tree50e14597a6b20a464882b123275f76b906616af7 /internal/port/tpl/startpage.html
parentWIP: Refactoring (diff)
downloadgopherproxy-ac770231436f8a17d348a6a0ab934429df3c57d0.tar.gz
gopherproxy-ac770231436f8a17d348a6a0ab934429df3c57d0.tar.bz2
gopherproxy-ac770231436f8a17d348a6a0ab934429df3c57d0.zip
WIP: Refactoring
Diffstat (limited to 'internal/port/tpl/startpage.html')
-rw-r--r--internal/port/tpl/startpage.html120
1 files changed, 15 insertions, 105 deletions
diff --git a/internal/port/tpl/startpage.html b/internal/port/tpl/startpage.html
index 8482a6f..cfe519d 100644
--- a/internal/port/tpl/startpage.html
+++ b/internal/port/tpl/startpage.html
@@ -3,118 +3,28 @@
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1" /> 5 <meta name="viewport" content="width=device-width, initial-scale=1" />
6 <title>{{ .Title }}{{ if ne .Protocol "startpage" }} - {{ .Protocol | title }} proxy{{ end }}</title> 6 <title>{{ .Title }}</title>
7 <link rel="stylesheet" href="{{ .Assets.Style }}" /> 7 <link rel="stylesheet" href="{{ .Assets.Style }}" />
8 <style> 8 {{- template "_fonts.html" . -}}
9 @font-face {
10 font-family: 'Iosevka Term SS03';
11 font-style: normal;
12 font-weight: normal;
13 src: url('{{ .Assets.FontW2 }}') format('woff2'),
14 url('{{ .Assets.FontW }}') format('woff');
15 }
16 @font-face {
17 font-family: 'Iosevka Aile';
18 font-style: normal;
19 font-weight: normal;
20 src: url('{{ .Assets.PropFontW2 }}') format('woff2'),
21 url('{{ .Assets.PropFontW }}') format('woff');
22 }
23 </style>
24 </head> 9 </head>
25 <body class="{{ if not .Lines }}is-plain{{ end }}"> 10 <body class="is-plain">
26 <header class="header header-base"> 11 <header class="header header-base">
27 <div class="location"> 12 <div class="location">
28 <a class="location__prefix">{{ .Protocol }}://</a><a class="location__prefix location__prefix--mobile">://</a> 13 <a class="location__prefix">start://</a><a class="location__prefix location__prefix--mobile">://</a>
29 14 </div>
30 {{- if .URI -}} 15 <div class="actions">
31 {{- $page := . -}} 16 <div class="action"><button class="settings-btn">Settings</button></div>
32 {{- $href := printf "/%s" .Protocol -}} 17 </div>
33 {{- $uriParts := split .URI "/" -}} 18 </header>
34
35 {{- $uriLast := $uriParts | last -}}
36 {{- $uriParts = $uriParts | pop -}}
37 {{- if eq $uriLast "" -}}
38 {{- $uriLast = $uriParts | last -}}
39 {{- $uriParts = $uriParts | pop -}}
40 {{- end -}}
41 19
42 {{- range $i, $part := $uriParts -}}
43 {{- if and (eq $page.Protocol "gopher") (eq $i 1) -}}
44 {{- $href = printf "%s/1" $href -}}
45 {{- $part = $part | trimLeftChar -}}
46 {{- if not (eq $part "") -}}
47 {{- $href = printf "%s/%s" $href $part -}}
48 <span class="location__slash">/</span><a href="{{ $href }}/" class="location__uripart">{{ $part }}</a>
49 {{- end -}}
50 {{- else -}}
51 {{- $href = printf "%s/%s" $href . -}}
52 {{- if ne $i 0 -}}
53 <span class="location__slash">/</span>
54 {{- end -}}
55 <a href="{{ $href }}/" class="location__uripart">{{ . }}</a>
56 {{- end -}}
57 {{- end -}}
58 {{- if ne (len $uriParts) 0 -}}
59 <span class="location__slash">/</span>
60 {{- end -}}
61 {{- if and (eq $page.Protocol "gopher") (eq (len $uriParts) 1) -}}
62 {{- $uriLast = $uriLast | trimLeftChar -}}
63 {{- end -}}
64 <span class="location__uripart">{{ $uriLast }}</span>
65 {{- end -}}
66 </div>
67 <div class="actions">
68 {{- if and (not .Lines) (not .Error) (eq .Protocol "gopher") -}}
69 <div class="action"><a href="/gopher/{{ .URI | replace "^([^/]*)/0" "$1/9" }}">View raw</a></div>
70 {{- end -}}
71 <div class="action"><button class="settings-btn">Settings</button></div>
72 </div>
73 </header>
74 <main class="wrap"> 20 <main class="wrap">
75 <pre class="content content--has-monospace-font{{ if .Lines }} content--has-type-annotations{{ end }}"> 21 <pre class="content content--has-monospace-font">
76 {{- if .Lines -}} 22 {{- .Content -}}
77 {{- $content := "" -}}
78 {{- range .Lines -}}
79 {{- if ne $content "" -}}
80 {{- $content = printf "%s\n" $content -}}
81 {{- end -}}
82 {{- if .Link -}}
83 {{- $content = printf "%s%s" $content (printf "<span class=\"type-annotation\">%s </span><a class=\"link link--%s\" href=\"%s\">%s</a>" .Type .Type .Link (.Text | HTMLEscape)) -}}
84 {{- else -}}
85 {{- $content = printf "%s%s" $content (printf "<span class=\"type-annotation\"> </span>%s" (.Text | HTMLEscape)) -}}
86 {{- end -}}
87 {{- end -}}
88 {{- $content | safeHtml -}}
89 {{- else -}}
90 {{- .RawText -}}
91 {{- end -}}
92 </pre> 23 </pre>
93 </main> 24 </main>
94 <aside class="modal modal--settings"> 25
95 <div class="modal__content"> 26 {{- template "_modals.html" . -}}
96 <header class="modal__head header-base"> 27
97 <h1 class="modal__title">Settings</h1>
98 <button class="modal__close-btn">Close</button>
99 </header>
100 <div class="setting setting--word-wrap">
101 <strong class="setting__label">Wrap wide content</strong>
102 <button class="setting__value">[N/A]</button>
103 </div>
104 <div class="setting setting--monospace-font">
105 <strong class="setting__label">Monospace font</strong>
106 <button class="setting__value">[N/A]</button>
107 </div>
108 <div class="setting setting--image-previews">
109 <strong class="setting__label">Image thumbnails</strong>
110 <button class="setting__value">[N/A]</button>
111 </div>
112 <div class="setting setting--clickable-plain-links">
113 <strong class="setting__label">Clickable links in text files</strong>
114 <button class="setting__value">[N/A]</button>
115 </div>
116 </div>
117 </aside>
118 <script src="{{ .Assets.JS }}"></script> 28 <script src="{{ .Assets.JS }}"></script>
119 </body> 29 </body>
120</html> 30</html>