SteamGifts - Group Info Hover

https://www.steamgifts.com/discussion/7TeLS/script-request-groups-hover-identifier

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         SteamGifts - Group Info Hover
// @namespace    https://www.steamgifts.com/discussion/7TeLS/script-request-groups-hover-identifier
// @version      1.0
// @description  https://www.steamgifts.com/discussion/7TeLS/script-request-groups-hover-identifier
// @author       Royalgamer06
// @include      https://www.steamgifts.com/*
// @grant        none
// ==/UserScript==

// Do you want the hover box to be displayed above your cursor instead of below your cursor? (true/false)
var pos_above_cursor = false;
$(document).ready(function() {
    $("body").append("<div id='groupTooltip' style='z-index:2147483647;border:1px solid #d6d6d6;background-color:#f3f3f3;display:none;position:absolute;width:300px'></div>");
    $("body").on("mousemove", ".giveaway__column--group", function(e) {
        if (!$(this).hasClass("tooltipShowing")) {
            $(this).addClass("tooltipShowing");
            $.get(this.href, function(data) {
                $("#groupTooltip").html($(".table__heading+ div", data).length > 0 ? $(".table__heading+ div", data).html() : $(".table--summary", data).html());
                $('#groupTooltip').css({
                    left: e.pageX + 10,
                    top: pos_above_cursor ? e.pageY - $("#groupTooltip").height() - 10 : e.pageY + 10,
                    display: "block"
                });
            });
        }
        $('#groupTooltip').css({
            left: e.pageX + 10,
            top: pos_above_cursor ? e.pageY - $("#groupTooltip").height() - 10 : e.pageY + 10
        });
    }).on("mouseleave", ".giveaway__column--group", function() {
        $('#groupTooltip').css({
            display: "none"
        }).html("");
        $(this).removeClass("tooltipShowing");
    }).on("click", function() {
        if(!$(this).is('#groupTooltip')) {
            $('#groupTooltip').css({
                display: "none"
            }).html("");
            $(this).removeClass("tooltipShowing");
        }
    });
});