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">
|
||||
<script>
|
||||
const yasgui = {};
|
||||
function setYasguiQuery(yasguiId, tabName, query) {
|
||||
function setYasguiQuery(yasguiId, tabName, query, endpoint) {
|
||||
let yasguiInstance = yasgui[yasguiId];
|
||||
let tab = yasguiInstance.getTab(tabName);
|
||||
if (!tab) {
|
||||
tab = yasguiInstance.addTab(true, {
|
||||
...Yasgui.Tab.getDefaults(),
|
||||
requestConfig: yasguiInstance.config.requestConfig,
|
||||
requestConfig: endpoint ? {endpoint: endpoint} : yasguiInstance.config.requestConfig,
|
||||
name: tabName,
|
||||
id: tabName });
|
||||
id: tabName
|
||||
});
|
||||
}
|
||||
tab.setQuery(query);
|
||||
tab.yasqe.query();
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
{{ highlight $q "sparql" }}
|
||||
<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>
|
|
@ -15,16 +15,22 @@
|
|||
copyEndpointOnNewTab: false,
|
||||
yasqe: {
|
||||
theme: "{{ .Site.Params.CodeMirrorTheme }}",
|
||||
{{ with .Get "default-query" }}
|
||||
value: {{ . }}
|
||||
{{ with .Inner }}
|
||||
value: {{ trim . "\n" }}
|
||||
{{ end }}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
{{ if .Get "endpoint" }}
|
||||
|
||||
<style>
|
||||
{{- if .Get "endpoint" }}
|
||||
#yasgui-{{ .Get "id" }} .yasgui .autocompleteWrapper {
|
||||
display: none !important;
|
||||
}
|
||||
{{- end -}}
|
||||
{{ if not (default true (.Get "tab")) }}
|
||||
#yasgui-{{ .Get "id" }} .yasgui .tabsList {
|
||||
display: none !important;
|
||||
}
|
||||
{{- end }}
|
||||
</style>
|
||||
{{ end }}
|
Loading…
Reference in a new issue