Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
121 lines (81 loc) · 3.02 KB
/
Copy pathscript.js
File metadata and controls
121 lines (81 loc) · 3.02 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
// function openModal(id) {
// document.getElementById(id).style.display = 'flex';
// }
// function closeModal(id) {
// document.getElementById(id).style.display = 'none';
// }
// window.onclick = function(event) {
// const modals = document.querySelectorAll('.modal');
// modals.forEach(m => {
// if (event.target === m) {
// m.style.display = 'none';
// }
// });
// };
//
// function openModal(data){
// lastFocused = document.activeElement;
// modalTitle.textContent = data.title || 'Project';
// modalDesc.textContent = data.desc || '';
// modalLink.href = data.href || '#';
// const images = data.images || [];
// if(images.length){
// modalImg.src = images[0];
// modalImg.alt = data.title + ' screenshot';
// } else {
// modalImg.src = '';
// modalImg.alt = 'No image';
// }
// backdrop.classList.add('show'); // show full-screen backdrop
// backdrop.setAttribute('aria-hidden','false');
// document.body.style.overflow = 'hidden'; // prevent background scroll
// closeBtn.focus();
// }
// function closeModal(){
// backdrop.classList.remove('show');
// backdrop.setAttribute('aria-hidden','true');
// document.body.style.overflow = ''; // restore scroll
// modalImg.removeAttribute('src');
// if(lastFocused) lastFocused.focus();
// }
//
// const backdrop = document.getElementById('modal-backdrop');
// const modal = document.querySelector('.modal');
// const closeBtn = document.getElementById('modal-close');
// let lastFocused = null;
// function openModal(data){
// lastFocused = document.activeElement;
// document.getElementById('modal-title').textContent = data.title || 'Project';
// document.getElementById('modal-desc').textContent = data.desc || '';
// document.getElementById('modal-link').href = data.href || '#';
// const images = data.images || [];
// const modalImg = document.getElementById('modal-img');
// if(images.length){
// modalImg.src = images[0];
// modalImg.alt = data.title + ' screenshot';
// } else {
// modalImg.src = '';
// modalImg.alt = 'No image';
// }
// backdrop.classList.add('show');
// document.body.style.overflow = 'hidden'; // prevent background scroll
// closeBtn.focus();
// }
// function closeModal(){
// backdrop.classList.remove('show');
// document.body.style.overflow = ''; // restore scroll
// document.getElementById('modal-img').removeAttribute('src');
// if(lastFocused) lastFocused.focus();
// }
// // Close modal on clicking backdrop or escape
// backdrop.addEventListener('click', e => { if(e.target === backdrop) closeModal(); });
// document.addEventListener('keydown', e => { if(e.key === 'Escape') closeModal(); });
// // Attach project buttons
// document.querySelectorAll('.project').forEach(p => {
// p.addEventListener('click', () => {
// const title = p.dataset.title;
// const desc = p.dataset.desc;
// const images = p.dataset.images ? p.dataset.images.split(',') : [];
// openModal({title, desc, images});
// });
// });