From 5624c972f4bc858884a707a0253266cbe9434650 Mon Sep 17 00:00:00 2001 From: Marvin Dalheimer Date: Mon, 24 Apr 2023 21:31:56 +0200 Subject: [PATCH] Init --- ChatlinkTooltip.lua | 35 +++++++++++++++++++++++++++++++++++ ChatlinkTooltip.toc | 7 +++++++ 2 files changed, 42 insertions(+) create mode 100755 ChatlinkTooltip.lua create mode 100755 ChatlinkTooltip.toc diff --git a/ChatlinkTooltip.lua b/ChatlinkTooltip.lua new file mode 100755 index 0000000..ce62427 --- /dev/null +++ b/ChatlinkTooltip.lua @@ -0,0 +1,35 @@ +local function showTooltip(self, linkData) + local linkType = string.split(":", linkData) + if linkType == "item" + or linkType == "spell" + or linkType == "enchant" + or linkType == "quest" + or linkType == "talent" + or linkType == "glyph" + or linkType == "unit" + or linkType == "achievement" then + GameTooltip:SetOwner(self, "ANCHOR_CURSOR") + GameTooltip:SetHyperlink(linkData) + GameTooltip:Show() + end +end + +local function hideTooltip() + GameTooltip:Hode() +end + +local function setOrHookHandler(frame, script, func) + if frame:GetScript(script) then + frame:HookScript(script, func) + else + frame:SetScript(script, func) + end +end + +for i = 1, NUM_CHAT_WINDOWS do + local frame = getglobal("ChatFrame"..i) + if frame then + setOrHookHandler(frame, "OnHyperlinkEnter", showTooltip) + setOrHookHandler(frame, "OnHyperlinkLeave", hideTooltip) + end +end \ No newline at end of file diff --git a/ChatlinkTooltip.toc b/ChatlinkTooltip.toc new file mode 100755 index 0000000..7a40c52 --- /dev/null +++ b/ChatlinkTooltip.toc @@ -0,0 +1,7 @@ +## Interface: 11403 +## Title: ChatlinkTooltip +## Notes: +## Author: Rinma +## Version: 0.0.1 + +ChatlinkTooltip.lua \ No newline at end of file