* Updates the CSS rule for the specified number of items per row. * @param {number} itemsPerRow - Number of items per row
(itemsPerRow)
| 503 | * @param {number} itemsPerRow - Number of items per row |
| 504 | */ |
| 505 | updateCSS(itemsPerRow) { |
| 506 | const style = document.getElementById('dynamic-grid-style') |
| 507 | if (!style) return |
| 508 | style.textContent = ` |
| 509 | #contents, ytd-two-column-browse-results-renderer { |
| 510 | max-width: 100% !important; |
| 511 | width: 100% !important; |
| 512 | padding: 0 !important; |
| 513 | } |
| 514 | ytd-rich-grid-renderer:not([hidden]) { |
| 515 | --ytd-rich-grid-items-per-row: ${itemsPerRow} !important; |
| 516 | --ytd-rich-grid-posts-per-row: ${itemsPerRow} !important; |
| 517 | max-width: 100% !important; |
| 518 | padding: 0 !important; |
| 519 | gap: ${CONFIG.GAP}px !important; |
| 520 | } |
| 521 | ytd-rich-grid-renderer:not([hidden]) [is-in-first-column] { |
| 522 | margin-left: 8px !important; |
| 523 | margin-right: 8px !important; |
| 524 | margin-bottom: 16px !important; |
| 525 | } |
| 526 | ytd-rich-grid-renderer:not([hidden]) ytd-rich-item-renderer { |
| 527 | margin: 0 8px 16px 8px !important; |
| 528 | } |
| 529 | ` |
| 530 | }, |
| 531 | |
| 532 | /** |
| 533 | * Removes the CSS style element and resets grid attributes. |
nothing calls this directly
no outgoing calls
no test coverage detected