File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ $(document).ready(function () {
2929
3030 let pageUrl = window . location . href
3131 if ( IsAddToCollectionPage ( pageUrl ) ) {
32- // TODO: not working in page with url like example: https://itch.io/g/tobyfox/deltarune/add-to-collection?source=home
3332 if ( ! GameInCollection ( ) ) { return }
3433
3534 let gameCreator = GetUserFromGamePage ( pageUrl )
@@ -145,10 +144,18 @@ $(document).ready(function () {
145144 }
146145
147146 function GetUserFromGamePage ( url ) {
148- return url . split ( "/" ) [ 2 ] . split ( "." ) [ 0 ]
147+ if ( url . includes ( "?source=game" ) ) {
148+ return url . split ( "/" ) [ 2 ] . split ( "." ) [ 0 ]
149+ } else {
150+ return url . split ( "/" ) [ 4 ]
151+ }
149152 }
150153
151154 function GetGameNameFromGamePage ( url ) {
152- return url . split ( "/" ) [ 3 ]
155+ if ( url . includes ( "?source=game" ) ) {
156+ return url . split ( "/" ) [ 3 ]
157+ } else {
158+ return url . split ( "/" ) [ 5 ]
159+ }
153160 }
154161} ) ;
You can’t perform that action at this time.
0 commit comments