local addonName, addonTable = ...
local frame = CreateFrame("Frame")
local L = {
enUS = {
MENU_TITLE = "Hide Objective Button Options",
SHOW_BTN = "Show Graphical Button",
BIND_LABEL = "Toggle Objective Tracker Visibility",
BIND_SECTION = "Hide Objective Button",
HELP_DESC = "This addon allows you to show or hide the default objective tracker cleanly without any script errors.\n\nCommands available:\n- /hob : Opens this settings menu.\n- /hob toggle (or /hob t) : Directly toggles the objective list visibility.\n\nYou can bind a keyboard shortcut to this action in the Options > Keybindings menu, under the category specified by your chosen name.",
},
frFR = {
MENU_TITLE = "Options de Bouton pour masquer les objectifs",
SHOW_BTN = "Afficher le bouton graphique",
BIND_LABEL = "Afficher/Masquer le suivi d'objectifs",
BIND_SECTION = "Masquage du suivi d'objectifs",
HELP_DESC = "Cet addon vous permet de masquer ou d'afficher proprement la liste des objectifs et quêtes par défaut sans générer d'erreurs d'interface.\n\nCommandes disponibles :\n- /hob : Ouvre ce menu d'options.\n- /hob toggle (ou /hob t) : Bascule instantanément la visibilité du suivi d'objectif.\n\nVous pouvez assigner un raccourci clavier direct dans le menu Options > Raccourcis du jeu, sous le nom de catégorie indiqué ci-dessus.",
}
}
local locale = GetLocale()
local text = L[locale] or L["enUS"]
_G["BINDING_HEADER_HIDEOBJECTIVEBUTTON"] = text.BIND_SECTION
_G["BINDING_NAME_CLICK ToggleObjectiveTrackerButton:LeftButton"] = text.BIND_LABEL
local btn = CreateFrame("Frame", "ToggleObjectiveTrackerButton", UIParent, "BackdropTemplate")
btn:SetSize(24, 24)
btn:SetFrameStrata("MEDIUM")
btn:SetBackdrop({
bgFile = "Interface\\Buttons\\WHITE8X8",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 8, edgeSize = 8,
insets = { left = 2, right = 2, top = 2, bottom = 2 }
})
btn:SetBackdropColor(0, 0, 0, 0.7)
btn:SetBackdropBorderColor(0.5, 0.5, 0.5, 0.8)
local icon = btn:CreateTexture(nil, "ARTWORK")
icon:SetTexture("Interface\\QuestFrame\\UI-QuestLog-BookIcon")
icon:SetSize(16, 16)
icon:SetPoint("CENTER", btn, "CENTER", 0, 0)
btn.icon = icon
btn:EnableMouse(true)
local isMoving = false
local startMouseX, startMouseY
local startFrameX, startFrameY
local totalMovedDist = 0
btn:SetScript("OnMouseDown", function(self, button)
if button == "LeftButton" then
isMoving = true
totalMovedDist = 0
local scale = self:GetEffectiveScale()
local mx, my = GetCursorPosition()
startMouseX, startMouseY = mx / scale, my / scale
startFrameX, startFrameY = self:GetLeft(), self:GetBottom()
end
end)
btn:SetScript("OnUpdate", function(self, elapsed)
if isMoving then
local scale = self:GetEffectiveScale()
local mx, my = GetCursorPosition()
local curMouseX, curMouseY = mx / scale, my / scale
local diffX = curMouseX - startMouseX
local diffY = curMouseY - startMouseY
totalMovedDist = totalMovedDist + math.abs(diffX) + math.abs(diffY)
self:ClearAllPoints()
self:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", startFrameX + diffX, startFrameY + diffY)
end
end)
To embed this project on your website, copy the following code and paste it into your website's HTML: