File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -399,7 +399,8 @@ function a(){
399399 _editor . setMode ( 'view' ) ;
400400 IndexedDBOperation . do ( { operation : 'addReplayToStorage' , data : _editor . getText ( ) } ) ;
401401 GitHubApi . fetch ( 'search/repositories?q=topic:AI-Tournaments+topic:AI-Tournaments-Replay+topic:' + _replayData . body . arena . full_name . replace ( '/' , '--' ) ) . then ( response => response . json ( ) ) . then ( response => {
402- document . getElementById ( 'default-option' ) . value = _replayData . header . defaultReplay ;
402+ const officialUrl = 'https://ai-tournaments.github.io/' ; // TODO: 👇 Either only allow absolute URL:s or calculate arena origin.
403+ document . getElementById ( 'default-option' ) . value = ( _replayData . header . defaultReplay [ 0 ] === '/' ?officialUrl :'' ) + _replayData . header . defaultReplay ;
403404 response . items . forEach ( repo => {
404405 if ( repo . has_pages ) {
405406 let cssStar = getComputedStyle ( document . documentElement ) . getPropertyValue ( '--github-stars' ) . trim ( ) ;
@@ -418,8 +419,8 @@ function a(){
418419 options . sort ( function ( a , b ) {
419420 if ( b . id === 'default-option' ) { return 1 ; }
420421
421- let aOfficial = a . value . startsWith ( 'https://ai-tournaments.github.io/' ) ;
422- let bOfficial = b . value . startsWith ( 'https://ai-tournaments.github.io/' ) ;
422+ let aOfficial = a . value . startsWith ( officialUrl ) ;
423+ let bOfficial = b . value . startsWith ( officialUrl ) ;
423424 if ( aOfficial ? ! bOfficial : bOfficial ) { return 1 ; }
424425
425426 if ( parseFloat ( a . dataset . stars ) < parseFloat ( b . dataset . stars ) ) { return - 1 ; }
You can’t perform that action at this time.
0 commit comments