-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(wsgi): optimize extra js and css and fix copied button
- Loading branch information
1 parent
6439175
commit 5439c59
Showing
3 changed files
with
164 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,20 +16,8 @@ | |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1/themes/prism.min.css" crossorigin="anonymous"> | ||
<style> | ||
pre[class*="language-"] { | ||
position: relative; | ||
margin: 5px 0 ; | ||
padding: 1.75rem 0 1.75rem 1rem; | ||
} | ||
|
||
pre[class*="language-"] button{ | ||
position: absolute; | ||
top: 5px; | ||
right: 5px; | ||
} | ||
</style> | ||
{% block extrahead -%} | ||
{%- endblock %} | ||
</head> | ||
|
||
<body> | ||
|
@@ -77,47 +65,13 @@ | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" | ||
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" | ||
crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/prism.min.js"></script> | ||
<script> | ||
// bootstrap-style tooltips | ||
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]') | ||
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl)) | ||
</script> | ||
<script> | ||
// code copy buttons -- where there is a pre/code block, add a copy button | ||
const copyButtonLabel = "Copy Code"; | ||
|
||
// use a class selector if available | ||
let blocks = document.querySelectorAll("pre"); | ||
|
||
blocks.forEach((block) => { | ||
// only add button if browser supports Clipboard API | ||
if (navigator.clipboard) { | ||
let button = document.createElement("button"); | ||
|
||
button.innerText = copyButtonLabel; | ||
block.appendChild(button); | ||
|
||
button.addEventListener("click", async () => { | ||
await copyCode(block); | ||
}); | ||
} | ||
}); | ||
|
||
async function copyCode(block, button) { | ||
let code = block.querySelector("code"); | ||
let text = code.innerText; | ||
|
||
await navigator.clipboard.writeText(text); | ||
|
||
// visual feedback that task is completed | ||
button.innerText = "Code Copied"; | ||
|
||
setTimeout(() => { | ||
button.innerText = copyButtonLabel; | ||
}, 700); | ||
} | ||
</script> | ||
{% block extrabody -%} | ||
{%- endblock %} | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,79 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
<div class="row g-3"> | ||
<div class="col-lg"> | ||
<h1>{% block title %} GPXTable Results {% endblock %}</h1> | ||
|
||
{% if format == "html" %} | ||
<div class="border m-3"> | ||
{{ output | safe }} | ||
</div> | ||
{% elif format == "markdown" %} | ||
<pre class="border m-3"><code class="language-markdown"> | ||
{{- output | safe -}} | ||
</code></pre> | ||
{% else %} | ||
<pre><code class="language-html"> | ||
{{- output | safe -}} | ||
</code></pre> | ||
{% endif %} | ||
<div class="row g-3"> | ||
<div class="col-lg"> | ||
<h1>{% block title %} GPXTable Results {% endblock %}</h1> | ||
|
||
{% if format == "html" %} | ||
<div class="border m-3"> | ||
{{ output | safe }} | ||
</div> | ||
{% elif format == "markdown" %} | ||
<pre class="border m-3"><code class="language-markdown"> | ||
{{- output | safe -}} | ||
</code></pre> | ||
{% else %} | ||
<pre><code class="language-html"> | ||
{{- output | safe -}} | ||
</code></pre> | ||
{% endif %} | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} | ||
{% block extrahead %} | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1/themes/prism.min.css" crossorigin="anonymous"> | ||
<style> | ||
pre[class*="language-"] { | ||
position: relative; | ||
margin: 5px 0 ; | ||
padding: 1.75rem 0 1.75rem 1rem; | ||
} | ||
|
||
pre[class*="language-"] button{ | ||
position: absolute; | ||
top: 5px; | ||
right: 5px; | ||
} | ||
</style> | ||
{% endblock %} | ||
{% block extrabody %} | ||
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/prism.min.js" crossorigin="anonymous"></script> | ||
<script> | ||
document.addEventListener('DOMContentLoaded', function() { | ||
// code copy buttons -- where there is a pre/code block, add a copy button | ||
const copyButtonLabel = "Copy"; | ||
|
||
// use a class selector if available | ||
let blocks = document.querySelectorAll("pre"); | ||
|
||
blocks.forEach((block) => { | ||
// only add button if browser supports Clipboard API | ||
if (navigator.clipboard) { | ||
let button = document.createElement("button"); | ||
|
||
button.innerText = copyButtonLabel; | ||
block.appendChild(button); | ||
|
||
button.addEventListener("click", async () => { | ||
await copyCode(block, button); | ||
}); | ||
} | ||
}); | ||
|
||
async function copyCode(block, button) { | ||
let code = block.querySelector("code"); | ||
let text = code.innerText; | ||
|
||
await navigator.clipboard.writeText(text); | ||
|
||
// visual feedback that task is completed | ||
button.innerText = "Copied"; | ||
|
||
setTimeout(() => { | ||
button.innerText = copyButtonLabel; | ||
}, 700); | ||
} | ||
}); | ||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters