lodc2022-culture-art/layouts/shortcodes/yasgui.html

37 lines
846 B
HTML
Raw Normal View History

2022-09-05 03:52:33 +09:00
<div>
{{ with .Get "endpoint" }}
<p>
Endpoint: <code>{{ . }}</code>
</p>
{{ end }}
<div id="yasgui-{{ .Get "id" }}"></div>
</div>
<script>
yasgui["{{ .Get "id" }}"] = new Yasgui(document.getElementById("yasgui-{{ .Get "id" }}"), {
requestConfig: {{ dict "endpoint" (.Get "endpoint") }},
persistenceId: "{{ .Get "id" }}",
2022-09-05 22:22:58 +09:00
autofocus: false,
2022-09-05 03:52:33 +09:00
copyEndpointOnNewTab: false,
yasqe: {
2022-09-05 21:46:32 +09:00
theme: "{{ .Site.Params.CodeMirrorTheme }}",
2022-09-07 02:06:42 +09:00
{{ with .Inner }}
value: {{ trim . "\n" }}
2022-09-05 03:52:33 +09:00
{{ end }}
},
});
</script>
2022-09-07 02:06:42 +09:00
2022-09-05 03:52:33 +09:00
<style>
2022-09-07 02:06:42 +09:00
{{- if .Get "endpoint" }}
2022-09-05 03:52:33 +09:00
#yasgui-{{ .Get "id" }} .yasgui .autocompleteWrapper {
display: none !important;
}
2022-09-07 02:06:42 +09:00
{{- end -}}
{{ if not (default true (.Get "tab")) }}
#yasgui-{{ .Get "id" }} .yasgui .tabsList {
display: none !important;
}
{{- end }}
2022-09-05 03:52:33 +09:00
</style>