From 90c4ca2d593d7be861b7230e5aa708b0a4150bd2 Mon Sep 17 00:00:00 2001 From: Riley Strickland Date: Fri, 6 Jul 2018 03:20:03 -0400 Subject: [PATCH 1/3] Add Revoke All Invites Button Also update Create an Invite Link to push the new token into g_rgTokens. --- enhancedsteam.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/enhancedsteam.js b/enhancedsteam.js index 08d2b5d4..02184945 100644 --- a/enhancedsteam.js +++ b/enhancedsteam.js @@ -8590,6 +8590,49 @@ function market_popular_refresh_toggle() { } } + + +function add_token_buttons() { + + $(".content").find(".btnv6_blue_hoverfade").first().after(` Revoke All Invites`); + + runInPageContext(` + function() { + CreateInvite = function() { + $J( '#invite_throbber' ).show(); + $J.ajax({ + url: 'https://steamcommunity.com/invites/ajaxcreate', + type: 'POST', + data: { + sessionid: g_sessionID, + steamid_user: g_steamID + } + }).fail(function (jqxhr) { + $J( '#invite_throbber' ).hide(); + }).done(function (data) { + $J( '#invite_throbber' ).hide(); + if ( data.success == 1 ) { + $J( '#invite_throbber' ).hide(); + AppendInvite( data.invite, '#invite_container' ); + g_rgTokens.push(data.invite); + } + }); + }; + }`); + + $("#es-removeTokens").on('click', function () { + runInPageContext(` + function(){ + for (i = 0; i < g_rgTokens.length; i++){ + if (g_rgTokens[i].valid) { RevokeToken(g_rgTokens[i].invite_token); } + } + }`); + }); + +} + + + $(document).ready(function(){ var path = window.location.pathname.replace(/\/+/g, "/"); @@ -8841,8 +8884,9 @@ $(document).ready(function(){ break; case /^\/(?:id|profiles)\/.+\/friends(?:[/#?]|$)/.test(path): - add_friends_sort(); - break; + add_friends_sort(); + add_token_buttons(); + break; case /^\/(?:id|profiles)\/.+\/tradeoffers/.test(path): add_decline_button(); From ff28016729c869d680c344d8b5b1636533733b34 Mon Sep 17 00:00:00 2001 From: Riley Strickland Date: Fri, 6 Jul 2018 03:26:00 -0400 Subject: [PATCH 2/3] Fix whitespace --- enhancedsteam.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enhancedsteam.js b/enhancedsteam.js index 02184945..198d6790 100644 --- a/enhancedsteam.js +++ b/enhancedsteam.js @@ -8884,8 +8884,8 @@ $(document).ready(function(){ break; case /^\/(?:id|profiles)\/.+\/friends(?:[/#?]|$)/.test(path): - add_friends_sort(); - add_token_buttons(); + add_friends_sort(); + add_token_buttons(); break; case /^\/(?:id|profiles)\/.+\/tradeoffers/.test(path): From 103c71332938bf2fff6df1466560d76dc095e4d5 Mon Sep 17 00:00:00 2001 From: Riley Strickland Date: Fri, 6 Jul 2018 03:26:41 -0400 Subject: [PATCH 3/3] Fix whitespace 2 electric boogaloo --- enhancedsteam.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enhancedsteam.js b/enhancedsteam.js index 198d6790..ca3cbb40 100644 --- a/enhancedsteam.js +++ b/enhancedsteam.js @@ -8886,7 +8886,7 @@ $(document).ready(function(){ case /^\/(?:id|profiles)\/.+\/friends(?:[/#?]|$)/.test(path): add_friends_sort(); add_token_buttons(); - break; + break; case /^\/(?:id|profiles)\/.+\/tradeoffers/.test(path): add_decline_button();