blob: 21e589de464ae1dfff16a50bcf020a1c8806ea4d (
plain) (
blame)
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
|
let linkQryEls = document.getElementsByClassName('link--QRY');
let i = linkQryEls.length;
while (i--) {
linkQryEls[i].addEventListener('click', e => {
e.preventDefault();
const resp = prompt('Please enter required input: ', '');
if ((resp !== null) && (resp !== "")) {
window.location.href = (e.target as HTMLAnchorElement).href + '?' + resp;
}
return false;
});
}
let imgPreviewEls = document.getElementsByClassName('img-preview');
i = imgPreviewEls.length;
while (i--) {
const imgPreviewEl = imgPreviewEls[i] as HTMLAnchorElement;
const child = imgPreviewEl.children[0] as HTMLImageElement;
const thumbnailUrl = child.src;
child.addEventListener('load', e => {
child.classList.remove('faded');
});
imgPreviewEls[i].addEventListener('click', e => {
e.preventDefault();
child.classList.add('faded');
if (child.classList.contains('expanded')) {
child.classList.remove('expanded');
child.src = thumbnailUrl;
} else {
child.classList.add('expanded');
child.src = imgPreviewEl.href;
}
return false;
});
}
|