Disable Double Tap to Like on Instagram

Prevents accidental likes from Instagram's double-tap gesture. Disables double-tap to like feature while browsing images, reducing unintended interactions and giving users better control over their engagement activities.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Disable Double Tap to Like on Instagram
// @namespace    http://tampermonkey.net/
// @version      2025-09-15
// @description  Prevents accidental likes from Instagram's double-tap gesture. Disables double-tap to like feature while browsing images, reducing unintended interactions and giving users better control over their engagement activities.
// @author       Priesdelly
// @match        *://*.instagram.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function preventDoubleTapToLike(event) {
        // Target images and other interactive elements where double-tap might trigger likes
        const target = event.target;
        if (target.tagName.toLowerCase() === 'img' ||
            target.closest('article') ||
            target.closest('[role="presentation"]')) {
            event.stopPropagation();
            event.preventDefault();
            return false;
        }
    }

    // Wait for DOM to be ready before adding listeners
    function initializeScript() {
        // Remove existing listeners if any (for script updates)
        document.removeEventListener('dblclick', preventDoubleTapToLike, true);

        // Add event listener with capture phase for better interception
        document.addEventListener('dblclick', preventDoubleTapToLike, true);

        // Also handle touch events for mobile devices
        document.addEventListener('touchend', function(event) {
            if (event.touches.length === 0 && event.changedTouches.length === 1) {
                const now = Date.now();
                const lastTap = this.lastTap || 0;

                if (now - lastTap < 300) { // Double tap detected
                    preventDoubleTapToLike(event);
                }
                this.lastTap = now;
            }
        }, true);
    }

    // Initialize when DOM is ready
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', initializeScript);
    } else {
        initializeScript();
    }
})();