local E, L, V, P, G = unpack(ElvUI);
local mPlugin = "mMediaTag"
local mMT = E:GetModule(mPlugin);
local DT = E:GetModule("DataTexts");
local addon, ns = ...

--Lua functions
local format = format

--Variables
local mText = format("Dock %s", TALENTS_BUTTON)
local mTextName = "mTalent"

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

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

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

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

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

local function OnClick(self)
	mMT:mClick(self, "CheckFrameTalent")
	if mMT:mCheckCombat() then
		ToggleTalentFrame()
	end
end

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