SheridanCoriana6

Google Images exact match sorting

Feb 6th, 2026 (edited)
78
0
Never
8
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.56 KB | Source Code | 0 0
  1. // ==UserScript==
  2. // @name Google Lens - Czysta Galeria (V6.2 Fix Duplikatów)
  3. // @namespace http://tampermonkey.net/
  4. // @version 6.2
  5. // @description Tworzy nową galerię z posortowanych wyników. Naprawiono błąd ukrywania obrazków o tej samej rozdzielczości.
  6. // @author Ty
  7. // @match https://www.google.com/search?*lns_surface=*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. const BUTTON_ID = 'img-sort-btn-v6';
  15. const RES_REGEX = /((?:\d{1,3}[\s.]?)+)\s*[x×]\s*((?:\d{1,3}[\s.]?)+)/;
  16.  
  17. // --- KONFIGURACJA UI ---
  18. function createButton() {
  19. if (document.getElementById(BUTTON_ID)) return;
  20.  
  21. const btn = document.createElement('button');
  22. btn.id = BUTTON_ID;
  23. btn.innerText = "⚡ JUMP DOWN & SORT";
  24. Object.assign(btn.style, {
  25. position: 'fixed',
  26. bottom: '150px',
  27. right: '20px',
  28. zIndex: '9999999',
  29. padding: '12px 20px',
  30. backgroundColor: '#202124',
  31. color: '#8ab4f8',
  32. border: '2px solid #8ab4f8',
  33. borderRadius: '8px',
  34. cursor: 'pointer',
  35. fontWeight: 'bold',
  36. fontSize: '14px',
  37. boxShadow: '0 4px 10px rgba(0,0,0,0.5)'
  38. });
  39.  
  40. btn.onclick = () => {
  41. btn.innerText = "⬇️ Loading Images...";
  42.  
  43. // Skocz na dół, by wymusić ładowanie lazy-load
  44. window.scrollTo({
  45. top: document.body.scrollHeight,
  46. behavior: 'smooth'
  47. });
  48.  
  49. // Czekaj 2 sekundy
  50. setTimeout(() => {
  51. btn.innerText = "⏳ Wait: Analizyng & Sort...";
  52. setTimeout(generateCleanGallery, 100);
  53. }, 2000);
  54. };
  55.  
  56. document.body.appendChild(btn);
  57. }
  58.  
  59. // --- LOGIKA CZYSZCZENIA LINKÓW ---
  60. function cleanGoogleUrl(url) {
  61. if (!url) return null;
  62. if (!url.includes('google.com')) return url;
  63.  
  64. try {
  65. const urlObj = new URL(url);
  66. const q = urlObj.searchParams.get('q');
  67. const imgurl = urlObj.searchParams.get('imgurl');
  68.  
  69. if (imgurl) return decodeURIComponent(imgurl);
  70. if (q) return decodeURIComponent(q);
  71. } catch (e) {}
  72.  
  73. return url;
  74. }
  75.  
  76. // --- LOGIKA EKSTRAKCJI DANYCH ---
  77. function generateCleanGallery() {
  78. const btn = document.getElementById(BUTTON_ID);
  79. const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, false);
  80. const items = [];
  81. let node;
  82.  
  83. while (node = walker.nextNode()) {
  84. if (RES_REGEX.test(node.nodeValue)) {
  85. const match = node.nodeValue.match(RES_REGEX);
  86. const w = parseInt(match[1].replace(/[^\d]/g, ''), 10);
  87. const h = parseInt(match[2].replace(/[^\d]/g, ''), 10);
  88. const pixels = w * h;
  89.  
  90. // Szukanie kontenera
  91. let card = node.parentElement;
  92. let validCard = null;
  93.  
  94. for (let i = 0; i < 15; i++) {
  95. if (!card) break;
  96. if (card.querySelector('img')) {
  97. validCard = card;
  98. if (card.parentElement.tagName === 'A') validCard = card.parentElement;
  99. if (card.parentElement.parentElement && card.parentElement.parentElement.tagName === 'A') validCard = card.parentElement.parentElement;
  100. break;
  101. }
  102. card = card.parentElement;
  103. }
  104.  
  105. if (validCard) {
  106. const img = validCard.querySelector('img');
  107. // Pobieramy najlepsze dostępne źródło
  108. let imgSrc = img ? (img.getAttribute('data-src') || img.getAttribute('data-iurl') || img.src) : '';
  109.  
  110. let linkUrl = '';
  111. if (validCard.tagName === 'A') {
  112. linkUrl = validCard.href;
  113. } else {
  114. const a = validCard.querySelector('a');
  115. if (a) linkUrl = a.href;
  116. }
  117.  
  118. const cleanLink = cleanGoogleUrl(linkUrl);
  119.  
  120. // --- POPRAWKA TUTAJ ---
  121. // Sprawdzamy duplikaty dokładniej.
  122. // Element jest duplikatem TYLKO jeśli ma ten sam obrazek ORAZ ten sam link docelowy.
  123. // Pozwala to na wiele obrazków z tą samą rozdzielczością, a nawet tym samym placeholderem, jeśli prowadzą gdzie indziej.
  124. const isDuplicate = items.some(item => item.src === imgSrc && item.link === cleanLink);
  125.  
  126. if (imgSrc && !isDuplicate) {
  127. items.push({
  128. src: imgSrc,
  129. link: cleanLink,
  130. res: match[0],
  131. pixels: pixels
  132. });
  133. }
  134. }
  135. }
  136. }
  137.  
  138. if (items.length === 0) {
  139. alert("No results found. Try scrolling the page manually.");
  140. btn.innerText = "⚡ JUMP DOWN & SORT";
  141. return;
  142. }
  143.  
  144. // Sortowanie malejąco po pikselach
  145. items.sort((a, b) => b.pixels - a.pixels);
  146.  
  147. renderGallery(items);
  148. btn.innerText = "✅ Done";
  149. }
  150.  
  151. function renderGallery(items) {
  152. const old = document.getElementById('custom-clean-gallery');
  153. if (old) old.remove();
  154.  
  155. const container = document.createElement('div');
  156. container.id = 'custom-clean-gallery';
  157. Object.assign(container.style, {
  158. position: 'relative',
  159. width: '100%',
  160. backgroundColor: '#121212',
  161. padding: '20px',
  162. boxSizing: 'border-box',
  163. borderBottom: '4px solid #8ab4f8',
  164. marginBottom: '20px',
  165. zIndex: '100'
  166. });
  167.  
  168. const grid = document.createElement('div');
  169. Object.assign(grid.style, {
  170. display: 'grid',
  171. gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))',
  172. gap: '15px',
  173. });
  174.  
  175. const header = document.createElement('h2');
  176. header.innerText = `🔍 Znaleziono ${items.length} obrazów (Posortowane)`;
  177. header.style.color = '#fff';
  178. header.style.fontFamily = 'sans-serif';
  179. header.style.marginBottom = '15px';
  180. container.appendChild(header);
  181.  
  182. items.forEach(item => {
  183. const card = document.createElement('div');
  184. Object.assign(card.style, {
  185. backgroundColor: '#2d2e30',
  186. borderRadius: '8px',
  187. overflow: 'hidden',
  188. display: 'flex',
  189. flexDirection: 'column',
  190. border: '1px solid #3c4043'
  191. });
  192.  
  193. const link = document.createElement('a');
  194. link.href = item.link || '#';
  195. link.target = '_blank';
  196. link.style.textDecoration = 'none';
  197. link.style.flexGrow = '1';
  198. link.style.display = 'flex';
  199. link.style.flexDirection = 'column';
  200.  
  201. const img = document.createElement('img');
  202. img.src = item.src;
  203. Object.assign(img.style, {
  204. width: '100%',
  205. height: '200px',
  206. objectFit: 'contain',
  207. backgroundColor: '#000',
  208. display: 'block'
  209. });
  210.  
  211. const info = document.createElement('div');
  212. Object.assign(info.style, {
  213. padding: '10px',
  214. color: '#e8eaed',
  215. fontSize: '12px',
  216. fontFamily: 'monospace',
  217. textAlign: 'center',
  218. borderTop: '1px solid #3c4043'
  219. });
  220. info.innerHTML = `
  221. <span style="color:#8ab4f8; font-weight:bold; font-size:14px;">${item.res}</span><br>
  222. <span style="color:#9aa0a6;">Kliknij, aby otworzyć</span>
  223. `;
  224.  
  225. link.appendChild(img);
  226. link.appendChild(info);
  227. card.appendChild(link);
  228. grid.appendChild(card);
  229. });
  230.  
  231. container.appendChild(grid);
  232.  
  233. const main = document.getElementById('main') || document.body;
  234. main.prepend(container);
  235.  
  236. window.scrollTo({ top: 0, behavior: 'smooth' });
  237. }
  238.  
  239. createButton();
  240.  
  241. })();
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Zohimco
    10 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
  • User was banned
Add Comment
Please, Sign In to add comment