@@ -34,7 +34,7 @@ $(document).ready(function () {
3434
3535 let gameCreator = GetUserFromGamePage ( pageUrl )
3636 let gameName = GetGameNameFromGamePage ( pageUrl )
37- GetGameId ( gameCreator , gameName ) . then ( AddAndEnableRemoveButtons ( ) )
37+ GetGameIdFromItchApi ( gameCreator , gameName ) . then ( AddAndEnableRemoveButtons ( ) )
3838 } else {
3939 // wait for add-to-collection lightbox to load on any other page
4040 bodyObserver . observe ( $ ( "body" ) [ 0 ] , { childList : true } )
@@ -45,7 +45,7 @@ $(document).ready(function () {
4545
4646 // On click "Add To Collection" button for a game
4747 $ ( '#user_tools, div[class*="game_grid_widget"]' ) . on ( 'click' , 'a.add_to_collection_btn' , function ( ) {
48- _gameId = GetGameId ( this )
48+ _gameId = GetGameIdFromGameCell ( this )
4949 } ) ;
5050
5151 function OnBodyChange ( ) {
@@ -74,7 +74,7 @@ $(document).ready(function () {
7474 return $ ( "ul.already_in" ) . length > 0
7575 }
7676
77- function GetGameId ( addToCollectionBtn ) {
77+ function GetGameIdFromGameCell ( addToCollectionBtn ) {
7878 let pageUrl = window . location . href
7979 let gameId = ""
8080 let gameCell = addToCollectionBtn . closest ( 'div.game_cell' )
@@ -88,8 +88,8 @@ $(document).ready(function () {
8888 return gameId
8989 }
9090
91- async function GetGameId ( gameCreator , gameName ) {
92- return new Promise ( function ( resolve , reject ) {
91+ async function GetGameIdFromItchApi ( gameCreator , gameName ) {
92+ return new Promise ( function ( resolve , reject ) {
9393 Itch . getGameData ( {
9494 user : gameCreator ,
9595 game : gameName ,
@@ -99,7 +99,7 @@ $(document).ready(function () {
9999 console . error ( data )
100100 reject ( )
101101 }
102-
102+
103103 _gameId = data . id
104104 resolve ( _gameId )
105105 }
0 commit comments