Blur Torn Newspaper Ass Image

Blurs a specific image in the Torn newspaper by matching its background URL.

// ==UserScript==
// @name         Blur Torn Newspaper Ass Image
// @namespace    Blur
// @version      1.0.4
// @description  Blurs a specific image in the Torn newspaper by matching its background URL.
// @author       GNSC4 [268863]
// @match        *://*.torn.com/*
// @grant        none
// @run-at       document-idle
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // The specific background image URL to look for
    const targetImageUrl = "https://newspaper.torn.com/2737/leadImage/bcce6abf-f904-4cbc-a3ec-fe5f494d1f69/original.png";

    // Function to find and blur the element
    function findAndBlurImage() {
        // Get all div elements on the page (could be narrowed down if a common parent is known)
        const allDivs = document.querySelectorAll('div');
        let found = false; // Flag to check if the element was found

        for (const div of allDivs) {
            // Check if the element has a background image style set
            if (div.style && div.style.backgroundImage) {
                // The style is usually in the format: url("...")
                // We need to extract the URL part
                const styleUrl = div.style.backgroundImage;
                const match = styleUrl.match(/url\("?(.+?)"?\)/); // Regex to extract URL

                if (match && match[1] === targetImageUrl) {
                    // Found the element with the matching background image URL
                    div.style.filter = 'blur(10px)'; // Apply the blur filter
                    console.log('Torn Image Blurrer: Found and blurred element with URL:', targetImageUrl);
                    found = true; // Mark as found
                    return true; // Exit the function successfully
                }
            }
        }
        return false; // Return false if not found in this pass
    }

    // Wait for the element to potentially load dynamically
    const interval = setInterval(() => {
        if (findAndBlurImage()) {
            // If found and blurred, clear the interval
            clearInterval(interval);
        }
    }, 1000); // Check every 1000 milliseconds (increased interval slightly)

    // Optional: Stop trying after a certain time (e.g., 15 seconds)
    setTimeout(() => {
        clearInterval(interval);
        // Optionally log if not found after timeout
        // console.log('Torn Image Blurrer: Timed out searching for image URL.');
    }, 15000); // Stop after 15 seconds

})();

QingJ © 2025

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