Commit 83bc95aa authored by yuxiaodi's avatar yuxiaodi

init

parent 489af456
......@@ -47,8 +47,7 @@ def _render_home_html(request: Request) -> str:
<tr class="skill-row">
<td class="skill-name"><code>{safe_fname}</code></td>
<td class="skill-actions">
<a class="btn btn-primary" href="{safe_url}" download>下载</a>
<button type="button" class="btn btn-secondary copy-btn" data-url="{safe_url}">复制链接</button>
<button type="button" class="btn btn-primary copy-btn" data-url="{safe_url}">复制链接</button>
</td>
</tr>"""
......@@ -239,14 +238,13 @@ def _render_home_html(request: Request) -> str:
<p class="lead">在 IDE 中开发技能、打包后直接复制链接交给 Eazybot 安装或自行下载保存</p>
<div class="intro">
<p>您可以在 IDE 对话框中描述想开发的技能,由 <strong>Eazy Develop</strong> 协助完成;也可自行在 <code>skills/</code> 目录下开发,并使用 <code>make skill</code> 打包。</p>
<p>部署后可通过下方链接下载 <code>.skill</code> 压缩包,或将链接提供给 <strong>Eazybot</strong> 自动安装。(开发环境中链接可能为临时地址,部署后为稳定链接。)</p>
<p>部署后复制下方链接,在浏览器中打开即可下载 <code>.skill</code> 压缩包;也可将链接提供给 <strong>Eazybot</strong> 自动安装。(开发环境中链接可能为临时地址,部署后为稳定链接。)</p>
</div>
<div class="default-dl">
<label>默认下载(第一个 .skill)</label>
<label>默认链接(在浏览器中打开即可下载第一个 <code>.skill</code>)</label>
<div class="url-row">
<input type="text" readonly value="{safe_default}" id="default-url" />
<a class="btn btn-primary" href="{safe_default}" download>下载</a>
<button type="button" class="btn btn-secondary copy-btn" data-url="{safe_default}">复制链接</button>
<button type="button" class="btn btn-primary copy-btn" data-url="{safe_default}">复制链接</button>
</div>
</div>
<h2>已打包的技能</h2>
......@@ -254,7 +252,7 @@ def _render_home_html(request: Request) -> str:
<thead>
<tr>
<th>文件名</th>
<th style="text-align:right">操作</th>
<th style="text-align:right">链接</th>
</tr>
</thead>
<tbody>
......@@ -267,16 +265,20 @@ def _render_home_html(request: Request) -> str:
<script>
(function () {{
var toast = document.getElementById("toast");
function showToast() {{
function showToast(msg) {{
if (msg) toast.textContent = msg;
toast.classList.add("show");
clearTimeout(showToast._t);
showToast._t = setTimeout(function () {{ toast.classList.remove("show"); }}, 2000);
showToast._t = setTimeout(function () {{
toast.classList.remove("show");
toast.textContent = "已复制到剪贴板";
}}, 2500);
}}
document.querySelectorAll(".copy-btn").forEach(function (btn) {{
btn.addEventListener("click", function () {{
var url = btn.getAttribute("data-url");
if (navigator.clipboard && navigator.clipboard.writeText) {{
navigator.clipboard.writeText(url).then(showToast).catch(function () {{
navigator.clipboard.writeText(url).then(function () {{ showToast(); }}).catch(function () {{
fallbackCopy(url);
}});
}} else {{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment