-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathHoverTips.lua
46 lines (34 loc) · 1.27 KB
/
HoverTips.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
local myname, ns = ...
local orig1, orig2 = {}, {}
local GameTooltip = GameTooltip
local linktypes = {item = true, enchant = true, spell = true, quest = true,
unit = true, talent = true, achievement = true, glyph = true,
instancelock = true}
local function ShowBattlePetTooltip(frame, pre, ...)
GameTooltip:SetOwner(frame, "ANCHOR_TOPLEFT")
BattlePetToolTip_Show(ns.tonumber_all(...))
end
local function OnHyperlinkEnter(frame, link, ...)
local linktype = link:match("^([^:]+)")
if linktype and linktypes[linktype] then
GameTooltip:SetOwner(frame, "ANCHOR_TOPLEFT")
GameTooltip:SetHyperlink(link)
GameTooltip:Show()
elseif linktype and linktype == 'battlepet' then
ShowBattlePetTooltip(frame, strsplit(":", link))
end
if orig1[frame] then return orig1[frame](frame, link, ...) end
end
local function OnHyperlinkLeave(frame, ...)
GameTooltip:Hide()
BattlePetTooltip:Hide()
if orig2[frame] then return orig2[frame](frame, ...) end
end
local _G = getfenv(0)
for i=1, NUM_CHAT_WINDOWS do
local frame = _G["ChatFrame"..i]
orig1[frame] = frame:GetScript("OnHyperlinkEnter")
frame:SetScript("OnHyperlinkEnter", OnHyperlinkEnter)
orig2[frame] = frame:GetScript("OnHyperlinkLeave")
frame:SetScript("OnHyperlinkLeave", OnHyperlinkLeave)
end