-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodal.html
More file actions
311 lines (271 loc) · 9.5 KB
/
modal.html
File metadata and controls
311 lines (271 loc) · 9.5 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Setup Events</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Arial, sans-serif;
}
body {
background-color: #f5f5f5;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.setup-container {
width: 100%;
max-width: 800px;
background-color: white;
border-radius: 2px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
overflow: hidden;
display: flex;
flex-direction: column;
}
/* HEADER STYLES */
.header {
flex: 0 0 auto;
}
.header-top {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px 20px;
border-bottom: 1px solid #eee;
}
.title {
display: flex;
align-items: center;
gap: 10px;
color: #666;
font-size: 22px;
}
.title .menu-icon {
font-size: 24px;
cursor: pointer;
}
.finish-btn {
background-color: #2563eb;
color: white;
border: none;
border-radius: 6px;
padding: 10px 18px;
font-size: 16px;
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
}
.tab-container {
display: flex;
padding: 15px 20px;
gap: 10px;
}
.tab {
border: 1px solid #ccc;
border-radius: 25px;
padding: 10px 20px;
cursor: pointer;
font-size: 15px;
background-color: transparent;
}
.tab.active {
background-color: white;
color: #4169e1;
border-color: #4169e1;
}
.tab.inactive {
color: #aaa;
}
/* BODY STYLES */
.body-content {
flex: 1 1 auto;
min-height: 360px;
overflow-y: auto;
}
.empty-state {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
min-height: 400px;
color: #999;
font-size: 20px;
padding: 30px;
}
.event-list {
padding: 20px;
display: none; /* Initially hidden */
}
.event-item {
border: 1px solid #eee;
border-radius: 6px;
padding: 15px;
margin-bottom: 10px;
background-color: #fafafa;
}
/* FOOTER STYLES */
.footer {
flex: 0 0 auto;
display: flex;
justify-content: space-between;
padding: 20px;
gap: 15px;
border-top: 1px solid #eee;
}
.action-btn {
flex: 1;
background-color: #1e6bb8;
color: white;
border: none;
border-radius: 6px;
padding: 15px;
font-size: 16px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
}
.icon {
font-size: 20px;
}
</style>
</head>
<body>
<div class="setup-container">
<!-- HEADER -->
<div class="header">
<div class="header-top">
<div class="title">
<span class="menu-icon">≡</span>
<span>Setup Events</span>
</div>
<button class="finish-btn">
<span>↪</span>
<span>Finish Setup</span>
</button>
</div>
<div class="tab-container">
<button class="tab active" data-tab="current-page">Event on this page</button>
<button class="tab inactive" data-tab="all-events">All Events</button>
</div>
</div>
<!-- BODY -->
<div class="body-content" id="content-area">
<!-- Empty state message -->
<div class="empty-state" id="empty-state">
No events to show
</div>
<!-- Event list container - initially hidden -->
<div class="event-list" id="event-list">
<!-- Events will be injected here -->
</div>
</div>
<!-- FOOTER -->
<div class="footer">
<button class="action-btn" id="track-element-btn">
<span class="icon">+</span>
<span>Track an element</span>
</button>
<button class="action-btn" id="track-page-btn">
<span class="icon">📎</span>
<span>Track Page</span>
</button>
<button class="action-btn" id="search-element-btn">
<span>Search element by text</span>
</button>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Tab switching functionality
const tabs = document.querySelectorAll('.tab');
const contentArea = document.getElementById('content-area');
const emptyState = document.getElementById('empty-state');
const eventList = document.getElementById('event-list');
// Sample data for demonstration
const events = {
'current-page': [],
'all-events': [
{ name: 'Click Button', selector: '#header-btn', type: 'click' },
{ name: 'Form Submit', selector: '#contact-form', type: 'submit' }
]
};
// Function to render content based on active tab and data
function renderContent(tabId) {
const tabEvents = events[tabId];
// Clear event list
eventList.innerHTML = '';
if (tabEvents.length === 0) {
// Show empty state if no events
emptyState.style.display = 'flex';
eventList.style.display = 'none';
} else {
// Show events and hide empty state
emptyState.style.display = 'none';
eventList.style.display = 'block';
// Create event items
tabEvents.forEach(event => {
const eventElement = document.createElement('div');
eventElement.className = 'event-item';
eventElement.innerHTML = `
<h3>${event.name}</h3>
<p>Selector: ${event.selector}</p>
<p>Type: ${event.type}</p>
`;
eventList.appendChild(eventElement);
});
}
}
// Tab click handlers
tabs.forEach(tab => {
tab.addEventListener('click', function() {
// Update active tab UI
tabs.forEach(t => {
t.classList.remove('active');
t.classList.add('inactive');
});
this.classList.remove('inactive');
this.classList.add('active');
// Render appropriate content
const tabId = this.getAttribute('data-tab');
renderContent(tabId);
});
});
// Button event handlers
document.getElementById('track-element-btn').addEventListener('click', function() {
// Example of adding a new event
const newEvent = {
name: 'New Element Click',
selector: '#new-element',
type: 'click'
};
// Get current active tab
const activeTab = document.querySelector('.tab.active').getAttribute('data-tab');
// Add event to array
events[activeTab].push(newEvent);
// Re-render content
renderContent(activeTab);
});
document.getElementById('track-page-btn').addEventListener('click', function() {
alert('Page tracking enabled');
});
document.getElementById('search-element-btn').addEventListener('click', function() {
const searchTerm = prompt('Enter text to search for:');
if (searchTerm) {
alert(`Searching for elements containing: ${searchTerm}`);
}
});
// Initial render - current page tab
renderContent('current-page');
});
</script>
</body>
</html>