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

Add Revoke All Invites Button #1625

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
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
44 changes: 44 additions & 0 deletions enhancedsteam.js
Original file line number Diff line number Diff line change
Expand Up @@ -8590,6 +8590,49 @@ function market_popular_refresh_toggle() {
}
}



function add_token_buttons() {

$(".content").find(".btnv6_blue_hoverfade").first().after(` <a id="es-removeTokens" class="btnv6_blue_hoverfade btn_small btn_uppercase generate_button"><span>Revoke All Invites</span></a>`);

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, "/");

Expand Down Expand Up @@ -8842,6 +8885,7 @@ $(document).ready(function(){

case /^\/(?:id|profiles)\/.+\/friends(?:[/#?]|$)/.test(path):
add_friends_sort();
add_token_buttons();
break;

case /^\/(?:id|profiles)\/.+\/tradeoffers/.test(path):
Expand Down