local ADDON_NAME = "GridStatusHealingReduced"
local ADDON_URL = "http://www.wowinterface.com/downloads/info7364-GridStatusHealingReduced.html"

local editbox = CreateFrame("EditBox", nil, UIParent)
editbox:Hide()
editbox:SetAutoFocus(true)
editbox:SetHeight(32)
editbox:SetFontObject("GameFontNormal")

local left = editbox:CreateTexture(nil, "BACKGROUND")
left:SetWidth(8) left:SetHeight(20)
left:SetPoint("LEFT", -5, 0)
left:SetTexture("Interface\\Common\\Common-Input-Border")
left:SetTexCoord(0, 0.0625, 0, 0.625)

local right = editbox:CreateTexture(nil, "BACKGROUND")
right:SetWidth(8) right:SetHeight(20)
right:SetPoint("RIGHT", 0, 0)
right:SetTexture("Interface\\Common\\Common-Input-Border")
right:SetTexCoord(0.9375, 1, 0, 0.625)

local center = editbox:CreateTexture(nil, "BACKGROUND")
center:SetHeight(20)
center:SetPoint("RIGHT", right, "LEFT", 0, 0)
center:SetPoint("LEFT", left, "RIGHT", 0, 0)
center:SetTexture("Interface\\Common\\Common-Input-Border")
center:SetTexCoord(0.0625, 0.9375, 0, 0.625)

editbox:SetScript("OnEscapePressed", editbox.ClearFocus)
editbox:SetScript("OnEnterPressed", editbox.ClearFocus)
editbox:SetScript("OnEditFocusLost", editbox.Hide)
editbox:SetScript("OnEditFocusGained", editbox.HighlightText)
editbox:SetScript("OnTextChanged", function(self)
	self:SetText(self:GetParent().val)
	self:HighlightText()
end)

local function OpenEditbox(self)
	editbox:SetText(self.val)
	editbox:SetParent(self)
	editbox:SetPoint("LEFT", self)
	editbox:SetPoint("RIGHT", self)
	editbox:Show()
end

local f = CreateFrame("Frame", nil, UIParent)
f:SetPoint("BOTTOM", UIParent, "CENTER")
f:SetWidth(600) f:SetHeight(300)
f:EnableMouse(true)
f:SetBackdrop({
	bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16,
	edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 16,
	insets = { left = 4, right = 4, top = 4, bottom = 4 }
})
f:SetBackdropColor(0, 0, 0, 1)

local h = f:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
h:SetPoint("TOP", 0, -16)
h:SetTextColor(1, 0.8, 0)
h:SetText("Attention!")

local t1 = f:CreateFontString(nil, "OVERLAY", "GameFontNormal")
t1:SetPoint("TOP", h, "BOTTOM", 0, -8)
t1:SetWidth(f:GetWidth() - 32)
t1:SetJustifyH("LEFT")
t1:SetTextColor(1, 1, 1)
t1:SetText(ADDON_NAME.." will no longer be updated on WowAce!\n\nIt will continue to be available on WoWInterface and Curse, and may reappear on WowAce after the \"big changes\", depending on what the new site has to offer me as an addon author. If you don't know about the upcoming changes, you should read this:")

local u1 = f:CreateFontString(nil, "OVERLAY", "GameFontNormal")
u1:SetPoint("TOP", t1, "BOTTOM")
u1:SetWidth(f:GetWidth() - 32)
u1:SetJustifyH("LEFT")
u1:SetText("|cff9999ffhttp://www.wowace.com/forums/index.php?topic=14316.0|r")

local ub1 = CreateFrame("Button", nil, f)
ub1:SetAllPoints(u1)
ub1.val = "http://www.wowace.com/forums/index.php?topic=14316.0"
ub1:SetScript("OnClick", OpenEditbox)

local t2 = f:CreateFontString(nil, "OVERLAY", "GameFontNormal")
t2:SetPoint("TOP", u1, "BOTTOM", 0, -16)
t2:SetWidth(f:GetWidth() - 32)
t2:SetJustifyH("LEFT")
t2:SetTextColor(1, 1, 1)
t2:SetText("WoWInterface download page for "..ADDON_NAME..":")

local u2 = f:CreateFontString(nil, "OVERLAY", "GameFontNormal")
u2:SetPoint("TOP", t2, "BOTTOM")
u2:SetWidth(f:GetWidth() - 32)
u2:SetJustifyH("LEFT")
u2:SetText("|cff9999ff"..ADDON_URL.."|r")

local ub2 = CreateFrame("Button", nil, f)
ub2:SetAllPoints(u2)
ub2.val = ADDON_URL
ub2:SetScript("OnClick", OpenEditbox)

local t3 = f:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
t3:SetPoint("TOP", u2, "BOTTOM", 0, -16)
t3:SetWidth(f:GetWidth() - 32)
t3:SetJustifyH("LEFT")
t3:SetTextColor(0.8, 0.8, 0.8)
t3:SetText("Hint: Click a URL to highlight it, then copy and paste into your browser.")

local b = CreateFrame("Button", nil, f)
b:SetPoint("TOP", t3, "BOTTOM", 0, -16)
b:SetWidth(150) b:SetHeight(30)
b:SetTextFontObject(GameFontNormal)
b:SetHighlightFontObject(GameFontHighlight)
b:SetNormalTexture("Interface\\Buttons\\UI-Panel-Button-Up")
b:GetNormalTexture():SetTexCoord(0, 0.625, 0, 0.6875)
b:SetPushedTexture("Interface\\Buttons\\UI-Panel-Button-Down")
b:GetPushedTexture():SetTexCoord(0, 0.625, 0, 0.6875)
b:SetHighlightTexture("Interface\\Buttons\\UI-Panel-Button-Highlight")
b:GetHighlightTexture():SetTexCoord(0, 0.625, 0, 0.6875)
b:GetHighlightTexture():SetBlendMode("ADD")
b:SetScript("OnClick", function() f:Hide() end)
b:SetText("Okay!")