|
<!DOCTYPE html> |
|
<html lang="ja"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<title>admin設定ページ</title> |
|
<style> |
|
body { |
|
font-family: sans-serif; |
|
padding: 2rem; |
|
background-color: #f4f4f4; |
|
} |
|
button { |
|
margin: 1rem 0; |
|
padding: 0.5rem 1rem; |
|
font-size: 1rem; |
|
} |
|
#status { |
|
margin-top: 1rem; |
|
font-weight: bold; |
|
} |
|
</style> |
|
</head> |
|
<body> |
|
<h1>Admin ローカルストレージ設定</h1> |
|
|
|
<button onclick="setAdmin()">admin = 1 に設定</button><br> |
|
<button onclick="removeAdmin()">admin を解除</button> |
|
|
|
<div id="status"></div> |
|
|
|
<script> |
|
function setAdmin() { |
|
localStorage.setItem("admin", "1"); |
|
updateStatus(); |
|
} |
|
|
|
function removeAdmin() { |
|
localStorage.removeItem("admin"); |
|
updateStatus(); |
|
} |
|
|
|
function updateStatus() { |
|
const value = localStorage.getItem("admin"); |
|
const status = document.getElementById("status"); |
|
if (value === "1") { |
|
status.textContent = "現在の状態: admin=1(Socket.IO スクリプトは無視されます)"; |
|
status.style.color = "green"; |
|
} else { |
|
status.textContent = "現在の状態: admin 未設定(Socket.IO スクリプトが実行されます)"; |
|
status.style.color = "red"; |
|
} |
|
} |
|
|
|
|
|
updateStatus(); |
|
</script> |
|
</body> |
|
</html> |
|
|