mirror of
https://github.com/Babibubebon/lodc2022-culture-art.git
synced 2024-09-22 17:04:21 +09:00
update shortcodes for YASGUI
This commit is contained in:
parent
72211af79e
commit
09a2f01afc
3 changed files with 15 additions and 8 deletions
|
@ -4,15 +4,16 @@
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/theme/{{ .Site.Params.CodeMirrorTheme }}.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/theme/{{ .Site.Params.CodeMirrorTheme }}.css">
|
||||||
<script>
|
<script>
|
||||||
const yasgui = {};
|
const yasgui = {};
|
||||||
function setYasguiQuery(yasguiId, tabName, query) {
|
function setYasguiQuery(yasguiId, tabName, query, endpoint) {
|
||||||
let yasguiInstance = yasgui[yasguiId];
|
let yasguiInstance = yasgui[yasguiId];
|
||||||
let tab = yasguiInstance.getTab(tabName);
|
let tab = yasguiInstance.getTab(tabName);
|
||||||
if (!tab) {
|
if (!tab) {
|
||||||
tab = yasguiInstance.addTab(true, {
|
tab = yasguiInstance.addTab(true, {
|
||||||
...Yasgui.Tab.getDefaults(),
|
...Yasgui.Tab.getDefaults(),
|
||||||
requestConfig: yasguiInstance.config.requestConfig,
|
requestConfig: endpoint ? {endpoint: endpoint} : yasguiInstance.config.requestConfig,
|
||||||
name: tabName,
|
name: tabName,
|
||||||
id: tabName });
|
id: tabName
|
||||||
|
});
|
||||||
}
|
}
|
||||||
tab.setQuery(query);
|
tab.setQuery(query);
|
||||||
tab.yasqe.query();
|
tab.yasqe.query();
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
{{ highlight $q "sparql" }}
|
{{ highlight $q "sparql" }}
|
||||||
<a class="book-btn"
|
<a class="book-btn"
|
||||||
onclick="setYasguiQuery('{{ .Get "yasgui-id" }}', '{{ .Get "title" }}', '{{ $q }}'); location.href='#yasgui-{{ .Get "yasgui-id" }}'">
|
onclick="setYasguiQuery('{{ .Get "yasgui-id" }}', '{{ .Get "title" }}', '{{ $q }}', '{{ .Get "endpoint" }}'); location.href='#yasgui-{{ .Get "yasgui-id" }}'">
|
||||||
▶ 実行する
|
▶ 実行する
|
||||||
</a>
|
</a>
|
|
@ -15,16 +15,22 @@
|
||||||
copyEndpointOnNewTab: false,
|
copyEndpointOnNewTab: false,
|
||||||
yasqe: {
|
yasqe: {
|
||||||
theme: "{{ .Site.Params.CodeMirrorTheme }}",
|
theme: "{{ .Site.Params.CodeMirrorTheme }}",
|
||||||
{{ with .Get "default-query" }}
|
{{ with .Inner }}
|
||||||
value: {{ . }}
|
value: {{ trim . "\n" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{{ if .Get "endpoint" }}
|
|
||||||
<style>
|
<style>
|
||||||
|
{{- if .Get "endpoint" }}
|
||||||
#yasgui-{{ .Get "id" }} .yasgui .autocompleteWrapper {
|
#yasgui-{{ .Get "id" }} .yasgui .autocompleteWrapper {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
{{- end -}}
|
||||||
|
{{ if not (default true (.Get "tab")) }}
|
||||||
|
#yasgui-{{ .Get "id" }} .yasgui .tabsList {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
{{- end }}
|
||||||
</style>
|
</style>
|
||||||
{{ end }}
|
|
Loading…
Reference in a new issue