Pimeye partial unblur

Adds overflow visibility to text labels in Pimeye results and opens a Google link on click

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Pimeye partial unblur
// @version      1.2
// @description  Adds overflow visibility to text labels in Pimeye results and opens a Google link on click
// @author       SH3LL
// @match        https://pimeyes.com/en/results/*
// @grant        none
// @namespace https://greasyfork.org/users/762057
// ==/UserScript==

(function() {
    'use strict';

    const processedSpans = new Set(); // Set to track processed spans

    function addOverflowVisible() {
        const spans = document.querySelectorAll('span[data-v-d11d31e3]');
        spans.forEach(span => {
            if (!processedSpans.has(span)) { // Check if the span has already been processed
                span.style.overflow = 'visible';
                span.style.maxWidth = '900px';

                // Add a click listener
                span.addEventListener('click', function(event) {
                    event.preventDefault(); // Prevent the span's default behavior

                    const text = span.textContent.trim().replace("https://","").replace("http://",""); // Get the span's text
                    if (text) {
                        const googleSearchUrl = `https://www.google.com/search?q=${encodeURIComponent(text)}`;
                        window.open(googleSearchUrl, '_blank'); // Open the link in a new tab
                    }
                });

                processedSpans.add(span); // Add the span to the set of processed spans
            }
        });
    }

    // Run the function on startup and on every DOM change
    addOverflowVisible();
    const observer = new MutationObserver(addOverflowVisible);
    observer.observe(document.body, { childList: true, subtree: true });
})();