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.

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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