Skip to content

Commit fe830fb

Browse files
chore (refactoring): main html cleanup
1 parent 67275e3 commit fe830fb

File tree

3 files changed

+209
-204
lines changed

3 files changed

+209
-204
lines changed

public/index.frontoffice.html

Lines changed: 1 addition & 203 deletions
Original file line numberDiff line numberDiff line change
@@ -8,209 +8,7 @@
88
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
99
<link rel="icon" href="favicon.ico">
1010
<title></title>
11-
<script>
12-
{{ if eq .license "agpl" }}
13-
class ComponentBootScreen extends HTMLElement {
14-
connectedCallback() {
15-
this.innerHTML = this.render();
16-
this.timeout = setTimeout(function(){
17-
const $rbw = document.querySelector("#rbw .w");
18-
$rbw.innerHTML = $rbw.innerHTML.repeat(10);
19-
20-
const $loader = document.querySelector("#n-lder");
21-
$loader.classList.add("loading");
22-
}, 500);
23-
}
24-
25-
disconnectedCallback() {
26-
clearTimeout(this.timeout);
27-
}
28-
29-
render() {
30-
return `
31-
<style>
32-
html{ overflow: hidden; }
33-
body{ background: #f2f3f5; color: #375160; }
34-
body.dark-mode{ background: #232426; }
35-
.background-color{ background: #f2f3f5; }
36-
body.dark-mode .background-color{ background: #232426; }
37-
</style>
38-
<style>
39-
#n-lder{ max-width: 100%; overflow: hidden; }
40-
#n-lder #cat{ position: absolute; top: calc(50% + 45px); left: 0%; margin-left: -250px; margin-top: -125px; width: 100%; height: 150px; }
41-
#n-lder.loading #cat{ left: 20%; left: calc(50% + 125px); transition: left 4s ease-out; }
42-
#n-lder.loading.done #cat { left: 100%; left: calc(100% + 250px); transition: left 0.5s linear; }
43-
#n-lder #cat svg{ height: 160px; width: 250px; position: absolute; }
44-
#n-lder #cat #hide-behind{ position: absolute; top: 0; left: 55px; bottom: 0; right: -250px; }
45-
46-
#n-lder #rbw{ position: absolute; top: calc(50% + 45px); left: 0; overflow: hidden; height: 145px; margin-top: -110px; width: 100%; }
47-
#n-lder #rbw .w{ width: 10000px; }
48-
#n-lder #rbw .rbw { z-index: -1; font-size: 16em; float: left; position: relative; }
49-
#n-lder #rbw .rbw .wv { height: 20px; width: 55px; }
50-
#n-lder #rbw .rbw .wv.wv-1 { background: #ff0000; }
51-
#n-lder #rbw .rbw .wv.wv-2 { background: #ff9900; }
52-
#n-lder #rbw .rbw .wv.wv-3 { background: #ffff00; }
53-
#n-lder #rbw .rbw .wv.wv-4 { background: #33ff00; }
54-
#n-lder #rbw .rbw .wv.wv-5 { background: #0099ff; }
55-
#n-lder #rbw .rbw .wv.wv-6 { background: #6633ff; }
56-
57-
#n-lder #rbw .rbw{ top: 0px; animation: rbw .6s linear infinite; }
58-
#n-lder #rbw .rbw.f1{ animation-delay: 0s; }
59-
#n-lder #rbw .rbw.f2{ animation-delay: 0.1s; }
60-
#n-lder #rbw .rbw.f3{ animation-delay: 0.2s; }
61-
#n-lder #rbw .rbw.f4{ animation-delay: 0.3s; }
62-
#n-lder #rbw .rbw.f5{ animation-delay: 0.4s; }
63-
#n-lder #rbw .rbw.f6{ animation-delay: 0.5s; }
64-
@keyframes rbw {
65-
0%{ top: 0px; }
66-
50%{ top: 15px; }
67-
100%{ top: 0px; }
68-
}
69-
@keyframes nyan_all {
70-
0%{ transform: translateY(0px); }
71-
33%{ transform: translateY(0px); }
72-
34%{ transform: translateY(1px); }
73-
100%{ transform: translateY(1px); }
74-
} #n-lder svg g#nyan_all{ animation: nyan_all 0.40s linear infinite; }
75-
@keyframes nyan_head {
76-
0%{ transform: translateX(0px) translateY(0px); }
77-
16%{ transform: translateX(0px) translateY(0px); }
78-
17%{ transform: translateX(1px) translateY(0px); }
79-
66%{ transform: translateX(1px) translateY(0px); }
80-
67%{ transform: translateX(0px) translateY(0px); }
81-
83%{ transform: translateX(0px) translateY(0px); }
82-
84%{ transform: translateX(0px) translateY(-1px); }
83-
100%{ transform: translateX(0px) translateY(-1px); }
84-
} #n-lder svg g#nyan_head{ animation: nyan_head 0.4s linear infinite; }
85-
@keyframes nyan_walk {
86-
0%{ transform: translateX(0px); }
87-
16%{ transform: translateX(0px); }
88-
17%{ transform: translateX(1px); }
89-
33%{ transform: translateX(1px); }
90-
34%{ transform: translateX(2px); }
91-
50%{ transform: translateX(2px); }
92-
51%{ transform: translateX(1px); }
93-
100%{ transform: translateX(0px); }
94-
} #n-lder svg g#nyan_feet{ animation: nyan_walk 0.5s linear infinite; }
95-
@keyframes nyan_tail {
96-
0%{ transform: rotate(0); }
97-
16%{ transform: rotate(0); }
98-
17%{ transform: rotate(-5deg); }
99-
33%{ transform: rotate(-5deg); }
100-
34%{ transform: rotate(-10deg); }
101-
49%{ transform: rotate(-10deg); }
102-
50%{ transform: rotate(-20deg); }
103-
66%{ transform: rotate(-20deg); }
104-
67%{ transform: rotate(-10deg); }
105-
83%{ transform: rotate(-10deg); }
106-
84%{ transform: rotate(-5deg); }
107-
99%{ transform: rotate(-5deg); }
108-
100%{ transform: rotate(0deg); }
109-
} #n-lder svg g#nyan_tail{ animation: nyan_tail 0.5s linear infinite; transform-origin: 4px 8px; }
110-
</style>
111-
<div id="n-lder">
112-
<div id="cat">
113-
<div id="hide-behind" class="background-color"></div>
114-
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="32" height="21" preserveAspectRatio="xMinYMin meet" viewBox="0 0 33 21">
115-
<g id="nyan_all">
116-
<g id="nyan_feet">
117-
<g>
118-
<path d="m 4,20 0,-3 1,0 0,-1 4,0 0,3 -1,0 0,1 z" style="fill:#000000;"></path>
119-
<path d="m 5,19 0,-2 3,0 0,1 -1,0 0,1 z" style="fill:#999999;"></path>
120-
<path d="m 10,20 0,-2 4,0 0,1 -1,0 0,1 z" style="fill:#000000;"></path>
121-
<path d="m 11,18 2,0 0,1 -2,0 z" style="fill:#999999;"></path>
122-
</g>
123-
<g transform="matrix(-1,0,0,1,32,0)">
124-
<path d="m 10,20 0,-2 4,0 0,1 -1,0 0,1 z" style="fill:#000000;"></path>
125-
<path d="m 11,18 2,0 0,1 -2,0 z" style="fill:#999999;"></path>
126-
<path d="m 4,20 0,-3 1,0 0,-1 4,0 0,3 -1,0 0,1 z" style="fill:#000000;"></path>
127-
<path d="m 5,19 0,-2 3,0 0,1 -1,0 0,1 z" style="fill:#999999;"></path>
128-
</g>
129-
</g>
130-
<g id="nyan_tail">
131-
<path d="M 0,10 0,7 4,7 4,8 5,8 5,9 6,9 6,14 5,14 5,13 3,13 3,12 2,12 2,11 1,11 1,10 z" style="fill:#000000;" />
132-
<path d="m 1,9 0,-1 2,0 0,1 1,0 0,1 1,0 0,1 1,0 0,1 -2,0 0,-1 -1,0 0,-1 -1,0 0,-1 z" style="fill:#999999;" />
133-
</g>
134-
<g id="nyan_body">
135-
<path d="m 7,1 19,0 0,16 -19,0 z" style="fill:#ffcc99;" />
136-
<path d="m 8,14 0,-10 1,0 0,-1 1,0 0,-1 13,0 0,1 1,0 0,1 1,0 0,10 -1,0 0,1 -1,0 0,1 -13,0 0,-1 -1,0 0,-1 z" style="fill:#ff99ff;" />
137-
<path d="m 22,5 1,0 0,1 -1,0 z m -4,-2 1,0 0,1 -1,0 z m -3,0 1,0 0,1 -1,0 z m -1,4 1,0 0,1 -1,0 z m 1,3 1,0 0,1 -1,0 z m -2,3 1,0 0,1 -1,0 z m -2,-4 1,0 0,1 -1,0 z m -2,2 1,0 0,1 -1,0 z m 1,3 1,0 0,1 -1,0 z m 0,-10 1,0 0,1 -1,0 z" style="fill:#ff3399;" />
138-
<path d="m 8,17 17,0 0,1 -17,0 z m 0,-17 17,0 0,1 -17,0 z m 18,16 0,-14 1,0 0,14 z m -20,0 0,-14 1,0 0,14 z m 1,0 1,0 0,1 -1,0 z m 0,-15 1,0 0,1 -1,0 z m 18,0 1,0 0,1 -1,0 z m 0,15 1,0 0,1 -1,0 z" style="fill:#000000;" />
139-
</g>
140-
<g id="nyan_head">
141-
<path d="m 17,15 0,-5 1,0 0,-4 2,0 0,1 1,0 0,1 1,0 0,1 4,0 0,-1 1,0 0,-1 1,0 0,-1 2,0 0,4 1,0 0,5 -1,0 0,1 -1,0 0,1 -10,0 0,-1 -1,0 0,-1 z" style="fill:#999999;fill-opacity:1;stroke:none" />
142-
<path d="m 29,16 1,0 0,1 -1,0 z m 1,-1 1,0 0,1 -1,0 z m 1,-5 1,0 0,5 -1,0 z m -1,-4 1,0 0,4 -1,0 z m -2,-1 2,0 0,1 -2,0 z m -6,3 4,0 0,1 -4,0 z m -4,-3 2,0 0,1 -2,0 z m -1,1 1,0 0,4 -1,0 z m -1,4 1,0 0,5 -1,0 z m 11,-4 1,0 0,1 -1,0 z m -1,1 1,0 0,1 -1,0 z m -5,0 1,0 0,1 -1,0 z m -1,-1 1,0 0,1 -1,0 z m -1,11 10,0 0,1 -10,0 z m -1,-1 1,0 0,1 -1,0 z m -1,-1 1,0 0,1 -1,0 z" style="fill:#000000;fill-opacity:1;stroke:none" />
143-
<path d="m 18,13 2,0 0,2 -2,0 z" style="fill:#ff9999;fill-opacity:1;stroke:none" />
144-
<path d="m 29,13 2,0 0,2 -2,0 z" style="fill:#ff9999;fill-opacity:1;stroke:none" />
145-
<path d="m 21,16 0,-2 1,0 0,1 2,0 0,-1 1,0 0,1 2,0 0,-1 1,0 0,2 z" style="fill:#000000;fill-opacity:1;stroke:none" />
146-
<path d="m 25,12 1,0 0,1 -1,0 z" style="fill:#000000;fill-opacity:1;stroke:none" />
147-
<g>
148-
<path d="m 27,13 0,-1 1,0 0,-1 1,0 0,2 z" style="fill:#000000;fill-opacity:1;stroke:none" />
149-
<path d="m 27,11 1,0 0,1 -1,0 z" style="fill:#ffffff;fill-opacity:1;stroke:none" />
150-
<path d="m 20,13 0,-1 1,0 0,-1 1,0 0,2 z" style="fill:#000000;fill-opacity:1;stroke:none" />
151-
<path d="m 20,11 1,0 0,1 -1,0 z" style="fill:#ffffff;fill-opacity:1;stroke:none" />
152-
</g>
153-
</g>
154-
</g>
155-
</svg>
156-
</div>
157-
<div id="rbw">
158-
<div class="w">
159-
<div class="rbw f1">
160-
<div class="wv wv-1"></div><div class="wv wv-2"></div><div class="wv wv-3"></div>
161-
<div class="wv wv-4"></div><div class="wv wv-5"></div><div class="wv wv-6"></div>
162-
</div>
163-
<div class="rbw f2">
164-
<div class="wv wv-1"></div><div class="wv wv-2"></div><div class="wv wv-3"></div>
165-
<div class="wv wv-4"></div><div class="wv wv-5"></div><div class="wv wv-6"></div>
166-
</div>
167-
<div class="rbw f3">
168-
<div class="wv wv-1"></div><div class="wv wv-2"></div><div class="wv wv-3"></div>
169-
<div class="wv wv-4"></div><div class="wv wv-5"></div><div class="wv wv-6"></div>
170-
</div>
171-
<div class="rbw f4">
172-
<div class="wv wv-1"></div><div class="wv wv-2"></div><div class="wv wv-3"></div>
173-
<div class="wv wv-4"></div><div class="wv wv-5"></div><div class="wv wv-6"></div>
174-
</div>
175-
<div class="rbw f5">
176-
<div class="wv wv-1"></div><div class="wv wv-2"></div><div class="wv wv-3"></div>
177-
<div class="wv wv-4"></div><div class="wv wv-5"></div><div class="wv wv-6"></div>
178-
</div>
179-
<div class="rbw f6">
180-
<div class="wv wv-1"></div><div class="wv wv-2"></div><div class="wv wv-3"></div>
181-
<div class="wv wv-4"></div><div class="wv wv-5"></div><div class="wv wv-6"></div>
182-
</div>
183-
</div>
184-
</div>
185-
</div>`;
186-
}
187-
}
188-
{{ else }}
189-
class ComponentBootScreen extends HTMLElement {
190-
connectedCallback() {
191-
this.innerHTML = `<div class="component_loader">
192-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" style="width: 30px;">
193-
<circle fill="#57595A" stroke="#57595A" stroke-width="15" r="15" cx="40" cy="100">
194-
<animate attributeName="opacity" calcMode="spline" dur="2" values="1;0;1;" keySplines=".5 0 .5 1;.5 0 .5 1" repeatCount="indefinite" begin="-.4"></animate>
195-
</circle>
196-
<circle fill="#57595A" stroke="#57595A" stroke-width="15" r="15" cx="100" cy="100">
197-
<animate attributeName="opacity" calcMode="spline" dur="2" values="1;0;1;" keySplines=".5 0 .5 1;.5 0 .5 1" repeatCount="indefinite" begin="-.2"></animate>
198-
</circle>
199-
<circle fill="#57595A" stroke="#57595A" stroke-width="15" r="15" cx="160" cy="100">
200-
<animate attributeName="opacity" calcMode="spline" dur="2" values="1;0;1;" keySplines=".5 0 .5 1;.5 0 .5 1" repeatCount="indefinite" begin="0"></animate>
201-
</circle>
202-
</svg>
203-
<style>
204-
html, body, #app { height: 100%; margin: 0; }
205-
#app { display: flex; }
206-
component-bootscreen { margin: auto; }
207-
</style>
208-
</div>`;
209-
}
210-
}
211-
{{ end }}
212-
customElements.define("component-bootscreen", ComponentBootScreen);
213-
</script>
11+
<script>{{ if eq .license "agpl" }}{{ template "loader-cat" }}{{ else }}{{ template "loader-basic" }}{{ end }}</script>
21412
</head>
21513
<body>
21614
<div role="main" id="app">

server/ctrl/static.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ import (
2323

2424
var (
2525
WWWDir fs.FS
26+
2627
//go:embed static/www
2728
WWWEmbed embed.FS
2829

2930
//go:embed static/404.html
3031
HtmlPage404 []byte
32+
33+
//go:embed static/loader.html
34+
TmplLoader []byte
3135
)
3236

3337
func init() {
@@ -441,7 +445,10 @@ func ServeIndex(indexPath string) func(*App, http.ResponseWriter, *http.Request)
441445
}
442446
head.Set("Content-Type", "text/html")
443447
res.WriteHeader(http.StatusOK)
444-
template.Must(template.New(indexPath).Parse(string(b))).Execute(res, map[string]any{
448+
449+
tmpl := template.Must(template.New(indexPath).Parse(string(b)))
450+
tmpl = template.Must(tmpl.Parse(string(TmplLoader)))
451+
tmpl.Execute(res, map[string]any{
445452
"base": WithBase("/"),
446453
"version": BUILD_REF,
447454
"license": LICENSE,

0 commit comments

Comments
 (0)