Skip to content

Commit 4d67bbe

Browse files
Add function pair
1 parent 81536fc commit 4d67bbe

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

web/resources/function.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,19 @@
55
} %}
66
{% set info_color = '#ccc' %}
77

8-
<!-- Title & Description -->
8+
<!-- Title -->
99
<div class="function-type-title" style="color: {{type_colors[function.type_name]}};">{{ function.type_name|capitalize }} function</div>
10-
<h1 style="border-bottom: 3px solid {{type_colors[function.type_name]}}; padding-bottom: 0.1em;">{{ function.name }} <a class="small-fs" href="#" onclick="copyText('{{ function.name }}', 'copy-{{ function.name }}')"><i class="fa-solid fa-copy"></i> <span id="copy-{{ function.name }}">Copy</span> </a></h1>
10+
<h1 style="border-bottom: 3px solid {{type_colors[function.type_name]}}; padding-bottom: 0.2em;">{{ function.name }} <a class="small-fs" href="#" onclick="copyText('{{ function.name }}', 'copy-{{ function.name }}')"><i class="fa-solid fa-copy"></i> <span id="copy-{{ function.name }}">Copy</span> </a></h1>
1111

12+
13+
<!-- Pair -->
14+
{% for type_name in ['shared', 'server', 'client'] %}
15+
{% if function[type_name] and function[type_name].pair %}
16+
<h3>Pair: <a href="/{{ function[type_name].pair }}">{{ function[type_name].pair }}</a></h3>
17+
{% endif %}
18+
{% endfor %}
19+
20+
<!-- Description -->
1221
{{ function[function.type_name].description_html }}
1322

1423
<!-- Syntax -->

web/resources/layout.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
});
116116
});
117117

118+
var copyTextTimer = null;
118119
async function copyText(text, spanCopyText) {
119120
event.preventDefault()
120121
const type = "text/plain";
@@ -124,7 +125,8 @@
124125
if (spanCopyText) {
125126
spanCopyText = document.getElementById(spanCopyText);
126127
spanCopyText.innerText = "Copied!";
127-
setTimeout(() => {
128+
clearTimeout(copyTextTimer);
129+
copyTextTimer = setTimeout(() => {
128130
spanCopyText.innerText = "Copy";
129131
}, 2000);
130132
}

0 commit comments

Comments
 (0)