solutions/CCTF_Solutions_main/frontend/leaderboard.html

86 lines
2.5 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<title>Flag Submission Page</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body style="height:1500px">
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">Flag Submission Page</a>
</div>
<ul class="nav navbar-nav">
<li class="active"><a href="leaderboard.html">Leaderboard</a></li>
<li><a href="sendflag.html">Send Flag</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><button class="btn btn-default navbar-btn" id="metamask-login" type="button" style="margin-right:20px"><span class="glyphicon glyphicon-log-in"></span> Connect Wallet</button></li>
<!--<button class="btn btn-danger navbar-btn">Button</button>-->
</ul>
</div>
</nav>
<div class="container" style="margin-top:50px">
<h1>Players and leaderboard</h1>
<table class="table table-striped" style="width: 75%" align="center">
<thead>
<tr>
<th>Player</th>
<th>Status</th>
<th>Points</th>
</tr>
</thead>
<tbody>
<tr>
<td>Player1</td>
<td>Playing</td>
<td>1234</td>
</tr>
<tr>
<td>Player2</td>
<td>Banned</td>
<td>0</td>
</tr>
<tr>
<td>Player3</td>
<td>Nice</td>
<td>69</td>
</tr>
</tbody>
</table>
</div>
<script type='module'>
window.addEventListener("load", function () {
let loginbutton = document.getElementById('metamask-login');
let accounts;
ethereum.request({method: 'eth_requestAccounts'}).then(accounts => {
console.log(accounts);
if (accounts.length > 0) {
loginbutton.textContent = accounts[0];
loginbutton.disabled = true;
}
});
});
loginbutton.addEventListener('click', event => {
let account;
ethereum.request({method: 'eth_requestAccounts'}).then(accounts =>{
account = accounts[0];
//alert(account);
console.log(account);
loginbutton.textContent = account;
loginbutton.disabled = true;
})
})
</script>
</body>
</html>