-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathcustom.html
More file actions
149 lines (123 loc) · 4.88 KB
/
custom.html
File metadata and controls
149 lines (123 loc) · 4.88 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<meta name='zd-site-verification' content='xj9koofr1crilmoclgxsjd' />
<script type="text/javascript">
window.onload = () => {
const elems = document.getElementsByClassName('navbar-title');
if (elems.length > 0) {
const title = elems[0];
title.parentElement.href = '/Home.html'
}
}
</script>
<script type="text/javascript">
function scrollFunction() {
var prevScrollpos = window.pageYOffset;
if (prevScrollpos > 50) {
document.getElementsByClassName("navbar-brand")[1].style.display = "none";
} else {
document.getElementsByClassName("navbar-brand")[1].style.display = "initial";
}
}
window.addEventListener('scroll', scrollFunction);
</script>
<script>
function togglecheck(className, displayState){
var elements = document.getElementsByClassName(className)
for (var i = 0; i < elements.length; i++){
if (elements[i].style.display === "none") {
elements[i].style.display = "block";
} else {
elements[i].style.display = "none";
}
}
}
window.onload = function() {
// Modify this array to contain the levelids of checkboxes that should be unchecked by default
var uncheckedByDefault = ["Level-0"];
for (var i = 0; i < uncheckedByDefault.length; i++) {
togglecheck(uncheckedByDefault[i], "none");
}
};
</script>
<script>
function handleQuestionClick(questionId) {
// Update the hash in the URL
window.location.hash = questionId;
// Scroll to the target element and adjust its position
scrollToQuestion(questionId);
}
function scrollToQuestion(questionId) {
// Get the element with the ID specified in the hash
var targetElement = document.querySelector(questionId);
// Scroll to the target element and adjust its position
if (targetElement) {
// Calculate the position of the target element relative to the viewport
var rect = targetElement.getBoundingClientRect();
var offsetTop = rect.top + window.scrollY;
var targetPosition = offsetTop - (window.innerHeight / 16);
// Scroll to the adjusted position
window.scrollTo({
top: targetPosition,
behavior: 'smooth'
});
// Open the details element
targetElement.open = true;
}
}
document.addEventListener("DOMContentLoaded", function() {
// Check if there is a hash in the URL
if (window.location.hash) {
// Scroll to the target element and adjust its position after a short delay
setTimeout(function() {
scrollToQuestion(window.location.hash);
}, 100);
}
});
</script>
<script>
document.addEventListener("DOMContentLoaded", function() {
function setupS3Links() {
let s3Links = document.querySelectorAll('a[data-s3-path]');
s3Links.forEach(link => {
// Create S3 link wrapper
const wrapper = document.createElement('div');
wrapper.className = 's3-link-wrapper';
const s3Link = document.createElement('a');
s3Link.className = 's3-link';
s3Link.textContent = link.textContent;
s3Link.href = '#';
s3Link.title = 'Click to copy S3 path';
const tooltip = document.createElement('div');
tooltip.className = 's3-tooltip';
tooltip.textContent = link.dataset.s3Path;
wrapper.appendChild(s3Link);
wrapper.appendChild(tooltip);
link.replaceWith(wrapper);
// Add click to copy functionality
s3Link.addEventListener('click', function(e) {
e.preventDefault();
// Copy to clipboard
navigator.clipboard.writeText(tooltip.textContent).then(function() {
// Show feedback
const feedback = document.createElement('div');
feedback.className = 's3-copy-feedback';
feedback.textContent = 'Copied!';
wrapper.appendChild(feedback);
feedback.style.opacity = '1';
feedback.style.visibility = 'visible';
// Remove feedback after 2 seconds
setTimeout(function() {
feedback.style.opacity = '0';
feedback.style.visibility = 'hidden';
setTimeout(function() {
feedback.remove();
}, 300);
}, 1500);
}).catch(function(err) {
console.error('Failed to copy:', err);
});
});
});
}
setupS3Links();
});
</script>