Tinder Unblur

Unblur Tinder teaser images

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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);

})();