-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy path_download.html
More file actions
120 lines (109 loc) · 3.57 KB
/
_download.html
File metadata and controls
120 lines (109 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<style>
.disabled {
pointer-events: none;
cursor: none;
}
.disabled-overlay {
background-color: var(--bs-secondary-bg);
border-radius: 5px;
opacity: 0.5;
transition-duration: 1s;
}
.visible {
transition-duration: 1s;
}
.checksum {
cursor: pointer;
color: rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 1));
text-decoration: underline;
position: relative;
display: inline-block;
/* Added to ensure proper tooltip positioning */
}
.copy-feedback {
position: absolute;
background: rgba(0, 0, 0, 0.8);
color: white;
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
white-space: nowrap;
z-index: 1000;
opacity: 0;
transition: opacity 0.2s ease-in-out;
}
.copy-feedback.visible {
opacity: 1;
}
</style>
<script type="application/javascript">
window.document.addEventListener("DOMContentLoaded", () => {
setLinkEnablement(false);
});
function setLinkEnablement(enable) {
const downloadTable = window.document.querySelector("#download-table");
const downloadLinks = window.document.querySelectorAll("#download-table a");
if (enable) {
downloadTable.classList.remove("disabled-overlay");
downloadTable.classList.add("visible");
}
else {
downloadTable.classList.add("disabled-overlay");
downloadTable.classList.remove("visible");
}
downloadLinks.forEach((link) => {
if (enable) {
link.classList.remove("disabled");
link.removeAttribute("aria-disabled");
link.removeAttribute("tabindex");
} else {
link.classList.add("disabled");
link.setAttribute("aria-disabled", "");
link.setAttribute("tabindex", "-1");
}
return;
});
}
function updatePrivacy(checkbox) {
setLinkEnablement(checkbox.checked);
}
function copyChecksum(text, element) {
// Remove any existing feedback elements
const existingFeedback = element.querySelector('.copy-feedback');
if (existingFeedback) {
existingFeedback.remove();
}
// Create feedback element
const feedback = document.createElement('div');
feedback.className = 'copy-feedback';
feedback.textContent = 'Copied!';
element.appendChild(feedback);
// Copy to clipboard
navigator.clipboard.writeText(text).then(() => {
// Show feedback
requestAnimationFrame(() => {
feedback.classList.add('visible');
// Hide and remove feedback after delay
setTimeout(() => {
feedback.classList.remove('visible');
setTimeout(() => {
feedback.remove();
}, 200); // Remove after fade out
}, 1000);
});
}).catch((err) => {
console.error('Failed to copy text: ', err);
feedback.textContent = 'Failed to copy';
feedback.classList.add('visible');
setTimeout(() => {
feedback.classList.remove('visible');
setTimeout(() => {
feedback.remove();
}, 200);
}, 1000);
});
}
</script>