mirror of
https://github.com/unmojang/drasl.git
synced 2025-08-03 19:06:04 -04:00
Fix skin-canvas visibility
skin-canvas is being hidden due to being part of noscript-hidden class. Added JS to remove skin-canvas from noscript-hidden class, because if SkinURL is set the skin-canvas will be drawn. When JS is disabled, this will not be executed and the canvas will remain hidden.
This commit is contained in:
parent
abc8d1e9b8
commit
d64ac097d9
@ -177,23 +177,28 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if .SkinURL }}
|
{{ if .SkinURL }}
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { skinview3d } from "{{.App.PublicURL}}/bundle.js"
|
import { skinview3d } from "{{.App.PublicURL}}/bundle.js"
|
||||||
const skinCanvas = document.getElementById("skin-canvas");
|
const skinCanvas = document.getElementById("skin-canvas");
|
||||||
const skinViewer = new skinview3d.SkinViewer({
|
const skinViewer = new skinview3d.SkinViewer({
|
||||||
canvas: skinCanvas,
|
canvas: skinCanvas,
|
||||||
width: 200,
|
width: 200,
|
||||||
height: skinCanvas.parentElement.clientHeight,
|
height: skinCanvas.parentElement.clientHeight,
|
||||||
});
|
});
|
||||||
skinViewer.controls.enableZoom = false;
|
skinViewer.controls.enableZoom = false;
|
||||||
skinViewer.loadSkin({{.SkinURL}}, {
|
skinViewer.loadSkin({{.SkinURL}}, {
|
||||||
model: "{{.Player.SkinModel}}",
|
model: "{{.Player.SkinModel}}",
|
||||||
});
|
});
|
||||||
{{if .CapeURL}}
|
{{if .CapeURL}}
|
||||||
skinViewer.loadCape({{.CapeURL}});
|
skinViewer.loadCape({{.CapeURL}});
|
||||||
{{end}}
|
{{end}}
|
||||||
skinViewer.render();
|
skinViewer.render();
|
||||||
</script>
|
|
||||||
|
var elements = document.getElementsByClassName('noscript-hidden');
|
||||||
|
for (var i = 0; i < elements.length; i++) {
|
||||||
|
elements[i].classList.remove('noscript-hidden');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ template "footer" . }}
|
{{ template "footer" . }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user