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

Commit

Permalink
REMOVE: total spent feature
Browse files Browse the repository at this point in the history
Valve now has a support page that captures this information.  They're
always taking our good stuff.
  • Loading branch information
jshackles committed Jun 20, 2018
1 parent 8ac852e commit 25f4b1f
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 108 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
-----
: Fixed a bug that caused custom wallet amounts not to process correctly
: Fixed numerous broken images that were the result of being served from domains with invalid SSL
- Removed Enhanced Steam's "Account Total" feature replaced by a link to Valve's official stats


v9.8.1
Expand Down
105 changes: 1 addition & 104 deletions enhancedsteam.js
Original file line number Diff line number Diff line change
Expand Up @@ -4466,110 +4466,7 @@ function add_badge_page_link() {

// Add a "Total spent on Steam" to the account details page
function account_total_spent() {
storage.get(function(settings) {
if (settings.showtotal === undefined) { settings.showtotal = true; storage.set({'showtotal': settings.showtotal}); }
if (settings.showtotal) {
if ($('.accountBalance').length !== 0) {
currencyConversion.load().done(function() {
if (window.location.pathname.match("/account(/store_transactions)?/?$")) {
$(".account_setting_block:first .account_setting_sub_block:nth-child(2)").prepend("<div id='es_total' class='es_loading' style='text-align: center;'><span>" + localized_strings.loading + "</span></div>");

var game_total = 0,
gift_total = 0,
ingame_total = 0,
market_total = 0;

// Gather data
function add_it_up(txt) {
var history = JSON.parse(txt);
var history_html = $.parseHTML(history["html"]);
if (history_html) {
$.each(history_html, function() {
var type = $(this).find(".wht_type div:first").text().trim(),
amount = $(this).find(".wht_total").text().trim(),
items = $(this).find(".wht_items").text().trim();
if (amount && !amount.match("Credit") && type && !items.match("Wallet Credit")) {
var parsed = parse_currency(amount),
calc_value;
if (parsed.currency_type != user_currency) {
calc_value = currencyConversion.convert(parsed.value, parsed.currency_type, user_currency);
} else {
calc_value = parsed.value;
}
if (type.match(/^Purchase/)) game_total += calc_value;
if (type.match("Market Transaction")) market_total += calc_value;
if (type.match("Gift Purchase")) { gift_total += calc_value; }
if (type.match("In-Game Purchase")) ingame_total += calc_value;
}
});
return history["cursor"];
}
}

var sessionid = $(".page_header_ctn").text().match(/g_sessionID = \"(.+)\";/)[1];
var history_promise = (function () {
var deferred = new $.Deferred();
get_http(protocol + "//store.steampowered.com/account/AjaxLoadMoreHistory/?l=en&sessionid=" + sessionid, function(txt) {
var next = add_it_up(txt);
while (next) {
$.ajax({
async: false,
url: protocol + "//store.steampowered.com/account/AjaxLoadMoreHistory/?l=en&cursor%5Btimestamp_newest%5D=" + next["timestamp_newest"] + "&sessionid=" + sessionid
}).done(function(data) {
next = add_it_up(JSON.stringify(data));
});
}
deferred.resolve();
});
return deferred.promise();
})();

$.when.apply($, [history_promise]).done(function() {
var total_total = game_total + gift_total + ingame_total + market_total, html = '';

if (game_total != 0) {
game_total = formatCurrency(parseFloat(game_total));
html += '<div class="accountRow accountBalance">';
html += '<div class="accountData price">' + game_total + '</div>';
html += '<div class="accountLabel" style="text-align: left;">' + localized_strings.store_transactions + ':</div></div>';
}

if (gift_total != 0) {
gift_total = formatCurrency(parseFloat(gift_total));
html += '<div class="accountRow accountBalance">';
html += '<div class="accountData price">' + gift_total + '</div>';
html += '<div class="accountLabel" style="text-align: left;">' + localized_strings.gift_transactions + ':</div></div>';
}

if (ingame_total != 0) {
ingame_total = formatCurrency(parseFloat(ingame_total));
html += '<div class="accountRow accountBalance">';
html += '<div class="accountData price">' + ingame_total + '</div>';
html += '<div class="accountLabel" style="text-align: left;">' + localized_strings.game_transactions + ':</div></div>';
}

if (market_total != 0) {
market_total = formatCurrency(parseFloat(market_total));
html += '<div class="accountRow accountBalance">';
html += '<div class="accountData price">' + market_total + '</div>';
html += '<div class="accountLabel" style="text-align: left;">' + localized_strings.market_transactions + ':</div></div>';
}

if (total_total != 0) {
total_total = formatCurrency(parseFloat(total_total));
html += '<div class="inner_rule" style="margin: 5px 0px 5px 0px;"></div>';
html += '<div class="accountRow accountBalance">';
html += '<div class="accountData price">' + total_total + '</div>';
html += '<div class="accountLabel" style="text-align: left;">' + localized_strings.total_spent + ':</div></div>';
}

$('#es_total').html(html);
});
}
});
}
}
});
$(".account_setting_block:first .account_setting_sub_block:nth-child(2) .account_manage_link:last").parent().after("<div><a class='account_manage_link' href='https://help.steampowered.com/en/accountdata/AccountSpend'>" + localized_strings.external_funds + "</a></div>");
}

// Source: https://greasyfork.org/en/scripts/12228-setmutationhandler/code
Expand Down
1 change: 0 additions & 1 deletion js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ var settings_defaults = {
"showregionalprice": "mouse",
"regional_countries": ["us", "gb", "eu1", "ru", "br", "au", "jp"],

"showtotal": true,
"showmarkettotal": false,
"showsteamrepapi": true,
"showmcus": true,
Expand Down
1 change: 1 addition & 0 deletions localization/en/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
"visit_store": "Visit Store Page",
"all": "All",
"total_spent": "Total Spent",
"external_funds": "External Funds Used",
"games_with_drops": "__dropsgames__ games with drops remaining",
"binder_view": "Binder View",
"view_stats": "View stats",
Expand Down
3 changes: 0 additions & 3 deletions options.html
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,6 @@
</select>
</li>
<li class="header" id="community_general" data-locale-text="options.general">General</li>
<li>
<input type="checkbox" id="showtotal" data-setting="showtotal"><label for="showtotal" id="total_spent_text" data-locale-text="options.total_spent">Show total spent on account page</label>
</li>
<li>
<input type="checkbox" id="add_to_cart_wishlist" data-setting="add_to_cart_wishlist"><label for="add_to_cart_wishlist" id="add_to_cart_wishlist_text" data-locale-text="options.add_to_cart_wishlist">Show "Add to Cart" button on Wishlists</label>
</li>
Expand Down

1 comment on commit 25f4b1f

@allanf181
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please re-add this feature, the Valve version only calculates in USD, not giving support to other users in other countries.

Please sign in to comment.