local E, L, V, P, G = unpack(ElvUI);
local mPlugin = "mMediaTag"
local mMT = E:GetModule(mPlugin);
local DT = E:GetModule("DataTexts");
local addon, ns = ...
local mText = format("Dock %s", DUNGEONS_BUTTON)
local mTextName = "mLFDTool"

local function mDockCheckFrame()
	return ( PVEFrame and PVEFrame:IsShown() )
end

function mMT:CheckFrameLFDTool(self)
	mMT:DockTimerCheck(self, mDockCheckFrame())
end

local function OnEnter(self)
	mMT:mOnEnter(self, DUNGEONS_BUTTON)
end

local function OnEvent(self, event, ...)
	mMT:mOnEvent(self, nil, nil, nil, mDockCheckFrame(), E.db[mPlugin].mDock.textures.lfd.path, "CheckFrameLFDTool")
end

local function OnLeave(self)
	mMT:mOnLeave(self, mDockCheckFrame())
end

local function OnClick(self)
	mMT:mClick(self, "CheckFrameLFDTool")
	if not mMT:mCheckCombat() then
		ToggleLFDParentFrame()
	end
end

DT:RegisterDatatext(mTextName, nil, nil, OnEvent, nil, OnClick, OnEnter, OnLeave, mText, nil)