public
Description: WoW Addon - Simple item compare tooltips
Homepage: http://www.tekkub.net/
Clone URL: git://github.com/tekkub/tekkompare.git
Click here to lend your support to: tekkompare and make a donation at www.pledgie.com !
tekkompare / HoverTips.lua
100644 34 lines (24 sloc) 0.944 kb
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
local orig1, orig2 = {}, {}
local GameTooltip = GameTooltip
 
local linktypes = {item = true, enchant = true, spell = true, quest = true, unit = true, talent = true, achievement = true, glyph = true}
 
 
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()
end
 
if orig1[frame] then return orig1[frame](frame, link, ...) end
end
 
local function OnHyperlinkLeave(frame, ...)
GameTooltip: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