eBay 'My eBay' Hover Button Fix

Prevents the "My eBay" link from navigating when clicked, removes hover delay, moves the menu closer, and adds a disappearing delay.

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         eBay 'My eBay' Hover Button Fix
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Prevents the "My eBay" link from navigating when clicked, removes hover delay, moves the menu closer, and adds a disappearing delay.
// @author       Matija Erceg
// @license      MIT
// @match        https://www.ebay.ca/*
// @match        https://www.ebay.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Disable the click functionality for "My eBay"
    const observer = new MutationObserver(() => {
        const myEbayLink = document.querySelector('#gh-eb-My a.gh-eb-li-a');
        if (myEbayLink) {
            myEbayLink.addEventListener('click', (event) => {
                event.preventDefault();
                event.stopPropagation();
            });

            // Stop observing once the link is handled
            observer.disconnect();
        }
    });

    observer.observe(document.body, { childList: true, subtree: true });

    // Inject CSS to remove hover delay, move menu closer, and add disappearing delay
    const style = document.createElement('style');
    style.textContent = `
        #gh-eb-My .gh-submenu {
            margin-top: -5px !important; /* Move the menu closer to eliminate the gap */
            transition-delay: 0.2s !important; /* Add a disappearing delay */
        }
        #gh-eb-My:hover .gh-submenu {
            transition-delay: 0s !important; /* No delay on hover */
            display: block !important;
        }
    `;
    document.head.appendChild(style);
})();