refactoring
This commit is contained in:
+1
-1
@@ -216,7 +216,7 @@ function create_frames()
|
||||
local frame = CreateFrame('Frame', nil, frame.parameters)
|
||||
start_price_frame = frame
|
||||
gui.set_content_style(frame)
|
||||
frame:SetPoint('TOPRIGHT', _m.frame.parameters, 'TOPRIGHT', -71, -60)
|
||||
frame:SetPoint('TOPRIGHT', M.frame.parameters, 'TOPRIGHT', -71, -60)
|
||||
frame:SetWidth(180)
|
||||
frame:SetHeight(22)
|
||||
local editbox = gui.editbox(frame)
|
||||
|
||||
@@ -19,7 +19,7 @@ StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
|
||||
}
|
||||
do
|
||||
local function action()
|
||||
_g.aux_auto_buy_filter = _g[this:GetParent():GetName()..'EditBox']:GetText()
|
||||
_G.aux_auto_buy_filter = _G[this:GetParent():GetName()..'EditBox']:GetText()
|
||||
update_auto_buy_filter()
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ do
|
||||
button2 = 'Cancel',
|
||||
hasEditBox = 1,
|
||||
OnShow = function()
|
||||
local edit_box = _g[this:GetName()..'EditBox']
|
||||
local edit_box = _G[this:GetName()..'EditBox']
|
||||
edit_box:SetMaxLetters(nil)
|
||||
edit_box:SetFocus()
|
||||
edit_box:HighlightText()
|
||||
|
||||
@@ -73,7 +73,7 @@ function update_form()
|
||||
|
||||
if blizzard_query.exact then
|
||||
for key in -temp-set('class', 'subclass', 'slot', 'quality') do
|
||||
_m[key..'_dropdown'].button:Disable()
|
||||
M[key..'_dropdown'].button:Disable()
|
||||
end
|
||||
else
|
||||
class_dropdown.button:Enable()
|
||||
@@ -81,9 +81,9 @@ function update_form()
|
||||
end
|
||||
for key in -temp-set('min_level', 'max_level') do
|
||||
if blizzard_query.exact then
|
||||
_m[key..'_input']:Disable()
|
||||
M[key..'_input']:Disable()
|
||||
else
|
||||
_m[key..'_input']:Enable()
|
||||
M[key..'_input']:Enable()
|
||||
end
|
||||
end
|
||||
if blizzard_query.exact then
|
||||
@@ -125,13 +125,13 @@ function get_filter_builder_query()
|
||||
for subclass in present(blizzard_query.subclass) do
|
||||
local subclasses = temp-{GetAuctionItemSubClasses(class)}
|
||||
add(strlower(subclasses[subclass]))
|
||||
add(blizzard_query.slot and strlower(_g[blizzard_query.slot]))
|
||||
add(blizzard_query.slot and strlower(_G[blizzard_query.slot]))
|
||||
end
|
||||
end
|
||||
|
||||
local quality = blizzard_query.quality
|
||||
if quality and quality >= 0 then
|
||||
add(strlower(_g['ITEM_QUALITY'..quality..'_DESC']))
|
||||
add(strlower(_G['ITEM_QUALITY'..quality..'_DESC']))
|
||||
end
|
||||
|
||||
local post_filter_string = filter_util.query_string(-temp-object('blizzard', tt, 'post', post_filter))
|
||||
@@ -377,7 +377,7 @@ function initialize_slot_dropdown()
|
||||
if subclass_index and GetAuctionInvTypes(class_index, subclass_index) then
|
||||
UIDropDownMenu_AddButton(-object('text', ALL, 'value', '', 'func', on_click))
|
||||
for _, slot in {GetAuctionInvTypes(class_index, subclass_index)} do
|
||||
UIDropDownMenu_AddButton(-object('text', _g[slot], 'value', slot, 'func', on_click))
|
||||
UIDropDownMenu_AddButton(-object('text', _G[slot], 'value', slot, 'func', on_click))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -389,6 +389,6 @@ function initialize_quality_dropdown()
|
||||
end
|
||||
UIDropDownMenu_AddButton(-object('text', ALL, 'value', -1, 'func', on_click))
|
||||
for i=0,4 do
|
||||
UIDropDownMenu_AddButton(-object('text', _g['ITEM_QUALITY'..i..'_DESC'], 'value', i, 'func', on_click))
|
||||
UIDropDownMenu_AddButton(-object('text', _G['ITEM_QUALITY'..i..'_DESC'], 'value', i, 'func', on_click))
|
||||
end
|
||||
end
|
||||
|
||||
+15
-15
@@ -118,9 +118,9 @@ function create_frames()
|
||||
btn:SetText('Real Time Mode')
|
||||
btn:SetScript('OnClick', function()
|
||||
this:SetChecked(not this:GetChecked())
|
||||
_g.this = first_page_input
|
||||
_G.this = first_page_input
|
||||
first_page_input:GetScript('OnTextChanged')()
|
||||
_g.this = last_page_input
|
||||
_G.this = last_page_input
|
||||
last_page_input:GetScript('OnTextChanged')()
|
||||
end)
|
||||
public.real_time_button = btn
|
||||
@@ -149,7 +149,7 @@ function create_frames()
|
||||
btn:SetScript('OnClick', function()
|
||||
if this:GetChecked() then
|
||||
this:SetChecked(false)
|
||||
_g.aux_auto_buy_filter = nil
|
||||
_G.aux_auto_buy_filter = nil
|
||||
this.prettified = nil
|
||||
auto_buy_validator = nil
|
||||
else
|
||||
@@ -313,7 +313,7 @@ function create_frames()
|
||||
btn:SetScript('OnClick', function()
|
||||
local filters = filter_util.queries(search_box:GetText())
|
||||
if filters then
|
||||
tinsert(_g.aux_favorite_searches, 1, {
|
||||
tinsert(_G.aux_favorite_searches, 1, {
|
||||
filter_string = search_box:GetText(),
|
||||
prettified = join(map(filters, function(filter) return filter.prettified end), ';'),
|
||||
})
|
||||
@@ -345,7 +345,7 @@ function create_frames()
|
||||
end
|
||||
do
|
||||
local editbox = gui.editbox(frame.filter)
|
||||
editbox.complete_item = completion.complete(function() return _g.aux_auctionable_items end)
|
||||
editbox.complete_item = completion.complete(function() return _G.aux_auctionable_items end)
|
||||
editbox:SetPoint('TOPLEFT', 14, -FILTER_SPACING)
|
||||
editbox:SetWidth(260)
|
||||
editbox.char = function()
|
||||
@@ -499,7 +499,7 @@ function create_frames()
|
||||
dropdown:SetScript('OnShow', function()
|
||||
UIDropDownMenu_Initialize(this, initialize_filter_dropdown)
|
||||
end)
|
||||
_g[dropdown:GetName()..'Text']:Hide()
|
||||
_G[dropdown:GetName()..'Text']:Hide()
|
||||
local label = gui.label(dropdown, gui.font_size.medium)
|
||||
label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0)
|
||||
label:SetText('Post Filter')
|
||||
@@ -623,16 +623,16 @@ function create_frames()
|
||||
add_filter(data.search.filter_string)
|
||||
elseif button == 'LeftButton' and IsControlKeyDown() then
|
||||
if st == favorite_searches_listing and data.index > 1 then
|
||||
local temp = _g.aux_favorite_searches[data.index - 1]
|
||||
_g.aux_favorite_searches[data.index - 1] = data.search
|
||||
_g.aux_favorite_searches[data.index] = temp
|
||||
local temp = _G.aux_favorite_searches[data.index - 1]
|
||||
_G.aux_favorite_searches[data.index - 1] = data.search
|
||||
_G.aux_favorite_searches[data.index] = temp
|
||||
update_search_listings()
|
||||
end
|
||||
elseif button == 'RightButton' and IsControlKeyDown() then
|
||||
if st == favorite_searches_listing and data.index < getn(_g.aux_favorite_searches) then
|
||||
local temp = _g.aux_favorite_searches[data.index + 1]
|
||||
_g.aux_favorite_searches[data.index + 1] = data.search
|
||||
_g.aux_favorite_searches[data.index] = temp
|
||||
if st == favorite_searches_listing and data.index < getn(_G.aux_favorite_searches) then
|
||||
local temp = _G.aux_favorite_searches[data.index + 1]
|
||||
_G.aux_favorite_searches[data.index + 1] = data.search
|
||||
_G.aux_favorite_searches[data.index] = temp
|
||||
update_search_listings()
|
||||
end
|
||||
elseif button == 'LeftButton' then
|
||||
@@ -640,9 +640,9 @@ function create_frames()
|
||||
execute()
|
||||
elseif button == 'RightButton' then
|
||||
if st == recent_searches_listing then
|
||||
tinsert(_g.aux_favorite_searches, 1, data.search)
|
||||
tinsert(_G.aux_favorite_searches, 1, data.search)
|
||||
elseif st == favorite_searches_listing then
|
||||
tremove(_g.aux_favorite_searches, data.index)
|
||||
tremove(_G.aux_favorite_searches, data.index)
|
||||
end
|
||||
update_search_listings()
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module 'search_tab' import 'info'
|
||||
|
||||
_g.aux_auto_buy_filter = ''
|
||||
_G.aux_auto_buy_filter = ''
|
||||
|
||||
mutable.search_scan_id = 0
|
||||
mutable.auto_buy_validator = nil
|
||||
@@ -109,8 +109,8 @@ function update_start_stop()
|
||||
end
|
||||
|
||||
function update_auto_buy_filter()
|
||||
if _g.aux_auto_buy_filter ~= '' then
|
||||
local queries = filter_util.queries(_g.aux_auto_buy_filter)
|
||||
if _G.aux_auto_buy_filter ~= '' then
|
||||
local queries = filter_util.queries(_G.aux_auto_buy_filter)
|
||||
if queries then
|
||||
if getn(queries) > 1 then
|
||||
log 'Error: The automatic buyout filter does not support multi-queries'
|
||||
@@ -124,7 +124,7 @@ function update_auto_buy_filter()
|
||||
end
|
||||
end
|
||||
end
|
||||
_g.aux_auto_buy_filter = ''
|
||||
_G.aux_auto_buy_filter = ''
|
||||
end
|
||||
|
||||
function start_real_time_scan(query, search, continuation)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
module 'search_tab'
|
||||
|
||||
_g.aux_favorite_searches = {}
|
||||
_g.aux_recent_searches = {}
|
||||
_G.aux_favorite_searches = {}
|
||||
_G.aux_recent_searches = {}
|
||||
|
||||
function update_search_listings()
|
||||
local favorite_search_rows = {}
|
||||
for i, favorite_search in _g.aux_favorite_searches do
|
||||
for i, favorite_search in _G.aux_favorite_searches do
|
||||
local name = strsub(favorite_search.prettified, 1, 250)
|
||||
tinsert(favorite_search_rows, {
|
||||
cols = {{value=name}},
|
||||
@@ -16,7 +16,7 @@ function update_search_listings()
|
||||
favorite_searches_listing:SetData(favorite_search_rows)
|
||||
|
||||
local recent_search_rows = {}
|
||||
for i, recent_search in _g.aux_recent_searches do
|
||||
for i, recent_search in _G.aux_recent_searches do
|
||||
local name = strsub(recent_search.prettified, 1, 250)
|
||||
tinsert(recent_search_rows, {
|
||||
cols = {{value=name}},
|
||||
@@ -28,12 +28,12 @@ function update_search_listings()
|
||||
end
|
||||
|
||||
function new_recent_search(filter_string, prettified)
|
||||
tinsert(_g.aux_recent_searches, 1, {
|
||||
tinsert(_G.aux_recent_searches, 1, {
|
||||
filter_string = filter_string,
|
||||
prettified = prettified,
|
||||
})
|
||||
while getn(_g.aux_recent_searches) > 50 do
|
||||
tremove(_g.aux_recent_searches)
|
||||
while getn(_G.aux_recent_searches) > 50 do
|
||||
tremove(_G.aux_recent_searches)
|
||||
end
|
||||
update_search_listings()
|
||||
end
|
||||
Reference in New Issue
Block a user