View Single Post
01-01-15, 09:56 AM   #3
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Originally Posted by Phanx View Post
Code:
chat:HookScript('OnHyperlinkEnter', ChatFrame_OnHyperlinkShow)
The above code works when I add it to my "local function ModChat(self)" but the whole point of the "mouseover tooltip is to have it show and hide with mouseover, this shows the tooltip but then you need to click the x to close it.

Originally Posted by Phanx View Post
If you wanted to filter out certain types of links, and/or not have it treat "mouseover while shift is down" as a shift-click, then this would still be simpler:

Code:
local linktypes = {
	-- These use GameTooltip:
	achievement    = true,
	enchant        = true,
	glyph          = true,
	item           = true,
	instancelock   = true,
	quest          = true,
	spell          = true,
	talent         = true,
	unit           = true,
	-- This uses FloatingBattlePetTooltip:
	battlepet      = true,
	-- This uses FloatingPetBattleAbilityTooltip:
	battlePetAbil = true,
	-- This uses FloatingGarrisonFollowerTooltip:
	garrfollower  = true,
	-- This uses FloatingGarrisonFollowerAbilityTooltip:
	garrfollowerability = true,
	-- This uses FloatingGarrisonMissionTooltip:
	garrmission   = true,
}

local function OnHyperlinkEnter(frame, link, text)
	local linkType = strsplit(":", link)
	if linktypes[linktype] and not IsModifiedClick() then
		ChatFrame_OnHyperlinkShow(frame, link, text, "LeftButton")
	end
end

chat:HookScript('OnHyperlinkEnter', OnHyperlinkEnter)
Tried this also and nothing happened no tooltip show or anything.

Originally Posted by Phanx View Post
Remember to update your OnHyperlinkLeave script to also hide those additional tooltip objects.
Again tried this and got nothing.

So this is what I tried and didn't get to work:

Code:
                local _G = getfenv(0)
		local orig1, orig2 = {}, {}

		local linktypes = {
			-- These use GameTooltip:
			achievement    = true,
			enchant        = true,
			glyph          = true,
			item           = true,
			instancelock   = true,
			quest          = true,
			spell          = true,
			talent         = true,
			unit           = true,
			-- This uses FloatingBattlePetTooltip:
			battlepet      = true,
			-- This uses FloatingPetBattleAbilityTooltip:
			battlePetAbil = true,
			-- This uses FloatingGarrisonFollowerTooltip:
			garrfollower  = true,
			-- This uses FloatingGarrisonFollowerAbilityTooltip:
			garrfollowerability = true,
			-- This uses FloatingGarrisonMissionTooltip:
			garrmission   = true,
		}

		local function OnHyperlinkEnter(frame, link, ...)
			
			for _, tooltip in pairs({	
				'GameTooltip',
				'FloatingBattlePetTooltip',
				'FloatingPetBattleAbilityTooltip',
				'FloatingGarrisonFollowerTooltip',
				'FloatingGarrisonFollowerAbilityTooltip',
				'FloatingGarrisonMissionTooltip',			
			}) do
			        local linktype = link:match('^([^:]+)')
			        if (linktype and linktypes[linktype]) then				
					tooltip:SetOwner(ChatFrame1, 'ANCHOR_CURSOR', 0, 20)
					tooltip:SetHyperlink(link)
					tooltip:Show()				
				else
					tooltip:Hide()
				end
			end

			if (orig1[frame]) then 
				return orig1[frame](frame, link, ...) 
			end
		end

		local function OnHyperlinkLeave(frame, ...)
			for _, tooltip in pairs({		
				'GameTooltip',
				'FloatingBattlePetTooltip',
				'FloatingPetBattleAbilityTooltip',
				'FloatingGarrisonFollowerTooltip',
				'FloatingGarrisonFollowerAbilityTooltip',
				'FloatingGarrisonMissionTooltip',			
			}) do
				tooltip:Hide()
			end
			
			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) then
					orig1[chat] = chat:GetScript('OnHyperlinkEnter')
					chat:HookScript('OnHyperlinkEnter', OnHyperlinkEnter)

					orig2[chat] = chat:GetScript('OnHyperlinkLeave')
					chat:HookScript('OnHyperlinkLeave', OnHyperlinkLeave)
				end
			end
		end
		hooksecurefunc('FCF_OpenTemporaryWindow', EnableItemLinkTooltip)
		EnableItemLinkTooltip()
Am I looking at this totally wrong?

Coke
  Reply With Quote