|
168 | 168 | {{end}} |
169 | 169 | {{end}} |
170 | 170 | </div> |
| 171 | + <style> |
| 172 | + .copy-icon { |
| 173 | + display: none; |
| 174 | + position: absolute; |
| 175 | + right: 4px; |
| 176 | + top: 50%; |
| 177 | + transform: translateY(-50%) scaleX(-1); |
| 178 | + width: 14px; |
| 179 | + height: 14px; |
| 180 | + opacity: 0.5; |
| 181 | + pointer-events: none; |
| 182 | + } |
| 183 | + |
| 184 | + .providers-table tbody td { |
| 185 | + position: relative; |
| 186 | + padding-right: 24px; |
| 187 | + transition: background-color 0.5s ease-out; |
| 188 | + } |
| 189 | + |
| 190 | + .providers-table tbody td:hover .copy-icon { |
| 191 | + display: block; |
| 192 | + } |
| 193 | + </style> |
| 194 | + <script> |
| 195 | + // Make all table cells copyable on click with visual copy icon |
| 196 | + document.addEventListener('DOMContentLoaded', function() { |
| 197 | + const tables = document.querySelectorAll('.providers-table'); |
| 198 | + |
| 199 | + // SVG copy icon |
| 200 | + const copyIconSVG = ` |
| 201 | + <svg class="copy-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
| 202 | + <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect> |
| 203 | + <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path> |
| 204 | + </svg> |
| 205 | + `; |
| 206 | + |
| 207 | + tables.forEach(table => { |
| 208 | + const cells = table.querySelectorAll('tbody td'); |
| 209 | + |
| 210 | + cells.forEach(cell => { |
| 211 | + cell.style.cursor = 'pointer'; |
| 212 | + |
| 213 | + // Add copy icon to cell |
| 214 | + cell.insertAdjacentHTML('beforeend', copyIconSVG); |
| 215 | + |
| 216 | + cell.addEventListener('click', function() { |
| 217 | + // Get the text content |
| 218 | + const textToCopy = this.textContent.trim(); |
| 219 | + |
| 220 | + if (!textToCopy || textToCopy === 'No stats available') { |
| 221 | + return; |
| 222 | + } |
| 223 | + |
| 224 | + // Copy to clipboard |
| 225 | + navigator.clipboard.writeText(textToCopy).then(() => { |
| 226 | + // Visual feedback with smooth fade |
| 227 | + const originalBg = this.style.backgroundColor; |
| 228 | + this.style.backgroundColor = '#d4edda'; |
| 229 | + |
| 230 | + setTimeout(() => { |
| 231 | + this.style.backgroundColor = originalBg; |
| 232 | + }, 300); |
| 233 | + }).catch(err => { |
| 234 | + console.error('Failed to copy:', err); |
| 235 | + }); |
| 236 | + }); |
| 237 | + }); |
| 238 | + }); |
| 239 | + }); |
| 240 | + </script> |
171 | 241 | </body> |
172 | 242 | </html> |
0 commit comments