-
Notifications
You must be signed in to change notification settings - Fork 10
/
custom.html
90 lines (75 loc) · 2.67 KB
/
custom.html
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
<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>