Merge pull request #133 from evan-goode/evan-goode/noscript-skin-view

noscript skin viewer fallback
This commit is contained in:
Evan Goode 2025-01-19 19:46:10 -05:00 committed by GitHub
commit 0282b27fc5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 38 additions and 2 deletions

View File

@ -238,6 +238,20 @@ pre {
display: inline-block; display: inline-block;
} }
.texture-preview {
width: 256px;
image-rendering: pixelated;
}
.small-texture-preview {
width: 64px;
image-rendering: pixelated;
}
.noscript-hidden {
display: none !important;
}
.list-profile-picture { .list-profile-picture {
--list-profile-picture-size: 24px; --list-profile-picture-size: 24px;
width: var(--list-profile-picture-size); width: var(--list-profile-picture-size);

View File

@ -27,6 +27,10 @@
<script type="module"> <script type="module">
import { background } from "{{.App.FrontEndURL}}/web/public/bundle.js"; import { background } from "{{.App.FrontEndURL}}/web/public/bundle.js";
background(document.querySelector("#background")); background(document.querySelector("#background"));
for (const el of document.querySelectorAll(".noscript-hidden")) {
el.classList.remove("noscript-hidden");
}
</script> </script>
{{ end }} {{ end }}
</body> </body>

View File

@ -19,8 +19,14 @@
<h6 style="text-align: center;">{{ .Player.UUID }}<br />{{ .PlayerID }}</h6> <h6 style="text-align: center;">{{ .Player.UUID }}<br />{{ .PlayerID }}</h6>
{{/* prettier-ignore-end */}} {{/* prettier-ignore-end */}}
{{ if .SkinURL }} {{ if .SkinURL }}
<div id="skin-container" style="height: 300px;"> <div id="skin-container" style="min-height: 300px;">
<canvas id="skin-canvas"></canvas> <noscript>
<img class="texture-preview" src="{{ .SkinURL }}">
{{ if .CapeURL }}
<img class="texture-preview" src="{{ .CapeURL }}">
{{ end }}
</noscript>
<canvas id="skin-canvas" class="noscript-hidden"></canvas>
</div> </div>
{{ else }} {{ else }}
No skin yet. No skin yet.
@ -45,6 +51,12 @@
{{ end }} {{ end }}
{{ if or .App.Config.AllowSkins .User.IsAdmin }} {{ if or .App.Config.AllowSkins .User.IsAdmin }}
<h4>Skin</h4> <h4>Skin</h4>
{{ if .SkinURL }}
<p>
<span style="vertical-align: top">Current skin: </span>
<img class="small-texture-preview" src="{{ .SkinURL }}">
</p>
{{ end }}
<p> <p>
<label for="skin-file">Upload a skin</label><br /> <label for="skin-file">Upload a skin</label><br />
<input type="file" name="skinFile" id="skin-file" /> <input type="file" name="skinFile" id="skin-file" />
@ -89,6 +101,12 @@
{{ end }} {{ end }}
{{ if or .App.Config.AllowCapes .User.IsAdmin }} {{ if or .App.Config.AllowCapes .User.IsAdmin }}
<h4>Cape</h4> <h4>Cape</h4>
{{ if .CapeURL }}
<p>
<span style="vertical-align: top">Current cape: </span>
<img class="small-texture-preview" src="{{ .CapeURL }}">
</p>
{{ end }}
<p> <p>
<label for="cape-file">Upload a cape</label><br /> <label for="cape-file">Upload a cape</label><br />
<input type="file" name="capeFile" id="cape-file" /> <input type="file" name="capeFile" id="cape-file" />