Update index.html
Browse files- index.html +41 -6
index.html
CHANGED
|
@@ -436,6 +436,7 @@ B ๋ฒ ํ
ํ๊ธฐ
|
|
| 436 |
|
| 437 |
<div style="margin-top:12px;padding-top:12px;border-top:1px solid #2d2d44;font-size:11px;color:#8e8ea0;">
|
| 438 |
๐ก ์น์ ์์ธก ์ ํ๋: ${aRatio > bRatio ? aRatio.toFixed(1) : bRatio.toFixed(1)}% | ๋ฒ ํ
์ฐธ์ฌ๋ก ๋ฐฐ๋น๊ธ ํ๋ ๊ฐ๋ฅ
|
|
|
|
| 439 |
</div>
|
| 440 |
</div>
|
| 441 |
`;
|
|
@@ -962,6 +963,7 @@ B ๋ฒ ํ
|
|
| 962 |
</button>
|
| 963 |
</div>
|
| 964 |
</div>
|
|
|
|
| 965 |
</div>
|
| 966 |
`;
|
| 967 |
});
|
|
@@ -1000,13 +1002,17 @@ modalBody.innerHTML = `
|
|
| 1000 |
</div>
|
| 1001 |
</div>
|
| 1002 |
<div class="input-group">
|
| 1003 |
-
<label>๋ฒ ํ
|
| 1004 |
<select id="battle-duration">
|
| 1005 |
-
<option value="
|
| 1006 |
-
<option value="
|
| 1007 |
-
<option value="
|
| 1008 |
-
<option value="
|
| 1009 |
-
<option value="
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1010 |
</select>
|
| 1011 |
</div>
|
| 1012 |
<button class="btn btn-primary" style="width:100%;margin-top:15px;" onclick="createBattle()">
|
|
@@ -1101,6 +1107,35 @@ loadProfile();
|
|
| 1101 |
loadMypageContent('battle');
|
| 1102 |
}
|
| 1103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1104 |
function logout(){
|
| 1105 |
if(wakeStatusInterval){
|
| 1106 |
clearInterval(wakeStatusInterval);
|
|
|
|
| 436 |
|
| 437 |
<div style="margin-top:12px;padding-top:12px;border-top:1px solid #2d2d44;font-size:11px;color:#8e8ea0;">
|
| 438 |
๐ก ์น์ ์์ธก ์ ํ๋: ${aRatio > bRatio ? aRatio.toFixed(1) : bRatio.toFixed(1)}% | ๋ฒ ํ
์ฐธ์ฌ๋ก ๋ฐฐ๋น๊ธ ํ๋ ๊ฐ๋ฅ
|
| 439 |
+
${isAdmin ? `<button class="btn btn-danger" style="margin-top:10px;font-size:11px;padding:6px 12px;" onclick="event.stopPropagation(); deleteBattle(${b.id})">๐๏ธ ๊ด๋ฆฌ์ ์ญ์ </button>` : ''}
|
| 440 |
</div>
|
| 441 |
</div>
|
| 442 |
`;
|
|
|
|
| 963 |
</button>
|
| 964 |
</div>
|
| 965 |
</div>
|
| 966 |
+
${isAdmin ? `<div style="margin-top:10px;text-align:center;"><button class="btn btn-danger" style="font-size:11px;padding:6px 12px;" onclick="deleteBattle(${b.id})">๐๏ธ ๊ด๋ฆฌ์ ์ญ์ </button></div>` : ''}
|
| 967 |
</div>
|
| 968 |
`;
|
| 969 |
});
|
|
|
|
| 1002 |
</div>
|
| 1003 |
</div>
|
| 1004 |
<div class="input-group">
|
| 1005 |
+
<label>๋ฒ ํ
๊ธฐํ</label>
|
| 1006 |
<select id="battle-duration">
|
| 1007 |
+
<option value="24" selected>1์ผ (24์๊ฐ)</option>
|
| 1008 |
+
<option value="48">2์ผ (48์๊ฐ)</option>
|
| 1009 |
+
<option value="72">3์ผ (72์๊ฐ)</option>
|
| 1010 |
+
<option value="168">7์ผ (1์ฃผ)</option>
|
| 1011 |
+
<option value="336">14์ผ (2์ฃผ)</option>
|
| 1012 |
+
<option value="720">30์ผ (1๊ฐ์)</option>
|
| 1013 |
+
<option value="2160">90์ผ (3๊ฐ์)</option>
|
| 1014 |
+
<option value="4320">180์ผ (6๊ฐ์)</option>
|
| 1015 |
+
<option value="8760">365์ผ (1๋
)</option>
|
| 1016 |
</select>
|
| 1017 |
</div>
|
| 1018 |
<button class="btn btn-primary" style="width:100%;margin-top:15px;" onclick="createBattle()">
|
|
|
|
| 1107 |
loadMypageContent('battle');
|
| 1108 |
}
|
| 1109 |
|
| 1110 |
+
async function deleteBattle(room_id){
|
| 1111 |
+
if(!confirm('โ ๏ธ ์ ๋ง๋ก ์ด ๋ฐฐํ์ ์ญ์ ํ์๊ฒ ์ต๋๊น?\n๋ชจ๋ ๋ฒ ํ
์ด ์ทจ์๋๊ณ ์ฐธ๊ฐ์๋ค์๊ฒ GPU๊ฐ ํ๋ถ๋ฉ๋๋ค.')){
|
| 1112 |
+
return;
|
| 1113 |
+
}
|
| 1114 |
+
|
| 1115 |
+
const res = await fetch('/api/battle/delete', {
|
| 1116 |
+
method: 'POST',
|
| 1117 |
+
headers: {'Content-Type': 'application/json'},
|
| 1118 |
+
body: JSON.stringify({
|
| 1119 |
+
email: currentUser,
|
| 1120 |
+
room_id: room_id
|
| 1121 |
+
})
|
| 1122 |
+
});
|
| 1123 |
+
|
| 1124 |
+
const data = await res.json();
|
| 1125 |
+
if(data.error){
|
| 1126 |
+
alert(data.error);
|
| 1127 |
+
return;
|
| 1128 |
+
}
|
| 1129 |
+
|
| 1130 |
+
alert(data.message);
|
| 1131 |
+
loadProfile();
|
| 1132 |
+
loadMypageContent('battle');
|
| 1133 |
+
// ๋ฐฐํ ์๋ ๋ ๊ฒ์ํ์ ์์ผ๋ฉด ์๋ก๊ณ ์นจ
|
| 1134 |
+
if(currentBoard === 'battle'){
|
| 1135 |
+
await loadPosts('battle', currentSort);
|
| 1136 |
+
}
|
| 1137 |
+
}
|
| 1138 |
+
|
| 1139 |
function logout(){
|
| 1140 |
if(wakeStatusInterval){
|
| 1141 |
clearInterval(wakeStatusInterval);
|