-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
98 lines (86 loc) · 3.67 KB
/
Copy pathscript.js
File metadata and controls
98 lines (86 loc) · 3.67 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
document.addEventListener('DOMContentLoaded', function() {
console.log('Welcome to std::ULeague!');
});
const cursor = document.createElement('div');
cursor.style.width = '20px';
cursor.style.height = '20px';
cursor.style.borderRadius = '50%';
cursor.style.position = 'absolute';
cursor.style.pointerEvents = 'none';
cursor.style.zIndex = '1000';
cursor.style.backgroundColor = 'white';
const cursorRing = document.createElement('div');
cursorRing.style.width = '40px';
cursorRing.style.height = '40px';
cursorRing.style.borderRadius = '50%';
cursorRing.style.position = 'absolute';
cursorRing.style.pointerEvents = 'none';
cursorRing.style.border = '2px solid orange';
cursorRing.style.boxShadow = '0 0 8px rgba(0, 0, 0, 0.5)';
cursorRing.style.zIndex = '999';
document.body.appendChild(cursorRing);
document.body.appendChild(cursor);
document.body.style.cursor = 'none';
document.addEventListener('mousemove', function (e) {
cursor.style.left = e.pageX + 'px';
cursor.style.top = e.pageY + 'px';
cursorRing.style.left = e.pageX - 10 + 'px';
cursorRing.style.top = e.pageY - 10 + 'px';
});
const interactiveElements = document.querySelectorAll('button, a, [role="button"]');
interactiveElements.forEach(element => {
element.addEventListener('mouseenter', function () {
cursor.style.backgroundColor = 'orange';
cursorRing.style.border = '2px solid white';
});
element.addEventListener('mouseleave', function () {
cursor.style.backgroundColor = 'white';
cursorRing.style.border = '2px solid orange';
});
});
document.addEventListener('DOMContentLoaded', function() {
fetch('equipos.json')
.then(response => response.json())
.then(data => {
const associationTableBody = document.querySelector('#association-table tbody');
const teamTableBody = document.querySelector('#team-table tbody');
const topTeams = data.sort((a, b) => b.puntuación - a.puntuación);
topTeams.forEach(team => {
const row = document.createElement('tr');
row.innerHTML = `
<th scope="row"></th>
<td>${team.asociación}</td>
<td>${team.nombreEquipo}</td>
<td>${team.puntuación}</td>
`;
teamTableBody.appendChild(row);
});
const associationPoints = data.reduce((acc, team) => {
if (!acc[team.asociación]) {
acc[team.asociación] = 0;
}
acc[team.asociación] += team.puntuación;
return acc;
}, {});
const sortedAssociations = Object.keys(associationPoints)
.map(association => ({
name: association,
points: associationPoints[association]
}))
.sort((a, b) => b.points - a.points);
sortedAssociations.forEach((association, index) => {
const row = document.createElement('tr');
row.innerHTML = `
<th scope="row">${index + 1}</th>
<td>${association.name}</td>
<td>${association.points}</td>
`;
associationTableBody.appendChild(row);
});
const teamRows = teamTableBody.querySelectorAll('tr');
Array.from(teamRows).forEach((row, index) => {
row.querySelector('th').textContent = index + 1;
});
})
.catch(error => console.error('Error loading data:', error));
});