- D20 Studios Wiki

Leaderboard

This widget fetches the Top 25 leaderboard from the Abalon database.

Usage:

Error in widget Leaderboard: Unable to load template 'wiki:Leaderboard'


Loading leaderboard...

<script> (function() {

   // URL to your PHP script - UPDATE THIS TO YOUR ACTUAL URL
   const scriptUrl = 'https://d20studios.com/abalon/services/abalonStatBot.php'; 
   fetch(scriptUrl, {
       method: 'POST',
       headers: { 'Content-Type: application/json' },
       body: JSON.stringify({ type: 'leaderboardTop', limit: 25 })
   })
   .then(response => response.json())
   .then(data => {
       if (data.status === 'success') {

let html = '

'; html += '';
           data.topPlayers.forEach((player, index) => {
html += ``; }); html += '
PlacementUsernameScore
#${index + 1} ${player.playerName} ${Number(player.score).toLocaleString()}

';

           document.getElementById('leaderboard-container').innerHTML = html;
       } else {
           document.getElementById('leaderboard-container').innerHTML = 'Error loading leaderboard data.';
       }
   })
   .catch(error => {
       console.error('Error:', error);
       document.getElementById('leaderboard-container').innerHTML = 'Failed to connect to the leaderboard service.';
   });

})(); </script>

Chat with us live on DISCORD

Newsletter Signup