huge filter tab improvements
This commit is contained in:
+15
-7
@@ -1,9 +1,10 @@
|
||||
local m, public, private = aux.module'util'
|
||||
|
||||
function public.pack(table, ...)
|
||||
local array = {}
|
||||
for i=1,arg.n do
|
||||
tinsert(array, table[arg[i]])
|
||||
function public.either(p, a, b)
|
||||
if p then
|
||||
return a
|
||||
else
|
||||
return b
|
||||
end
|
||||
end
|
||||
|
||||
@@ -115,6 +116,14 @@ function public.all(xs, p)
|
||||
return holds
|
||||
end
|
||||
|
||||
function public.replicate(count, value)
|
||||
local array = {}
|
||||
for i=1,count do
|
||||
tinsert(array, value)
|
||||
end
|
||||
return unpack(array)
|
||||
end
|
||||
|
||||
function public.filter(xs, p)
|
||||
local ys = {}
|
||||
for k, x in xs do
|
||||
@@ -166,7 +175,6 @@ function public.split(str, separator)
|
||||
local parts = {}
|
||||
while true do
|
||||
local start_index, _ = strfind(str, separator, 1, true)
|
||||
|
||||
if start_index then
|
||||
local part = strsub(str, 1, start_index - 1)
|
||||
tinsert(parts, part)
|
||||
@@ -218,8 +226,8 @@ function public.bag_type(bag)
|
||||
if bag == 0 then
|
||||
return 1
|
||||
end
|
||||
if GetInventoryItemLink('player', ContainerIDToInventoryID(bag)) then
|
||||
local item_id = aux.info.parse_hyperlink(GetInventoryItemLink('player', ContainerIDToInventoryID(bag)))
|
||||
for _, link in {GetInventoryItemLink('player', ContainerIDToInventoryID(bag))} do
|
||||
local item_id = aux.info.parse_hyperlink(link)
|
||||
local item_info = aux.info.item(item_id)
|
||||
return aux.info.item_subclass_index(3, item_info.subclass)
|
||||
end
|
||||
|
||||
+4
-46
@@ -531,48 +531,6 @@ function public.query_string(components)
|
||||
return prettified.get()
|
||||
end
|
||||
|
||||
function private.data_link(id, str)
|
||||
return '|H'..id..'|h'..str..'|h'
|
||||
end
|
||||
|
||||
function public.indented_post_query_string(components)
|
||||
local no_line_break
|
||||
local stack = {}
|
||||
local str = ''
|
||||
|
||||
for i, component in components do
|
||||
if no_line_break then
|
||||
str = str..' '
|
||||
elseif i > 1 then
|
||||
str = str..'</p><p>'
|
||||
for _=1,getn(stack) do
|
||||
str = str..aux.gui.inline_color.content.backdrop..'----'..FONT_COLOR_CODE_CLOSE
|
||||
end
|
||||
end
|
||||
no_line_break = component[1] == 'operator' and component[2] == 'not'
|
||||
local component_text
|
||||
if component[1] == 'operator' then
|
||||
component_text = aux.auction_listing.COLORS.YELLOW..component[2]..(component[2] ~= 'not' and tonumber(component[3]) or '')..FONT_COLOR_CODE_CLOSE
|
||||
tinsert(stack, component[3])
|
||||
elseif component[1] == 'filter' then
|
||||
component_text = aux.auction_listing.COLORS.YELLOW..component[2]..FONT_COLOR_CODE_CLOSE
|
||||
if component[3] then
|
||||
str = str..': '..aux.auction_listing.COLORS.ORANGE..component[3]..FONT_COLOR_CODE_CLOSE
|
||||
end
|
||||
while getn(stack) > 0 and stack[getn(stack)] do
|
||||
local top = tremove(stack)
|
||||
if tonumber(top) and top > 1 then
|
||||
tinsert(stack, top - 1)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
str = str..m.data_link(i, component_text)
|
||||
end
|
||||
|
||||
return '<html><body><p>'..str..'</p></body></html>'
|
||||
end
|
||||
|
||||
function private.prettified_query_string(components)
|
||||
local prettified = m.query_builder()
|
||||
|
||||
@@ -588,7 +546,7 @@ function private.prettified_query_string(components)
|
||||
|
||||
if blizzard_filters.name and not blizzard_filters.exact then
|
||||
if m.unquote(blizzard_filters.name) == '' then
|
||||
prettified.prepend(aux.auction_listing.COLORS.RED..'No Filter'..FONT_COLOR_CODE_CLOSE)
|
||||
prettified.prepend(aux.auction_listing.colors.RED..'No Filter'..FONT_COLOR_CODE_CLOSE)
|
||||
else
|
||||
prettified.prepend(aux.gui.inline_color.label.enabled..m.unquote(blizzard_filters.name)..FONT_COLOR_CODE_CLOSE)
|
||||
end
|
||||
@@ -596,13 +554,13 @@ function private.prettified_query_string(components)
|
||||
|
||||
for _, component in components.post do
|
||||
if component[1] == 'operator' then
|
||||
prettified.append(aux.auction_listing.COLORS.YELLOW..component[2]..(component[2] ~= 'not' and tonumber(component[3]) or '')..FONT_COLOR_CODE_CLOSE)
|
||||
prettified.append(aux.auction_listing.colors.YELLOW..component[2]..(component[2] ~= 'not' and tonumber(component[3]) or '')..FONT_COLOR_CODE_CLOSE)
|
||||
elseif component[1] == 'filter' then
|
||||
if component[2] ~= 'tooltip' then
|
||||
prettified.append(aux.auction_listing.COLORS.YELLOW..component[2]..FONT_COLOR_CODE_CLOSE)
|
||||
prettified.append(aux.auction_listing.colors.YELLOW..component[2]..FONT_COLOR_CODE_CLOSE)
|
||||
end
|
||||
if component[3] then
|
||||
prettified.append(aux.auction_listing.COLORS.ORANGE..component[3]..FONT_COLOR_CODE_CLOSE)
|
||||
prettified.append(aux.auction_listing.colors.ORANGE..component[3]..FONT_COLOR_CODE_CLOSE)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user