Skip to content
This repository has been archived by the owner on Oct 28, 2019. It is now read-only.

Show diff between lowest price and ours on market page #1231

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
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
10 changes: 7 additions & 3 deletions css/enhancedsteam.css
Original file line number Diff line number Diff line change
Expand Up @@ -1653,12 +1653,16 @@ input[type=checkbox].es_dlc_selection:checked + label {
}
.es_percentage_higher {
color: red;
line-height: 1.25em !important;
margin: 10px 0;
}
.es_percentage_lower {
color: green;
color: yellow;
line-height: 1.25em !important;
margin: 10px 0;
}
.es_percentage_equal {
color: yellow;
color: green;
}
.es_regional_dailydeal {
margin-top: auto;
Expand Down Expand Up @@ -2156,4 +2160,4 @@ input[type=checkbox].es_dlc_selection:checked + label {
line-height: 26px;
margin-top: 12px;
float: left;
}
}
26 changes: 19 additions & 7 deletions enhancedsteam.js
Original file line number Diff line number Diff line change
Expand Up @@ -4822,16 +4822,23 @@ function add_lowest_market_price() {
if (data["success"]) {
node.find(".market_listing_es_lowest").html(data["lowest_price"]);
var my_price = parse_currency($(node).find(".market_listing_price span span:first").text().trim());
var low_price = parse_currency(node.find(".market_listing_es_lowest").text());
var low_price = parse_currency(data["lowest_price"]);

// Ours matches the lowest price
if (my_price.value <= low_price.value) {
// Our price is lower than the lowest price
if (my_price.value < low_price.value) {
node.find(".market_listing_es_lowest").addClass("es_percentage_lower");
node.find(".market_listing_es_lowest").append("<br><span>(+" + formatCurrency(low_price.value - my_price.value) + ")</span>");
}

// Ours matches the lowest price
else if (my_price.value == low_price.value) {
node.find(".market_listing_es_lowest").addClass("es_percentage_equal");
}

// Our price is higher than the lowest price
if (my_price.value > low_price.value) {
else if (my_price.value > low_price.value) {
node.find(".market_listing_es_lowest").addClass("es_percentage_higher");
node.find(".market_listing_es_lowest").append("<br><span>(-" + formatCurrency(my_price.value - low_price.value) + ")</span>");
}
}
});
Expand All @@ -4850,13 +4857,18 @@ function add_lowest_market_price() {
var my_price = parse_currency($(node).find(".market_listing_price span span:first").text().trim());
var low_price = parse_currency(node.find(".market_listing_es_lowest").text());

// Ours matches the lowest price
if (my_price.value <= low_price.value) {
// Our price is lower than the lowest price
if (my_price.value < low_price.value) {
node.find(".market_listing_es_lowest").addClass("es_percentage_lower");
}

// Ours matches the lowest price
else if (my_price.value == low_price.value) {
node.find(".market_listing_es_lowest").addClass("es_percentage_equal");
}

// Our price is higher than the lowest price
if (my_price.value > low_price.value) {
else if (my_price.value > low_price.value) {
node.find(".market_listing_es_lowest").addClass("es_percentage_higher");
}
}
Expand Down