mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-12 18:34:05 +08:00
added test cooldown,
added domination
This commit is contained in:
parent
aad77ace76
commit
561c8a378d
2 changed files with 48 additions and 0 deletions
|
|
@ -210,6 +210,7 @@ function mp_joinRoomByCode(code) {
|
|||
}
|
||||
|
||||
function mp_startTest() {
|
||||
if (MP.room.newTestCooldown) return;
|
||||
MP.socket.emit("mp_room_test_start");
|
||||
}
|
||||
|
||||
|
|
@ -1022,6 +1023,21 @@ MP.socket.on("mp_room_winner", (data) => {
|
|||
if (data.official) {
|
||||
hideResultCountdown();
|
||||
// updateAllGraphs(graphs, data.maxRaw);
|
||||
MP.room.newTestCooldown = true;
|
||||
$("#result #nextTestButton").html(
|
||||
`<i class="fas fa-fw fa-spin fa-circle-notch"></i>`
|
||||
);
|
||||
$("#result #nextTestButton").attr(
|
||||
"aria-label",
|
||||
"Please wait for all players to view their result"
|
||||
);
|
||||
setTimeout(() => {
|
||||
MP.room.newTestCooldown = false;
|
||||
$("#result #nextTestButton").html(
|
||||
`<i class="fas fa-fw fa-chevron-right"></i>`
|
||||
);
|
||||
$("#result #nextTestButton").attr("aria-label", "Next test");
|
||||
}, 5000);
|
||||
}
|
||||
let userwon = false;
|
||||
data.sorted.forEach((sid) => {
|
||||
|
|
@ -1052,15 +1068,36 @@ MP.socket.on("mp_room_winner", (data) => {
|
|||
});
|
||||
|
||||
MP.socket.on("mp_room_miniCrowns", (data) => {
|
||||
let count = {};
|
||||
Object.keys(data.crowns).forEach((c) => {
|
||||
let crown = data.crowns[c];
|
||||
crown.sidList.forEach((sid) => {
|
||||
if (count[sid] === undefined) {
|
||||
count[sid] = 1;
|
||||
} else {
|
||||
count[sid]++;
|
||||
}
|
||||
$(`.tribeResult table [socketId=${sid}] .${c} .miniCrown`).animate(
|
||||
{ opacity: 0.5 },
|
||||
125
|
||||
);
|
||||
});
|
||||
});
|
||||
Object.keys(count).forEach((sid) => {
|
||||
if (count[sid] === 4) {
|
||||
$(`.tribeResult table [socketId=${sid}] .crown`).append(
|
||||
`<div class="glow"></div>`
|
||||
);
|
||||
$(`.tribeResult table [socketId=${sid}] .crown`).attr(
|
||||
"aria-label",
|
||||
"Dominated"
|
||||
);
|
||||
$(`.tribeResult table [socketId=${sid}] .crown`).attr(
|
||||
"data-balloon-pos",
|
||||
"up"
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
MP.socket.on("mp_room_points", (data) => {
|
||||
|
|
|
|||
|
|
@ -1596,6 +1596,9 @@ key {
|
|||
color: var(--text-color);
|
||||
&.me {
|
||||
color: var(--main-color);
|
||||
.crown .glow {
|
||||
box-shadow: 0 0 1rem 0.2rem var(--main-color);
|
||||
}
|
||||
}
|
||||
.progressAndGraph {
|
||||
width: 25%;
|
||||
|
|
@ -1618,6 +1621,14 @@ key {
|
|||
}
|
||||
.crown {
|
||||
width: 1px;
|
||||
.glow {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
position: absolute;
|
||||
margin-left: 0.45rem;
|
||||
margin-top: -0.7rem;
|
||||
box-shadow: 0 0 1rem 0.2rem var(--text-color);
|
||||
}
|
||||
}
|
||||
.text {
|
||||
display: inline-block;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue