Thread Tools Display Modes
Prev Previous Post   Next Post Next
12-31-14, 08:36 PM   #1
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Hyperlink Tooltip Help

This code has been around for a while and (first found it with NeavUI) but it seems to wrk for most item links except battle pets is there something im missing? Does a battle pet link have it own link style?

In this first image you will notice the mouseover is working. ( I also have fstack enabled to see what the difference in links are)


In this second image I linked a battle pet in the "say" channel and no tooltip. (again fstack is enabled)


Here is the current code I am using:
Code:
		local _G = getfenv(0)
		local orig1, orig2 = {}, {}
		local GameTooltip = GameTooltip

		local linktypes = {
			achievement  = true,
			enchant      = true,
			glyph        = true,
			item         = true,
			instancelock = true,
			quest        = true,
			spell        = true,
			talent       = true,
			unit         = true,
		}

		local function OnHyperlinkEnter(frame, link, ...)
			local linktype = link:match('^([^:]+)')
			if (linktype and linktypes[linktype]) then
				GameTooltip:SetOwner(ChatFrame1, 'ANCHOR_CURSOR', 0, 20)
				GameTooltip:SetHyperlink(link)
				GameTooltip:Show()
			else
				GameTooltip:Hide()
			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 function EnableItemLinkTooltip()
			for _, v in pairs(CHAT_FRAMES) do
				local chat = _G[v]
				if (chat and not chat.URLCopy) then
					orig1[chat] = chat:GetScript('OnHyperlinkEnter')
					chat:SetScript('OnHyperlinkEnter', OnHyperlinkEnter)

					orig2[chat] = chat:GetScript('OnHyperlinkLeave')
					chat:SetScript('OnHyperlinkLeave', OnHyperlinkLeave)
					chat.URLCopy = true
				end
			end
		end
		hooksecurefunc('FCF_OpenTemporaryWindow', EnableItemLinkTooltip)
		EnableItemLinkTooltip()
I noticed in the code that linktypes does not have battlepet or any reference to pets so im thinking that might be my issue but what name would I use to get this to work?

Thanks
Coke
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Hyperlink Tooltip Help


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off