-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
113 lines (86 loc) · 2.75 KB
/
Copy pathscript.js
File metadata and controls
113 lines (86 loc) · 2.75 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
function openAddModal() {
document.getElementById('addModal').style.display = 'flex';
}
function closeAddModal() {
document.getElementById('addModal').style.display = 'none';
}
function addEvent() {
const imageInput = document.getElementById('imageInput');
const descInput = document.getElementById('descInput');
if (!imageInput.files[0] || !descInput.value.trim()) {
alert("Preencha todos os campos.");
return;
}
const reader = new FileReader();
reader.onload = function (e) {
const container = document.getElementById('eventContainer');
const card = document.createElement('div');
card.className = 'card';
const img = document.createElement('img');
img.src = e.target.result;
const desc = document.createElement('p');
desc.textContent = descInput.value;
card.appendChild(img);
card.appendChild(desc);
container.appendChild(card);
closeAddModal();
imageInput.value = '';
descInput.value = '';
};
reader.readAsDataURL(imageInput.files[0]);
}
function searchContent() {
const term = document.getElementById('searchInput').value.toLowerCase();
const elements = document.querySelectorAll('.card p');
elements.forEach(el => {
const content = el.textContent.toLowerCase();
if (content.includes(term)) {
el.classList.add('highlight');
} else {
el.classList.remove('highlight');
}
});
}
function openAddModal() {
document.getElementById('addModal').style.display = 'flex';
}
function closeAddModal() {
document.getElementById('addModal').style.display = 'none';
}
function addEvent() {
const imageInput = document.getElementById('imageInput');
const descInput = document.getElementById('descInput');
if (!imageInput.files[0] || !descInput.value.trim()) {
alert("Preencha todos os campos.");
return;
}
const reader = new FileReader();
reader.onload = function (e) {
const container = document.getElementById('eventContainer');
const card = document.createElement('div');
card.className = 'card';
const img = document.createElement('img');
img.src = e.target.result;
const desc = document.createElement('p');
desc.textContent = descInput.value;
card.appendChild(img);
card.appendChild(desc);
container.appendChild(card);
closeAddModal();
imageInput.value = '';
descInput.value = '';
};
reader.readAsDataURL(imageInput.files[0]);
}
function searchContent() {
const term = document.getElementById('searchInput').value.toLowerCase();
const elements = document.querySelectorAll('.card p');
elements.forEach(el => {
const content = el.textContent.toLowerCase();
if (content.includes(term)) {
el.classList.add('highlight');
} else {
el.classList.remove('highlight');
}
});
}