wad-lab 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +9 -1
- package/package.json +1 -1
- package/templates/game-memory-cards/index.html +24 -0
- package/templates/game-memory-cards/script.js +90 -0
- package/templates/game-memory-cards/style.css +74 -0
- package/templates/game-rock-paper-scissors/index.html +35 -0
- package/templates/game-rock-paper-scissors/script.js +49 -0
- package/templates/game-rock-paper-scissors/style.css +67 -0
- package/templates/game-tic-tac-toe/index.html +30 -0
- package/templates/game-tic-tac-toe/script.js +82 -0
- package/templates/game-tic-tac-toe/style.css +66 -0
- package/templates/game-whack-a-mole/index.html +34 -0
- package/templates/game-whack-a-mole/script.js +83 -0
- package/templates/game-whack-a-mole/style.css +75 -0
- package/templates/html-css-js/index.html +224 -27
- package/templates/html-css-js/script.js +358 -25
- package/templates/html-css-js/style.css +452 -11
- package/templates/vue-cart-router-pinia/index.html +12 -0
- package/templates/vue-cart-router-pinia/package.json +20 -0
- package/templates/vue-cart-router-pinia/src/App.vue +78 -0
- package/templates/vue-cart-router-pinia/src/main.js +9 -0
- package/templates/vue-cart-router-pinia/src/router/index.js +17 -0
- package/templates/vue-cart-router-pinia/src/stores/cartStore.js +58 -0
- package/templates/vue-cart-router-pinia/src/views/CartView.vue +139 -0
- package/templates/vue-cart-router-pinia/src/views/CheckoutView.vue +144 -0
- package/templates/vue-cart-router-pinia/src/views/ProductCatalogView.vue +73 -0
- package/templates/vue-cart-router-pinia/vite.config.js +6 -0
- package/templates/vue-memory-game/index.html +12 -0
- package/templates/vue-memory-game/package.json +19 -0
- package/templates/vue-memory-game/src/App.vue +106 -0
- package/templates/vue-memory-game/src/main.js +7 -0
- package/templates/vue-memory-game/src/stores/memoryStore.js +64 -0
- package/templates/vue-memory-game/vite.config.js +6 -0
- package/templates/vue-todo-pinia/index.html +12 -0
- package/templates/vue-todo-pinia/package.json +19 -0
- package/templates/vue-todo-pinia/src/App.vue +179 -0
- package/templates/vue-todo-pinia/src/main.js +7 -0
- package/templates/vue-todo-pinia/src/stores/todoStore.js +50 -0
- package/templates/vue-todo-pinia/vite.config.js +6 -0
- package/templates/vue-todo-router/index.html +12 -0
- package/templates/vue-todo-router/package.json +19 -0
- package/templates/vue-todo-router/src/App.vue +55 -0
- package/templates/vue-todo-router/src/data/todoState.js +38 -0
- package/templates/vue-todo-router/src/main.js +7 -0
- package/templates/vue-todo-router/src/router/index.js +17 -0
- package/templates/vue-todo-router/src/views/AddTodoView.vue +85 -0
- package/templates/vue-todo-router/src/views/TodoDetailView.vue +89 -0
- package/templates/vue-todo-router/src/views/TodoListView.vue +77 -0
- package/templates/vue-todo-router/vite.config.js +6 -0
|
@@ -1,38 +1,371 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
let timerInterval = null;
|
|
2
|
+
let currentTimerVal = 10;
|
|
3
|
+
let mouseTrailActive = false;
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
6
|
+
initDynamicMenu();
|
|
7
|
+
updateRecordCount();
|
|
8
|
+
});
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
function handleFormSubmit(event) {
|
|
11
|
+
event.preventDefault();
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
const rollNo = document.getElementById("rollNo").value.trim();
|
|
14
|
+
const fullName = document.getElementById("fullName").value.trim();
|
|
15
|
+
const password = document.getElementById("password").value;
|
|
16
|
+
const email = document.getElementById("email").value.trim();
|
|
17
|
+
const phone = document.getElementById("phone").value.trim();
|
|
18
|
+
const age = parseInt(document.getElementById("age").value, 10);
|
|
19
|
+
const dob = document.getElementById("dob").value;
|
|
20
|
+
const regTime = document.getElementById("regTime").value;
|
|
21
|
+
const gradMonth = document.getElementById("gradMonth").value;
|
|
22
|
+
const themeColor = document.getElementById("themeColor").value;
|
|
23
|
+
const skillRating = document.getElementById("skillRating").value;
|
|
24
|
+
const department = document.getElementById("department").value;
|
|
25
|
+
const courseTrack = document.getElementById("courseTrack").value.trim();
|
|
26
|
+
const address = document.getElementById("address").value.trim();
|
|
27
|
+
|
|
28
|
+
const selectedGender = document.querySelector('input[name="gender"]:checked');
|
|
29
|
+
const gender = selectedGender ? selectedGender.value : "";
|
|
30
|
+
|
|
31
|
+
const selectedSkills = Array.from(document.querySelectorAll('input[name="skills"]:checked')).map(function (cb) {
|
|
32
|
+
return cb.value;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const alertBox = document.getElementById("formAlert");
|
|
36
|
+
alertBox.className = "alert-box";
|
|
37
|
+
alertBox.textContent = "";
|
|
38
|
+
|
|
39
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
40
|
+
const phoneRegex = /^[0-9]{10}$/;
|
|
41
|
+
|
|
42
|
+
if (rollNo.length < 3) {
|
|
43
|
+
showFormAlert("Roll Number must have at least 3 characters.", "error");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (fullName.length < 2) {
|
|
48
|
+
showFormAlert("Full Name must have at least 2 characters.", "error");
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (password.length < 6) {
|
|
53
|
+
showFormAlert("Password must have at least 6 characters.", "error");
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!emailRegex.test(email)) {
|
|
58
|
+
showFormAlert("Please enter a valid email address.", "error");
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (!phoneRegex.test(phone)) {
|
|
63
|
+
showFormAlert("Phone number must contain exactly 10 digits.", "error");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (isNaN(age) || age < 1 || age > 100) {
|
|
68
|
+
showFormAlert("Age must be between 1 and 100.", "error");
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!department) {
|
|
73
|
+
showFormAlert("Please select a department.", "error");
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const tbody = document.getElementById("recordsBody");
|
|
78
|
+
const tr = document.createElement("tr");
|
|
79
|
+
|
|
80
|
+
tr.innerHTML = "<td>" + escapeHtml(rollNo) + "</td>" +
|
|
81
|
+
"<td>" + escapeHtml(fullName) + "</td>" +
|
|
82
|
+
"<td>" + escapeHtml(email) + "</td>" +
|
|
83
|
+
"<td>" + escapeHtml(department) + "</td>" +
|
|
84
|
+
"<td>" + escapeHtml(gender) + "</td>" +
|
|
85
|
+
"<td>" + escapeHtml(selectedSkills.join(", ") || "None") + "</td>" +
|
|
86
|
+
"<td>" + escapeHtml(skillRating) + "%</td>" +
|
|
87
|
+
"<td>" +
|
|
88
|
+
"<button type='button' class='btn btn-danger' onclick='deleteRecord(this)'>Delete</button> " +
|
|
89
|
+
"<button type='button' class='btn btn-sm' onclick='moveRecordUp(this)'>Up</button>" +
|
|
90
|
+
"</td>";
|
|
91
|
+
|
|
92
|
+
tbody.appendChild(tr);
|
|
93
|
+
updateRecordCount();
|
|
94
|
+
|
|
95
|
+
showFormAlert("Student registered successfully!", "success");
|
|
96
|
+
document.getElementById("registrationForm").reset();
|
|
97
|
+
document.getElementById("ratingDisplay").textContent = "70";
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function showFormAlert(message, type) {
|
|
101
|
+
const alertBox = document.getElementById("formAlert");
|
|
102
|
+
alertBox.textContent = message;
|
|
103
|
+
alertBox.className = "alert-box " + type;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function deleteRecord(button) {
|
|
107
|
+
const row = button.closest("tr");
|
|
108
|
+
if (row) {
|
|
109
|
+
row.remove();
|
|
110
|
+
updateRecordCount();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function moveRecordUp(button) {
|
|
115
|
+
const row = button.closest("tr");
|
|
116
|
+
if (row && row.previousElementSibling) {
|
|
117
|
+
row.parentNode.insertBefore(row, row.previousElementSibling);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function updateRecordCount() {
|
|
122
|
+
const count = document.querySelectorAll("#recordsBody tr").length;
|
|
123
|
+
const counterEl = document.getElementById("totalRecordCount");
|
|
124
|
+
if (counterEl) {
|
|
125
|
+
counterEl.textContent = count;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function updateRangeDisplay(val) {
|
|
130
|
+
const display = document.getElementById("ratingDisplay");
|
|
131
|
+
if (display) {
|
|
132
|
+
display.textContent = val;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function turnBulbOn() {
|
|
137
|
+
const img = document.getElementById("bulbImg");
|
|
138
|
+
const status = document.getElementById("bulbStatus");
|
|
139
|
+
img.src = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 24 24' fill='%23f1c40f'><path d='M12 2C8.13 2 5 5.13 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.87-3.13-7-7-7zm-3 18h6v1c0 .55-.45 1-1 1h-4c-.55 0-1-.45-1-1v-1z'/></svg>";
|
|
140
|
+
status.textContent = "Bulb status: ON";
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function turnBulbOff() {
|
|
144
|
+
const img = document.getElementById("bulbImg");
|
|
145
|
+
const status = document.getElementById("bulbStatus");
|
|
146
|
+
img.src = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 24 24' fill='%237f8c8d'><path d='M12 2C8.13 2 5 5.13 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.87-3.13-7-7-7zm-3 18h6v1c0 .55-.45 1-1 1h-4c-.55 0-1-.45-1-1v-1z'/></svg>";
|
|
147
|
+
status.textContent = "Hover over the bulb to turn it ON";
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function startTimer() {
|
|
151
|
+
if (timerInterval) {
|
|
152
|
+
clearInterval(timerInterval);
|
|
153
|
+
}
|
|
154
|
+
const display = document.getElementById("timerDisplay");
|
|
155
|
+
timerInterval = setInterval(function () {
|
|
156
|
+
display.textContent = currentTimerVal;
|
|
157
|
+
currentTimerVal--;
|
|
158
|
+
if (currentTimerVal < 0) {
|
|
159
|
+
clearInterval(timerInterval);
|
|
160
|
+
timerInterval = null;
|
|
161
|
+
display.textContent = "Time Up!";
|
|
162
|
+
}
|
|
163
|
+
}, 1000);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function resetTimer() {
|
|
167
|
+
if (timerInterval) {
|
|
168
|
+
clearInterval(timerInterval);
|
|
169
|
+
timerInterval = null;
|
|
170
|
+
}
|
|
171
|
+
currentTimerVal = 10;
|
|
172
|
+
document.getElementById("timerDisplay").textContent = "10";
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function addListItem() {
|
|
176
|
+
const list = document.getElementById("orderList");
|
|
177
|
+
const count = list.children.length + 1;
|
|
178
|
+
const li = document.createElement("li");
|
|
179
|
+
const textNode = document.createTextNode("Dynamic Item " + count + " (Click to Swap)");
|
|
180
|
+
li.appendChild(textNode);
|
|
181
|
+
li.onclick = function () {
|
|
182
|
+
swapWithNext(this);
|
|
183
|
+
};
|
|
184
|
+
list.appendChild(li);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function swapWithNext(elt) {
|
|
188
|
+
const nextItem = elt.nextElementSibling;
|
|
189
|
+
if (nextItem) {
|
|
190
|
+
elt.parentNode.insertBefore(nextItem, elt);
|
|
191
|
+
} else if (elt.previousElementSibling) {
|
|
192
|
+
elt.parentNode.insertBefore(elt, elt.parentNode.firstElementChild);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function toggleCollapse(panelId, btn) {
|
|
197
|
+
const panel = document.getElementById(panelId);
|
|
198
|
+
if (panel.style.display === "none") {
|
|
199
|
+
panel.style.display = "block";
|
|
200
|
+
btn.textContent = "Click to Collapse";
|
|
201
|
+
} else {
|
|
202
|
+
panel.style.display = "none";
|
|
203
|
+
btn.textContent = "Click to Expand";
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function initDynamicMenu() {
|
|
208
|
+
const menuItems = ["Home", "About Us", "Department", "Academics", "Contact"];
|
|
209
|
+
const ul = document.getElementById("dynamicMenuList");
|
|
210
|
+
if (!ul) return;
|
|
211
|
+
ul.innerHTML = "";
|
|
212
|
+
|
|
213
|
+
menuItems.forEach(function (item) {
|
|
214
|
+
const li = document.createElement("li");
|
|
215
|
+
li.textContent = item;
|
|
216
|
+
li.addEventListener("click", function (event) {
|
|
217
|
+
alert("Clicked Menu Item: " + this.textContent + "\nEvent Type: " + event.type + "\nTarget Node: " + event.target.nodeName);
|
|
218
|
+
});
|
|
219
|
+
ul.appendChild(li);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function toggleMouseTrail(btn) {
|
|
224
|
+
mouseTrailActive = !mouseTrailActive;
|
|
225
|
+
const status = document.getElementById("trailStatus");
|
|
226
|
+
if (mouseTrailActive) {
|
|
227
|
+
window.addEventListener("mousemove", handleMouseTrail);
|
|
228
|
+
btn.textContent = "Disable Mouse Trail";
|
|
229
|
+
status.textContent = "Move your mouse around the window to see the trail effect.";
|
|
230
|
+
} else {
|
|
231
|
+
window.removeEventListener("mousemove", handleMouseTrail);
|
|
232
|
+
btn.textContent = "Enable Mouse Trail";
|
|
233
|
+
status.textContent = "Trail is currently disabled.";
|
|
14
234
|
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function handleMouseTrail(e) {
|
|
238
|
+
const particle = document.createElement("div");
|
|
239
|
+
particle.className = "mouse-trail-particle";
|
|
240
|
+
particle.style.left = e.pageX + "px";
|
|
241
|
+
particle.style.top = e.pageY + "px";
|
|
242
|
+
document.body.appendChild(particle);
|
|
243
|
+
|
|
244
|
+
setTimeout(function () {
|
|
245
|
+
if (particle.parentNode) {
|
|
246
|
+
particle.parentNode.removeChild(particle);
|
|
247
|
+
}
|
|
248
|
+
}, 800);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function runStudentObjectDemo() {
|
|
252
|
+
const student = {
|
|
253
|
+
rollNo: "21CS101",
|
|
254
|
+
name: "Alex Johnson",
|
|
255
|
+
department: "Computer Science",
|
|
256
|
+
year: 3,
|
|
257
|
+
address: {
|
|
258
|
+
street: "123 Tech Boulevard",
|
|
259
|
+
city: "Metropolis",
|
|
260
|
+
state: "California",
|
|
261
|
+
pincode: "90210"
|
|
262
|
+
},
|
|
263
|
+
marks: [88, 92, 79, 95, 85],
|
|
264
|
+
skills: ["HTML", "CSS", "JavaScript"],
|
|
265
|
+
attendancePercentage: 92.5,
|
|
266
|
+
|
|
267
|
+
displayDetails: function () {
|
|
268
|
+
return "Roll No: " + this.rollNo +
|
|
269
|
+
"\nName: " + this.name +
|
|
270
|
+
"\nDepartment: " + this.department +
|
|
271
|
+
"\nYear: " + this.year +
|
|
272
|
+
"\nCity: " + this.address.city +
|
|
273
|
+
"\nAttendance: " + this.attendancePercentage + "%";
|
|
274
|
+
},
|
|
275
|
+
|
|
276
|
+
calculateTotalAndAverage: function () {
|
|
277
|
+
let total = 0;
|
|
278
|
+
for (let i = 0; i < this.marks.length; i++) {
|
|
279
|
+
total += this.marks[i];
|
|
280
|
+
}
|
|
281
|
+
const avg = total / this.marks.length;
|
|
282
|
+
return { total: total, average: avg };
|
|
283
|
+
},
|
|
284
|
+
|
|
285
|
+
determineGrade: function (avg) {
|
|
286
|
+
if (avg >= 90) return "A";
|
|
287
|
+
if (avg >= 80) return "B";
|
|
288
|
+
if (avg >= 70) return "C";
|
|
289
|
+
if (avg >= 60) return "D";
|
|
290
|
+
return "F";
|
|
291
|
+
},
|
|
15
292
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
293
|
+
addSkill: function (newSkill) {
|
|
294
|
+
this.skills.push(newSkill);
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
updateAddress: function (street, city, state, pincode) {
|
|
298
|
+
this.address.street = street;
|
|
299
|
+
this.address.city = city;
|
|
300
|
+
this.address.state = state;
|
|
301
|
+
this.address.pincode = pincode;
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
let log = "=== INITIAL STUDENT DETAILS ===\n";
|
|
306
|
+
log += student.displayDetails() + "\n\n";
|
|
307
|
+
|
|
308
|
+
const stats = student.calculateTotalAndAverage();
|
|
309
|
+
const grade = student.determineGrade(stats.average);
|
|
310
|
+
log += "=== ACADEMIC PERFORMANCE ===\n";
|
|
311
|
+
log += "Total Marks: " + stats.total + " / 500\n";
|
|
312
|
+
log += "Average Marks: " + stats.average.toFixed(2) + "\n";
|
|
313
|
+
log += "Grade: " + grade + "\n\n";
|
|
314
|
+
|
|
315
|
+
student.addSkill("MongoDB");
|
|
316
|
+
student.updateAddress("456 Innovation Parkway", "Silicon Valley", "California", "94016");
|
|
317
|
+
log += "=== UPDATED SKILLS & ADDRESS ===\n";
|
|
318
|
+
log += "Skills: " + student.skills.join(", ") + "\n";
|
|
319
|
+
log += "New Address: " + student.address.street + ", " + student.address.city + "\n\n";
|
|
320
|
+
|
|
321
|
+
student.email = "alex.johnson@techuniv.edu";
|
|
322
|
+
log += "=== DYNAMIC PROPERTY ADDITION ===\n";
|
|
323
|
+
log += "Added student.email: " + student.email + "\n\n";
|
|
324
|
+
|
|
325
|
+
delete student.year;
|
|
326
|
+
log += "=== DYNAMIC PROPERTY DELETION ===\n";
|
|
327
|
+
log += "Deleted student.year: " + ("year" in student ? "Still exists" : "Successfully deleted") + "\n\n";
|
|
328
|
+
|
|
329
|
+
log += "=== CHECK PROPERTY EXISTENCE ===\n";
|
|
330
|
+
log += "'email' in student: " + ("email" in student) + "\n";
|
|
331
|
+
log += "'year' in student: " + ("year" in student) + "\n";
|
|
332
|
+
log += "hasOwnProperty('department'): " + student.hasOwnProperty("department") + "\n\n";
|
|
333
|
+
|
|
334
|
+
log += "=== FOR...IN LOOP (ALL KEYS & VALUES) ===\n";
|
|
335
|
+
for (let key in student) {
|
|
336
|
+
if (typeof student[key] !== "function") {
|
|
337
|
+
log += key + " : " + (typeof student[key] === "object" ? JSON.stringify(student[key]) : student[key]) + "\n";
|
|
338
|
+
}
|
|
20
339
|
}
|
|
340
|
+
log += "\n";
|
|
341
|
+
|
|
342
|
+
log += "=== OBJECT.KEYS() ===\n";
|
|
343
|
+
log += JSON.stringify(Object.keys(student)) + "\n\n";
|
|
21
344
|
|
|
22
|
-
|
|
23
|
-
const
|
|
345
|
+
log += "=== OBJECT.VALUES() (NON-FUNCTIONS) ===\n";
|
|
346
|
+
const values = Object.values(student).filter(function (val) {
|
|
347
|
+
return typeof val !== "function";
|
|
348
|
+
});
|
|
349
|
+
log += JSON.stringify(values) + "\n\n";
|
|
24
350
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"<td><button onclick='deleteRow(this)'>Delete</button></td>";
|
|
351
|
+
const jsonString = JSON.stringify(student, null, 2);
|
|
352
|
+
log += "=== CONVERT OBJECT TO JSON STRING (JSON.stringify) ===\n";
|
|
353
|
+
log += jsonString + "\n\n";
|
|
29
354
|
|
|
30
|
-
|
|
355
|
+
const parsedObj = JSON.parse(jsonString);
|
|
356
|
+
log += "=== CONVERT JSON BACK TO JAVASCRIPT OBJECT (JSON.parse) ===\n";
|
|
357
|
+
log += "Parsed Object Name: " + parsedObj.name + "\n";
|
|
358
|
+
log += "Parsed Object Email: " + parsedObj.email + "\n";
|
|
31
359
|
|
|
32
|
-
document.getElementById("
|
|
33
|
-
return true;
|
|
360
|
+
document.getElementById("objectOutput").textContent = log;
|
|
34
361
|
}
|
|
35
362
|
|
|
36
|
-
function
|
|
37
|
-
|
|
363
|
+
function escapeHtml(str) {
|
|
364
|
+
if (typeof str !== "string") return str;
|
|
365
|
+
return str
|
|
366
|
+
.replace(/&/g, "&")
|
|
367
|
+
.replace(/</g, "<")
|
|
368
|
+
.replace(/>/g, ">")
|
|
369
|
+
.replace(/"/g, """)
|
|
370
|
+
.replace(/'/g, "'");
|
|
38
371
|
}
|