lodc2022-culture-art/layouts/partials/docs/inject/head.html

41 lines
1.3 KiB
HTML
Raw Normal View History

2022-09-05 03:52:33 +09:00
{{ if .HasShortcode "yasgui" }}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@triply/yasgui@4.2.27/build/yasgui.min.css" />
<script src="https://cdn.jsdelivr.net/npm/@triply/yasgui@4.2.27/build/yasgui.min.js"></script>
2022-09-05 21:46:32 +09:00
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/theme/{{ .Site.Params.CodeMirrorTheme }}.css">
2022-09-05 03:52:33 +09:00
<script>
const yasgui = {};
2022-09-07 02:06:42 +09:00
function setYasguiQuery(yasguiId, tabName, query, endpoint) {
2022-09-05 03:52:33 +09:00
let yasguiInstance = yasgui[yasguiId];
let tab = yasguiInstance.getTab(tabName);
if (!tab) {
tab = yasguiInstance.addTab(true, {
...Yasgui.Tab.getDefaults(),
2022-09-07 02:06:42 +09:00
requestConfig: endpoint ? {endpoint: endpoint} : yasguiInstance.config.requestConfig,
2022-09-05 03:52:33 +09:00
name: tabName,
2022-09-07 02:06:42 +09:00
id: tabName
});
2022-09-05 03:52:33 +09:00
}
2022-09-08 03:36:10 +09:00
try {
tab.setQuery(query);
} catch (error) {
tab.close();
tab = yasguiInstance.addTab(true, {
...Yasgui.Tab.getDefaults(),
requestConfig: endpoint ? {endpoint: endpoint} : yasguiInstance.config.requestConfig,
name: tabName,
id: tabName
});
}
2022-09-05 03:52:33 +09:00
tab.yasqe.query();
}
</script>
<style>
.yasr table.dataTable {
max-width: 100%;
}
.yasr table.dataTable tbody td {
padding: 2px 4px;
font-size: 90%;
}
</style>
{{ end }}