* Injects or updates the CSS style element for the grid.
()
| 481 | * Injects or updates the CSS style element for the grid. |
| 482 | */ |
| 483 | injectCSS() { |
| 484 | if (isPlaylistPage()) { |
| 485 | logger('Skipping CSS injection on playlist page') |
| 486 | this.removeCSS() |
| 487 | return |
| 488 | } |
| 489 | let style = document.getElementById('dynamic-grid-style') |
| 490 | if (!style) { |
| 491 | style = document.createElement('style') |
| 492 | style.id = 'dynamic-grid-style' |
| 493 | const nonce = document.querySelector('meta[name="csp-nonce"]')?.content |
| 494 | if (nonce) style.nonce = nonce |
| 495 | document.head.appendChild(style) |
| 496 | logger('Injected CSS style element', 'debug') |
| 497 | } |
| 498 | this.updateCSS(this.calculateItemsPerRow()) |
| 499 | }, |
| 500 | |
| 501 | /** |
| 502 | * Updates the CSS rule for the specified number of items per row. |
nothing calls this directly
no test coverage detected