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", COLLECTIONS)
local mTextName = "mCollectionsJourna"

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

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

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

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

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

local function OnClick(self)
	mMT:mClick(self, "CheckFrameCollectionsJourna")
	if mMT:mCheckCombat() then
		ToggleCollectionsJournal()
	end
end

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