|
@@ -1,37 +0,0 @@
|
|
|
-<!-- templates/result.html -->
|
|
|
-
|
|
|
-{% extends 'index.html' %}
|
|
|
-
|
|
|
-{% block content %}
|
|
|
- <div class="result mt-4">
|
|
|
- <h2 class="mb-4">生成的短网址:</h2>
|
|
|
- <p class="mb-2">原始网址: {{ original_url }}</p>
|
|
|
- <p class="mb-2">短网址: <a href="{{ short_url }}" id="shortUrl" target="_blank">{{ short_url }}</a></p>
|
|
|
- <button class="btn btn-secondary" onclick="copyToClipboard()">复制网址</button>
|
|
|
- </div>
|
|
|
-
|
|
|
- <script>
|
|
|
- function copyToClipboard() {
|
|
|
- /* 获取要复制的文本 */
|
|
|
- var copyText = document.getElementById("shortUrl");
|
|
|
-
|
|
|
- /* 创建临时输入框 */
|
|
|
- var tempInput = document.createElement("input");
|
|
|
- tempInput.value = copyText.href; // 使用 href 属性获取完整的链接
|
|
|
- document.body.appendChild(tempInput);
|
|
|
-
|
|
|
- /* 选择临时输入框中的文本 */
|
|
|
- tempInput.select();
|
|
|
- tempInput.setSelectionRange(0, 99999); /* For mobile devices */
|
|
|
-
|
|
|
- /* 尝试复制文本到剪贴板 */
|
|
|
- document.execCommand("copy");
|
|
|
-
|
|
|
- /* 移除临时输入框 */
|
|
|
- document.body.removeChild(tempInput);
|
|
|
-
|
|
|
- /* 提示复制成功 */
|
|
|
- alert("已复制到剪贴板: " + copyText.href);
|
|
|
- }
|
|
|
- </script>
|
|
|
-{% endblock %}
|