Tinder Unblur

Unblur Tinder teaser images

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Tinder Unblur
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Unblur Tinder teaser images
// @author       You
// @match        https://tinder.com/*
// @grant        none
// @license MIT 
// ==/UserScript==
(function() {
    'use strict';

    function waitForElement(selector, callback) {
        const interval = setInterval(() => {
            if (document.querySelector(selector)) {
                clearInterval(interval);
                callback();
            }
        }, 100);
    }

    async function unblur() {
        const teasers = await fetch("https://api.gotinder.com/v2/fast-match/teasers", {
            headers: {
                "X-Auth-Token": localStorage.getItem("TinderWeb/APIToken"),
                platform: "android",
            },
        })
        .then((res) => res.json())
        .then((res) => res.data.results);

        const teaserEls = document.querySelectorAll(
            ".Expand.enterAnimationContainer > div:nth-child(1)"
        );

        // Check if the length of teaserEls matches teasers array length
        teasers.forEach((teaser, index) => {
            const teaserEl = teaserEls[index];
            
            // Ensure teaserEl exists before trying to modify it
            if (teaserEl) {
                const teaserImage = `https://preview.gotinder.com/${teaser.user._id}/original_${teaser.user.photos[0].id}.jpeg`;
                teaserEl.style.backgroundImage = `url(${teaserImage})`;
            } else {
                console.warn(`No matching element for teaser at index ${index}`);
            }
        });
    }

    // Wait for the elements to be present before executing unblur
    waitForElement(".Expand.enterAnimationContainer > div:nth-child(1)", unblur);

})();