-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
62 lines (48 loc) · 1.62 KB
/
vite.config.js
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
import {defineConfig} from "vite"
export default defineConfig({
plugins: [
]
})
var Like_count, comments, comment, item;
// Describe this function...
function display() {
if(--window.LoopTrap <= 0) throw "Infinite loop.";
let element_count = document.getElementById('count');
element_count.innerText = Like_count;
let element_comments = document.getElementById('comments');
comments.forEach((comment) => {
let new_li = document.createElement('li');
new_li.innerText = comment;
element_comments.appendChild(new_li);
});
}
function convertToNumber(value) {
// Convert a string value to a number if possible
let number_value = Number(value);
if (Number.isNaN(number_value)) {
return 0
} else {
return number_value
}
}
Like_count = 0;
comments = [];
display();
document.getElementById('like_btn').addEventListener('click', (event) => {
Like_count = (typeof Like_count === 'number' ? Like_count : 0) + 1;
let element_count2 = document.getElementById('count');
element_count2.innerText = Like_count;
});
document.getElementById('comment_btn').addEventListener('click', (event) => {
let element_input_comment = document.getElementById('input_comment');
comments.push(document.getElementById('input_comment').value);
let element_comments2 = document.getElementById('comments');
element_comments2.replaceChildren();
comments.forEach((item) => {
let new_li2 = document.createElement('li');
new_li2.innerText = item;
element_comments2.appendChild(new_li2);
});
let element_input_comment2 = document.getElementById('input_comment');
element_input_comment2.replaceChildren();
});