Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html lang="pl">
<head>
  <meta charset="UTF-8">
  <title>Wyniki drużyn</title>
  <style>
    body { font-family: sans-serif; padding: 20px; background: #eef; }
    .team { background: #fff; padding: 10px; margin: 10px 0; border: 1px solid #ccc; }
  </style>
</head>
<body>
  <h2>Wyniki drużyn – Escape Challenge</h2>
  <label>Filtruj po pokoju:</label>
  <select id="filterRoom"><option value="">Wszystkie</option></select>
  <div id="teams"></div>
  <script>
    const teams = JSON.parse(localStorage.getItem("teams")) || [];
    function render(filter = "") {
      const list = document.getElementById("teams");
      list.innerHTML = "";
      const filtered = filter ? teams.filter(t => t.room === filter) : teams;
      filtered.sort((a,b) => b.points - a.points).forEach(t => {
        const div = document.createElement("div");
        div.className = "team";
        div.innerHTML = `<strong>${t.name}</strong> – ${t.points} pkt<br>Pokój: ${t.room}<br>Przywódca: ${t.leader}`;
        list.appendChild(div);
      });
    }
    function populateFilter() {
      const select = document.getElementById("filterRoom");
      const rooms = [...new Set(teams.map(t => t.room))];
      rooms.forEach(r => {
        const option = document.createElement("option");
        option.value = r;
        option.textContent = r;
        select.appendChild(option);
      });
    }
    document.getElementById("filterRoom").addEventListener("change", (e) => {
      render(e.target.value);
    });
    populateFilter();
    render();
  </script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
webctplpro
0viewers