Skip to content

Commit

Permalink
Make family share banner a link to the Steam game library page
Browse files Browse the repository at this point in the history
  • Loading branch information
xPaw committed Jan 29, 2025
1 parent 0b5ac12 commit 824540c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions scripts/store/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ else
AddCollapseButtonToAlreadyInLibraryBlock( items );
} );

// Make family share banner a link to the Steam client
MakeGameInFamilyLinkToLibrary();

// Valve does not invalidate cache for follow button, so we catch it here
FollowInvalidateCache();

Expand Down Expand Up @@ -997,3 +1000,19 @@ function AddCollapseButtonToAlreadyInLibraryBlock( options )
alreadyInLibrary.insertAdjacentElement( 'afterend', button );
alreadyInLibrary.style.marginRight = `${button.getBoundingClientRect().width - 15}px`;
}

function MakeGameInFamilyLinkToLibrary()
{
const inFamilyText = document.querySelector( '.game_purchase_area_owned_by_family .family_info p' );

if( !inFamilyText )
{
return;
}

const link = document.createElement( 'a' );
link.classList.add( 'steamdb_already_in_library_link' );
link.href = `steam://nav/games/details/${GetCurrentAppID()}`;
link.textContent = inFamilyText.textContent;
inFamilyText.replaceChildren( link );
}

0 comments on commit 824540c

Please sign in to comment.