1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-12-30 19:18:21 +01:00
antd-web-apps/doc/views/default/layout.ls

235 lines
8.2 KiB
Plaintext
Raw Normal View History

2020-06-22 22:14:52 +02:00
<?lua
local tocdata = __main__:get("toc")
2020-06-24 19:19:20 +02:00
local elinks = __main__:get("elinks")
local has_3d = __main__:get("has_3d")
2020-09-22 17:58:37 +02:00
local url = __main__:get("url")
2021-02-07 13:44:15 +01:00
local show_toc_css = ''
if REQUEST.show_toc and REQUEST.show_toc == "false" then
show_toc_css = 'style="display:none;"'
end
2021-02-07 11:51:27 +01:00
local book_width_css='style="max-width:80%;"'
if HEADER.mobile then
book_width_css='style="max-width:95%;"'
end
2020-06-22 22:14:52 +02:00
?>
<!DOCTYPE html>
<html>
<head>
2021-02-07 12:36:52 +01:00
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
2020-06-24 19:00:41 +02:00
<link
rel="stylesheet"
type="text/css"
href="<?=HTTP_ROOT?>/rst/hljs/github.css" />
<link
rel="stylesheet"
type="text/css"
href="<?=HTTP_ROOT?>/rst/katex/katex.min.css" />
2020-09-22 17:58:37 +02:00
<script src="<?=HTTP_ROOT?>/rst/gscripts/jquery-3.2.1.min.js"> </script>
<?lua
if has_3d then
?>
<script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"></script>
<script nomodule src="https://unpkg.com/@google/model-viewer/dist/model-viewer-legacy.js"></script>
<?lua
end
?>
2020-06-24 19:00:41 +02:00
<script
src="<?=HTTP_ROOT?>/rst/hljs/highlight.pack.js"
></script>
<script
src="<?=HTTP_ROOT?>/rst/hljs/highlightjs-line-numbers.min.js"
></script>
2020-09-22 17:58:37 +02:00
<?lua
if url then
?>
<link rel="stylesheet" type="text/css" href="https://chat.iohub.dev/assets/quicktalk.css" />
<script src="https://chat.iohub.dev/assets/quicktalk.js"> </script>
<?lua
else
?>
2020-09-01 18:02:49 +02:00
<script>hljs.initHighlightingOnLoad();</script>
2020-09-22 17:58:37 +02:00
<?lua
end
?>
2020-06-24 19:00:41 +02:00
<script
src="<?=HTTP_ROOT?>/rst/katex/katex.min.js"
></script>
<script
src="<?=HTTP_ROOT?>/rst/katex/auto-render.min.js"
></script>
2020-06-22 22:14:52 +02:00
<link
rel="stylesheet"
type="text/css"
href="<?=HTTP_ROOT?>/assets/style.css" />
2020-12-09 11:22:51 +01:00
<link
rel="stylesheet"
type="text/css"
href="<?=HTTP_ROOT?>/assets/github-markdown.css" />
2020-06-22 22:14:52 +02:00
<link
rel="stylesheet"
type="text/css"
href="<?=HTTP_ROOT?>/rst/font-awesome.css" />
<link
rel="stylesheet"
type="text/css"
href="<?=HTTP_ROOT?>/rst/ubuntu-regular.css" />
<title>
<?lua
if tocdata then
echo(tocdata.data.name)
else
2020-12-22 13:57:23 +01:00
echo("Documentation Hub")
2020-06-22 22:14:52 +02:00
end
?>
</title>
</head>
<body>
<div id = "top">
2021-02-07 11:51:27 +01:00
<div id = "navbar" <?=book_width_css?>>
2021-02-07 13:23:46 +01:00
<?lua
if tocdata then
?>
<div class = "doc-toc-menu">
2020-06-22 22:14:52 +02:00
<?lua if tocdata then ?>
2021-02-07 13:23:46 +01:00
<a href ="#" id="btn_toc">
2020-06-22 22:14:52 +02:00
<?=tocdata.data.name?>
</a>
<?lua end ?>
</div>
2020-06-24 19:00:41 +02:00
<form id = "search_form" action="<?=HTTP_ROOT..'/'..tocdata.controller..'/search/'?>" method="get" class="search-form">
<input id = "search_box" name="q" type = "text" class = "search-box"></input>
2021-02-07 13:44:15 +01:00
<input name="show_toc" type = "hidden" value="false"></input>
2020-06-24 19:00:41 +02:00
</form>
2020-06-22 22:14:52 +02:00
<div class= "search-icon"></div>
2020-12-22 13:57:23 +01:00
<?lua
end
?>
2020-06-22 22:14:52 +02:00
</div>
</div>
<div id = "cover">
2021-02-07 11:51:27 +01:00
<div id = "book" <?=book_width_css?>>
2021-02-07 14:23:02 +01:00
<?lua if tocdata then ?>
2021-02-07 13:44:15 +01:00
<div id="doc_toc" class = "doc-toc" <?=show_toc_css?> >
2021-02-07 13:23:46 +01:00
<div class = "doc-name doc-toc-header">
2021-02-07 14:23:02 +01:00
<a href ="<?=HTTP_ROOT..'/'..tocdata.controller..'/'?>">
<?=tocdata.data.name?>
</a>
2021-02-07 13:23:46 +01:00
</div>
<?lua
if elinks then
for k,v in ipairs(elinks) do
?>
<div class = "doc-toc-header">
<a class = "x-link" target="_blank" href ="<?=v.url?>">
<?=v.name?>
</a>
</div>
<?lua
2021-02-07 14:23:02 +01:00
end
2021-02-07 13:23:46 +01:00
end
?>
<div class = "doc-toc-header doc-toc-legend">Table of content</div>
2020-12-22 13:57:23 +01:00
<?lua
if toc then
toc:set("data", tocdata)
toc:render()
end
?>
</div>
2021-02-07 11:35:26 +01:00
<div class="doc-content markdown-body" id="doc_content">
2020-12-22 13:57:23 +01:00
<?lua
if __main__ then
__main__:render()
end
?>
</div>
<?lua
else
?>
<div class="markdown-body">
<?lua
if __main__ then
__main__:render()
end
?>
2020-06-22 22:14:52 +02:00
</div>
2020-12-22 13:57:23 +01:00
<?lua end ?>
2020-06-22 22:14:52 +02:00
</div>
</div>
2021-02-07 12:36:52 +01:00
<div id = "bottom">
2020-06-22 22:14:52 +02:00
Powered by antd server, (c) 2019 - <?=os.date("*t").year?> Xuan Sang LE
2021-02-07 12:36:52 +01:00
</div>
2020-06-22 22:14:52 +02:00
<script>
2021-02-19 19:37:26 +01:00
const toc_class_toggle = () => {
if(!$("#doc_toc").is(":hidden"))
{
$("#btn_toc").attr("class", "toc-active");
}
else
{
$("#btn_toc").removeClass("toc-active");
}
};
2020-06-24 19:00:41 +02:00
window.addEventListener('load', (event) => {
2021-02-07 11:35:26 +01:00
$("#btn_toc").click(function(){
$("#doc_toc").toggle();
2021-02-19 19:37:26 +01:00
toc_class_toggle();
2021-02-07 11:35:26 +01:00
});
$("#doc_content").click(function(){
$("#doc_toc").hide();
2021-02-19 19:37:26 +01:00
toc_class_toggle();
2021-02-07 11:35:26 +01:00
});
2020-06-22 22:14:52 +02:00
// tree view events
var toggler = document.getElementsByClassName("caret");
var i;
for (i = 0; i < toggler.length; i++) {
toggler[i].addEventListener("click", function() {
this.parentElement.querySelector(".nested").classList.toggle("active");
this.classList.toggle("caret-down");
});
}
2020-06-24 19:00:41 +02:00
var input = document.getElementById("search_box");
var form = document.getElementById("search_form");
2020-12-22 13:57:23 +01:00
if(form)
2020-06-24 19:00:41 +02:00
{
2020-12-22 13:57:23 +01:00
form.onsubmit = function()
{
var val = input.value.trim();
console.log(val);
if( val === "" || val == "\n") return false;
return true;
}
2020-06-24 19:00:41 +02:00
}
2020-09-22 17:58:37 +02:00
<?lua
if url then
?>
var options = {
target: "quick_talk_comment_thread",
api_uri: "https://chat.iohub.dev/comment",
uri: "<?=url?>",
2020-12-09 12:13:03 +01:00
page: 'cover',
2020-09-22 19:50:59 +02:00
author: {
first: "mrsang",
last: "iohub.dev"
},
2020-09-22 17:58:37 +02:00
onload: function(){
renderMathInElement($("#book")[0]);
$('pre code').each(function(i, block) {
hljs.highlightBlock(block);
hljs.lineNumbersBlock(block);
});
}
};
new QuickTalk(options);
<?lua
end
?>
2020-06-24 19:00:41 +02:00
});
2021-02-19 19:37:26 +01:00
toc_class_toggle();
2020-06-22 22:14:52 +02:00
</script>
</body>
</html>