Weblink #1 - add urlencode function

mainly because ruRU gets hyeroglyphs link in output and it never searched right.

also make it remove color tags correctly with new urlencode ouput.
This commit is contained in:
Sattva
2023-12-30 01:40:04 +03:00
parent 3dc5ea312d
commit 14ead343a0
2 changed files with 15 additions and 2 deletions
+2
View File
@@ -12,6 +12,8 @@ Tooltip - FIX center popup when closed the leatrix window, its still staying
WebLink - Fix ruRU encoding!!!
WebLink - WASD should close the weblink window.
FlightTimers - fix report window editbox
Manage Quest Tracker (under minimap) - let user move it.
+13 -2
View File
@@ -15958,6 +15958,17 @@
end
return
elseif str == "id" then
--------------------------------------------------------------------------------
-- Define urlencode function for Lua 5.3
--------------------------------------------------------------------------------
local function urlencode(str)
return string.gsub(str, "([^%w%.%- ])", function(c)
return string.format("%%%02X", string.byte(c))
end):gsub(" ", "+")
end
-- Show web link
if not LeaPlusLC.WowheadLock then
-- Set Wowhead link prefix
@@ -16072,8 +16083,8 @@
local unitFocus
if mouseFocus == WorldFrame then unitFocus = "mouseover" else unitFocus = select(2, GameTooltip:GetUnit()) end
if not unitFocus or not UnitIsPlayer(unitFocus) then
tipTitle = tipTitle:gsub("|c%x%x%x%x%x%x%x%x", "") -- Remove color tag
LeaPlusLC:ShowSystemEditBox("https://" .. LeaPlusLC.WowheadLock .. "/search?q=" .. tipTitle, false)
tipTitle = tipTitle:gsub("|c%x%x%x%x%x%x%x%x", ""):gsub("|r", "")
LeaPlusLC:ShowSystemEditBox("https://" .. LeaPlusLC.WowheadLock .. "/search?q=" .. urlencode(tipTitle), false)
LeaPlusLC.FactoryEditBox.f:SetText("|cffff0000" .. L["Link will search Wowhead"])
return
end