local m = {} Aux.test = m --function m.intervals(frequencies, median) -- local intervals = {} -- for i=1,30 do -- tinsert(intervals, { -- index = i, -- lower = median + 2 ^ (i-1), -- upper = median + 2 ^ i, -- value = 2 ^ i * 1.5, -- frequency = frequencies[i] -- }) -- end --end -- --function m.new_histogram(old_histogram, old_median, new_value) -- -- local new_median -- -- local new_histogram = {} -- for _, interval in ipairs(m.intervals({}, new_median)) do -- for _, old_interval in m.intervals(old_histogram, old_median) do -- local share = m.share(old_interval, interval) -- new_histogram[interval.index] = new_histogram[interval.index] and new_histogram[interval.index] + share or share -- end -- end -- return new_histogram --end -- --function m.new_median(histogram, old_median) -- --end -- --function m.share(old_interval, new_interval) -- local upper = min(old_interval.upper, new_interval.upper) -- local lower = max(old_interval.lower, new_interval.lower) -- if upper < lower then -- return 0 -- else -- return (upper - lower) / (old_interval.upper - old_interval.lower) * old_interval.frequency -- end --end --StaticPopupDialogs["CANCEL_AUCTION"] = { -- text = TEXT(CANCEL_AUCTION_CONFIRMATION), -- button1 = TEXT(ACCEPT), -- button2 = TEXT(CANCEL), -- OnAccept = function() -- CancelAuction(GetSelectedAuctionItem("owner")); -- end, -- OnShow = function() -- MoneyFrame_Update(this:GetName().."MoneyFrame", AuctionFrameAuctions.cancelPrice); -- if ( AuctionFrameAuctions.cancelPrice > 0 ) then -- getglobal(this:GetName().."Text"):SetText(CANCEL_AUCTION_CONFIRMATION_MONEY); -- else -- getglobal(this:GetName().."Text"):SetText(CANCEL_AUCTION_CONFIRMATION); -- end -- -- end, -- hasMoneyFrame = 1, -- showAlert = 1, -- timeout = 0, --}; --StaticPopupDialogs["TSM_SHOPPING_SAVED_EXPORT_POPUP"] = { -- text = L["Press Ctrl-C to copy this saved search."], -- button1 = OKAY, -- OnShow = function(self) -- self.editBox:SetText(private.popupInfo.export) -- self.editBox:HighlightText() -- self.editBox:SetFocus() -- self.editBox:SetScript("OnEscapePressed", function() StaticPopup_Hide("TSM_SHOPPING_SAVED_EXPORT_POPUP") end) -- self.editBox:SetScript("OnEnterPressed", function() self.button1:Click() end) -- end, -- hasEditBox = true, -- timeout = 0, -- hideOnEscape = true, -- preferredIndex = 3, --} --StaticPopupDialogs["TSM_SHOPPING_SAVED_IMPORT_POPUP"] = { -- text = L["Paste the search you'd like to import into the box below."], -- button1 = L["Import"], -- button2 = CANCEL, -- OnShow = function(self) -- self.editBox:SetText("") -- self.editBox:HighlightText() -- self.editBox:SetFocus() -- self.editBox:SetScript("OnEscapePressed", function() StaticPopup_Hide("TSM_SHOPPING_SAVED_IMPORT_POPUP") end) -- self.editBox:SetScript("OnEnterPressed", function() self.button1:Click() end) -- end, -- OnAccept = function(self) -- local text = self.editBox:GetText():trim() -- if text ~= "" then -- local found = false -- -- check if this search already exists -- for i, data in ipairs(TSM.db.global.savedSearches) do -- if data.searchMode == "normal" and strlower(data.filter) == strlower(text) then -- -- update the lastSearch time and return -- data.isFavorite = true -- found = true -- break -- end -- end -- if not found then -- tinsert(TSM.db.global.savedSearches, {searchMode="normal", filter=text, name=text, lastSearch=time(), isFavorite=true}) -- end -- TSM:Printf(L["Added '%s' to your favorite searches."], text) -- private.UpdateSTData() -- end -- end, -- hasEditBox = true, -- timeout = 0, -- hideOnEscape = true, -- preferredIndex = 3, --}