Lua Code:
local function ChatlinkTooltips_SetOrHookHandler(frame, event, func)
frame:HookScript(event, func) -- Sets & Hooks the script
end
Worked like a charm, ty
However:
Lua Code:
local linkType = strmatch(linkData, "|H(.-):")
doesn't seem to work.. and i don't quiet get, why it "should" work either?
string.split(":", linkData) makes also way more sense in my head :P Here is my code so far:
Lua Code:
local supportedType = {
spell = true,
item = true,
quest = true,
achievement = true,
talent = true,
glyph = true,
unit = true,
enchant = true
}
local function ChatlinkTooltips_ShowTip(self, linkData)
local linkType = string.split(":", linkData)
if supportedType[linkType] then
GameTooltip:SetOwner(self, "ANCHOR_CURSOR")
GameTooltip:SetHyperlink(linkData)
GameTooltip:Show()
end
end
local function ChatlinkTooltips_HideTip()
GameTooltip:Hide()
end
local function ChatlinkTooltips_HookHandler(frame, event, func)
frame:HookScript(event, func) -- Sets & Hooks the script
end
for i = 1, NUM_CHAT_WINDOWS do
local frame = _G["ChatFrame" .. i] -- Copy a reference
ChatlinkTooltips_HookHandler(frame, "OnHyperLinkEnter", ChatlinkTooltips_ShowTip)
ChatlinkTooltips_HookHandler(frame, "OnHyperLinkLeave", ChatlinkTooltips_HideTip)
end