cdechoch commited on
Commit
b956a95
·
verified ·
1 Parent(s): 542eaad

Update team.html

Browse files
Files changed (1) hide show
  1. team.html +16 -0
team.html CHANGED
@@ -45,6 +45,8 @@
45
  .mention-text a { color: #f97316; text-decoration: none; }
46
  .mention-text a:hover { text-decoration: underline; }
47
  .mention-text .player-link { color: #2563eb; font-weight: 500; }
 
 
48
  .mention-footer { margin-top: 12px; }
49
  .view-original { color: #f97316; text-decoration: none; font-size: 14px; font-weight: 500; }
50
  .view-original:hover { text-decoration: underline; }
@@ -90,11 +92,16 @@
90
  <script>
91
  const teamName = decodeURIComponent(window.location.pathname.split('/team/')[1] || '');
92
  let allPlayers = [];
 
93
 
94
  async function loadPlayerList() {
95
  try { const res = await fetch('/api/players?hours=72&limit=200'); allPlayers = (await res.json()).map(p => p.player); } catch (e) {}
96
  }
 
 
 
97
  loadPlayerList();
 
98
 
99
  const searchInput = document.getElementById('searchInput');
100
  const searchResults = document.getElementById('searchResults');
@@ -126,10 +133,19 @@
126
  escaped = escaped.replace(/(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/gi, '<a href="$1" target="_blank">$1</a>');
127
  // Match domain.com/path URLs (common patterns without protocol)
128
  escaped = escaped.replace(/(?<![\/\w@])((?:[a-zA-Z0-9-]+\.)+(?:com|net|org|io|co|tv|be|ly|me|us|uk|ca|au|de|fr|es|it|nl|app|dev|gg|xyz|info|biz)\/[^\s<]*[^<.,:;"')\]\s])/gi, '<a href="https://$1" target="_blank">$1</a>');
 
 
 
129
  for (const player of allPlayers) {
130
  const regex = new RegExp(`\\b(${player.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})\\b`, 'gi');
131
  escaped = escaped.replace(regex, `<a href="/player/${encodeURIComponent(player)}" class="player-link">$1</a>`);
132
  }
 
 
 
 
 
 
133
  return escaped;
134
  }
135
 
 
45
  .mention-text a { color: #f97316; text-decoration: none; }
46
  .mention-text a:hover { text-decoration: underline; }
47
  .mention-text .player-link { color: #2563eb; font-weight: 500; }
48
+ .mention-text .team-link { color: #059669; font-weight: 500; }
49
+ .mention-text .handle-link { color: #7c3aed; }
50
  .mention-footer { margin-top: 12px; }
51
  .view-original { color: #f97316; text-decoration: none; font-size: 14px; font-weight: 500; }
52
  .view-original:hover { text-decoration: underline; }
 
92
  <script>
93
  const teamName = decodeURIComponent(window.location.pathname.split('/team/')[1] || '');
94
  let allPlayers = [];
95
+ let allTeams = [];
96
 
97
  async function loadPlayerList() {
98
  try { const res = await fetch('/api/players?hours=72&limit=200'); allPlayers = (await res.json()).map(p => p.player); } catch (e) {}
99
  }
100
+ async function loadTeamList() {
101
+ try { const res = await fetch('/api/teams?hours=168&limit=30'); allTeams = (await res.json()).map(t => t.team); } catch (e) {}
102
+ }
103
  loadPlayerList();
104
+ loadTeamList();
105
 
106
  const searchInput = document.getElementById('searchInput');
107
  const searchResults = document.getElementById('searchResults');
 
133
  escaped = escaped.replace(/(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/gi, '<a href="$1" target="_blank">$1</a>');
134
  // Match domain.com/path URLs (common patterns without protocol)
135
  escaped = escaped.replace(/(?<![\/\w@])((?:[a-zA-Z0-9-]+\.)+(?:com|net|org|io|co|tv|be|ly|me|us|uk|ca|au|de|fr|es|it|nl|app|dev|gg|xyz|info|biz)\/[^\s<]*[^<.,:;"')\]\s])/gi, '<a href="https://$1" target="_blank">$1</a>');
136
+ // Match @handles (Bluesky handles)
137
+ escaped = escaped.replace(/@([a-zA-Z0-9][a-zA-Z0-9._-]*(?:\.[a-zA-Z][a-zA-Z0-9._-]*)+)/g, '<a href="https://bsky.app/profile/$1" target="_blank" class="handle-link">@$1</a>');
138
+ // Match player names
139
  for (const player of allPlayers) {
140
  const regex = new RegExp(`\\b(${player.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})\\b`, 'gi');
141
  escaped = escaped.replace(regex, `<a href="/player/${encodeURIComponent(player)}" class="player-link">$1</a>`);
142
  }
143
+ // Match team names (skip current team to avoid linking everything)
144
+ for (const team of allTeams) {
145
+ if (team === teamName) continue;
146
+ const regex = new RegExp(`\\b(${team.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})\\b`, 'gi');
147
+ escaped = escaped.replace(regex, `<a href="/team/${encodeURIComponent(team)}" class="team-link">$1</a>`);
148
+ }
149
  return escaped;
150
  }
151