Greasy Fork 还支持 简体中文。

c.Ai Search Expander

Automatically expands search results on c.Ai

  1. // ==UserScript==
  2. // @name c.Ai Search Expander
  3. // @namespace https://greasyfork.org/users/searchexpansion
  4. // @version 1.1
  5. // @description Automatically expands search results on c.Ai
  6. // @author ashley
  7. // @match https://character.ai/*
  8. // @icon https://c.ai/static/images/favicon.ico
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. function expandSearchResults() {
  17. const loadMoreButton = document.querySelector('.search-load-more');
  18. if (loadMoreButton) {
  19. loadMoreButton.click();
  20. setTimeout(expandSearchResults, 500); // Wait 0.5 seconds before checking again
  21. }
  22. }
  23.  
  24. const observer = new MutationObserver((mutations) => {
  25. mutations.forEach((mutation) => {
  26. if (mutation.type === 'childList' && document.querySelector('.search-load-more')) {
  27. expandSearchResults();
  28. setTimeout(() => observer.disconnect(), 1000); // Disconnect after 1 second delay
  29. }
  30. });
  31. });
  32.  
  33. observer.observe(document.body, { childList: true, subtree: true });
  34. })();