Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent corrupted page sizes for market listings #213

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions code.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2915,6 +2915,12 @@
$('.market_listing_table_header', market_listing_see.parent())
.append('<input class="search" id="market_name_search" placeholder="Search..." />');

let pageSize = parseInt(getSettingWithDefault(SETTING_MARKET_PAGE_COUNT), 10);

if (isNaN(pageSize) || pageSize < 1) {
pageSize = settingDefaults[SETTING_MARKET_PAGE_COUNT];
}

var options = {
valueNames: [
'market_listing_game_name', 'market_listing_item_name_link', 'market_listing_price',
Expand All @@ -2938,7 +2944,7 @@
left: 100,
right: 100
}],
page: parseInt(getSettingWithDefault(SETTING_MARKET_PAGE_COUNT))
page: pageSize,
};

var list = new List(market_listing_see.parent().attr('id'), options);
Expand Down Expand Up @@ -3576,7 +3582,7 @@
'<br/>' +
'</div>' +
'<div style="margin-bottom:6px;">' +
'Hours to use for the average history calculated price:&nbsp;<input class="price_option_input" style="background-color: black;color: white;border: transparent;" type="number" step="2" id="' + SETTING_PRICE_HISTORY_HOURS + '" value=' + getSettingWithDefault(SETTING_PRICE_HISTORY_HOURS) + '>' +
'Hours to use for the average history calculated price:&nbsp;<input class="price_option_input" style="background-color: black;color: white;border: transparent;" type="number" min="0" step="2" id="' + SETTING_PRICE_HISTORY_HOURS + '" value=' + getSettingWithDefault(SETTING_PRICE_HISTORY_HOURS) + '>' +
'</div>' +
'<div style="margin-bottom:6px;">' +
'The value to add to the calculated price (minimum and maximum are respected):&nbsp;<input class="price_option_input price_option_price" style="background-color: black;color: white;border: transparent;" type="number" step="0.01" id="' + SETTING_PRICE_OFFSET + '" value=' + getSettingWithDefault(SETTING_PRICE_OFFSET) + '>' +
Expand Down Expand Up @@ -3616,7 +3622,7 @@
'<br/>' +
'</div>' +
'<div style="margin-top:24px;margin-bottom:6px;">' +
'Market items per page:&nbsp;<input class="price_option_input price_option_price" style="background-color: black;color: white;border: transparent;" type="number" step="0.01" id="' + SETTING_MARKET_PAGE_COUNT + '" value=' + getSettingWithDefault(SETTING_MARKET_PAGE_COUNT) + '>' +
'Market items per page:&nbsp;<input class="price_option_input price_option_price" style="background-color: black;color: white;border: transparent;" type="number" min="1" step="5" id="' + SETTING_MARKET_PAGE_COUNT + '" value=' + getSettingWithDefault(SETTING_MARKET_PAGE_COUNT) + '>' +
'<br/>' +
'<div style="margin-top:6px;">' +
'Automatically relist overpriced market listings (slow on large inventories):&nbsp;<input id="' + SETTING_RELIST_AUTOMATICALLY + '" class="market_relist_auto" type="checkbox" ' + (getSettingWithDefault(SETTING_RELIST_AUTOMATICALLY) == 1 ? 'checked=""' : '') + '>' +
Expand Down