PHP код:
local lines = {}
do
--Create Frames/Objects
local frame = CreateFrame("Frame", "BCMCopyFrame", UIParent)
frame:SetBackdrop({bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = {left = 3, right = 3, top = 5, bottom = 3}})
frame:SetBackdropColor(0,0,0,1)
frame:SetWidth(500)
frame:SetHeight(400)
frame:SetPoint("CENTER", UIParent, "CENTER")
frame:Hide()
frame:SetFrameStrata("DIALOG")
local scrollArea = CreateFrame("ScrollFrame", "BCMCopyScroll", frame, "UIPanelScrollFrameTemplate")
scrollArea:SetPoint("TOPLEFT", frame, "TOPLEFT", 8, -30)
scrollArea:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -30, 8)
local editBox = CreateFrame("EditBox", "BCMCopyBox", frame)
editBox:SetMultiLine(true)
editBox:SetMaxLetters(99999)
editBox:EnableMouse(true)
editBox:SetAutoFocus(false)
editBox:SetFontObject(ChatFontNormal)
editBox:SetWidth(400)
editBox:SetHeight(270)
editBox:SetScript("OnEscapePressed", function(f) f:GetParent():GetParent():Hide() f:SetText("") end)
scrollArea:SetScrollChild(editBox)
local close = CreateFrame("Button", "BCMCloseButton", frame, "UIPanelCloseButton")
close:SetPoint("TOPRIGHT", frame, "TOPRIGHT")
local copyFunc = function(frame, btn)
local cf = _G[format("%s%d", "ChatFrame", frame:GetID())]
local _, size = cf:GetFont()
FCF_SetChatWindowFontSize(cf, cf, 0.01)
local ct = 1
for i = select("#", cf:GetRegions()), 1, -1 do
local region = select(i, cf:GetRegions())
if region:GetObjectType() == "FontString" then
lines[ct] = tostring(region:GetText())
ct = ct + 1
end
end
local lineCt = ct - 1
local text = table.concat(lines, "\n", 1, lineCt)
FCF_SetChatWindowFontSize(cf, cf, size)
BCMCopyFrame:Show()
BCMCopyBox:SetText(text)
BCMCopyBox:HighlightText(0)
wipe(lines)
end
for i = 1, 10 do
local tab = _G[format("%s%d%s", "ChatFrame", i, "Tab")]
tab:SetScript("OnDoubleClick", copyFunc)
tab:SetScript("OnEnter", hintFunc)
end
end