Civitai Model Versions Scroll Remover

Removes scrolling on Civitai model versions, allowing for easy selection for models with many alternative versions.

  1. // ==UserScript==
  2. // @name Civitai Model Versions Scroll Remover
  3. // @version 0.0.1
  4. // @description Removes scrolling on Civitai model versions, allowing for easy selection for models with many alternative versions.
  5. // @author kaljinn
  6. // @license The Unlicense
  7. // @namespace https://civitai.com/user/kaljinn
  8. // @match https://civitai.com/models/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Wait for the page to load completely
  16. window.addEventListener('load', function() {
  17. // Select the element using the new selector
  18. let element = document.querySelector('.mantine-ScrollArea-viewport > div > div.mantine-Group-root');
  19.  
  20. if (element) {
  21. // Apply inline CSS to change flex-wrap to wrap
  22. element.style.flexWrap = 'wrap';
  23.  
  24. // Remove all previous siblings
  25. let prevSibling = element.previousElementSibling;
  26. while (prevSibling) {
  27. prevSibling.remove();
  28. prevSibling = element.previousElementSibling;
  29. }
  30.  
  31. // Remove all next siblings
  32. let nextSibling = element.nextElementSibling;
  33. while (nextSibling) {
  34. nextSibling.remove();
  35. nextSibling = element.nextElementSibling;
  36. }
  37. }
  38. });
  39. })();