HotPot.ai show all styles

Добавляет всех стилей

  1. // ==UserScript==
  2. // @name HotPot.ai show all styles
  3. // @namespace Wizzergod
  4. // @version 1.0.7
  5. // @description Добавляет всех стилей
  6. // @icon https://www.google.com/s2/favicons?sz=64&domain=hotpot.ai
  7. // @license MIT
  8. // @author Wizzergod
  9. // @match *://hotpot.ai/art-generator*
  10. // @match *://hotpot.ai/remove-background*
  11. // @match *://hotpot.ai/anime-generator*
  12. // @match *://hotpot.ai/headshot/train*
  13. // @match *://hotpot.ai/logo-generator*
  14. // @match *://hotpot.ai/background-generator*
  15. // @match *://hotpot.ai/lunar-new-year-headshot*
  16. // @match *://hotpot.ai/ai-avatar*
  17. // @match *://hotpot.ai/ai-editor*
  18. // @match *://hotpot.ai/ai-stock-photo*
  19. // @grant GM_setValue
  20. // @grant GM_getValue
  21. // @grant GM_addStyle
  22. // ==/UserScript==
  23.  
  24. (function() {
  25. 'use strict';
  26.  
  27. // Функция для извлечения названия @match из URL
  28. function extractMatchName(url) {
  29. const match = url.match(/hotpot\.ai\/([^\/]+)/);
  30. return match && match[1];
  31. }
  32.  
  33. // Функция для обновления данных галереи
  34. function updateData(matchName) {
  35. const iframe = document.getElementById('hotpotCatalogOverlay');
  36. if (!iframe) {
  37. console.error('iframe not found');
  38. return;
  39. }
  40.  
  41. const iframeContent = iframe.contentDocument || iframe.contentWindow.document;
  42. const galleryItems = iframeContent.querySelectorAll('.itemBox');
  43. const galleryData = [];
  44.  
  45. galleryItems.forEach(item => {
  46. const itemId = item.getAttribute('data-itemid');
  47. const imgElement = item.querySelector('.imageBox img');
  48.  
  49. if (imgElement && imgElement.hasAttribute('src')) {
  50. const imgSrc = imgElement.src;
  51. const itemName = item.querySelector('.name').textContent;
  52.  
  53. if (itemId && itemId !== "null") {
  54. galleryData.push({ itemId, imgSrc, itemName });
  55. }
  56. }
  57. });
  58.  
  59. const key = `galleryData-${matchName}`;
  60. localStorage.setItem(key, JSON.stringify(galleryData));
  61. console.log('Gallery data saved for match:', matchName, galleryData);
  62.  
  63. // Обновляем historyBox
  64. updateHistoryBox(matchName);
  65. }
  66.  
  67. // Функция для обновления истории просмотров
  68. function updateHistoryBox(matchName) {
  69. const key = `galleryData-${matchName}`;
  70. const galleryData = JSON.parse(localStorage.getItem(key));
  71. const historyBox = document.querySelector('.historyBox');
  72. if (!historyBox) {
  73. console.error('historyBox not found');
  74. return;
  75. }
  76. historyBox.innerHTML = '';
  77.  
  78. galleryData.forEach(data => {
  79. const thumbnailBox = document.createElement('div');
  80. thumbnailBox.className = 'thumbnailBox';
  81. thumbnailBox.setAttribute('styleid', data.itemId);
  82. thumbnailBox.setAttribute('stylelabel', data.itemName);
  83.  
  84. const img = document.createElement('img');
  85. img.src = data.imgSrc;
  86.  
  87. thumbnailBox.appendChild(img);
  88. historyBox.appendChild(thumbnailBox);
  89. });
  90. }
  91.  
  92. // Функция для обновления данных после полной загрузки страницы
  93. function initialize() {
  94. const matchName = extractMatchName(window.location.href);
  95. if (matchName) {
  96. updateData(matchName);
  97. }
  98. }
  99.  
  100. // Вызываем функцию для создания кнопки после полной загрузки страницы
  101. window.addEventListener('load', initialize);
  102. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址