Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Infobox track: Difference between revisions

Template page
Zai (talk | contribs)
m fix duplicate category
Zai (talk | contribs)
support tm2 and tm2020, and other improvements
Line 2: Line 2:
<!-- Params:
<!-- Params:
   trackId = required (MX TrackId)
   trackId = required (MX TrackId)
   site    = tmnf | tmuf | original | sunrise | nations  (default: tmnf)
   site    = tmnf | tmuf | original | sunrise | nations | tm2 | tm2020   (default: tmnf)
   title, image, game = optional manual overrides (Game stays manual)
   title, image, game = optional manual overrides (Game stays manual)
-->
-->
Line 13: Line 13:
               | sunrise  = https://sunrise.tm-exchange.com
               | sunrise  = https://sunrise.tm-exchange.com
               | nations  = https://nations.tm-exchange.com
               | nations  = https://nations.tm-exchange.com
              | tm2      = https://tm.mania.exchange
              | tm2020  = https://trackmania.exchange
               | #default = https://tmnf.exchange
               | #default = https://tmnf.exchange
             }}/api/tracks?id={{{trackId}}}&count=1&fields=TrackId%2CTrackName%2CUId%2CAuthorTime%2CAuthorScore%2CGoldTarget%2CSilverTarget%2CBronzeTarget%2CUploader.UserId%2CUploader.Name%2CAuthors%5B%5D%2CWRReplay.ReplayTime%2CWRReplay.User.Name%2CUploadedAt%2CUpdatedAt%2CActivityAt%2CPrimaryType%2CTrackValue%2CStyle%2CRoutes%2CDifficulty%2CEnvironment%2CCar%2CMood%2CAwards%2CComments%2CReplayType
             }}{{#switch:{{lc:{{{site|tmnf}}}}}
              | tmuf   
              | tmnf   
              | original
              | sunrise
              | nations = /api/tracks?id={{{trackId}}}&count=1&fields=TrackId%2CTrackName%2CUId%2CAuthorTime%2CAuthorScore%2CGoldTarget%2CSilverTarget%2CBronzeTarget%2CUploader.UserId%2CUploader.Name%2CAuthors%5B%5D%2CWRReplay.ReplayTime%2CWRReplay.User.Name%2CUploadedAt%2CUpdatedAt%2CActivityAt%2CPrimaryType%2CTrackValue%2CStyle%2CRoutes%2CDifficulty%2CEnvironment%2CCar%2CMood%2CAwards%2CComments%2CReplayType
              | tm2   
              | tm2020  = /api/maps?id={{{trackId}}}&count=1&fields=MapId%2CName%2CMapUid%2CMedals.Author%2CMedals.Gold%2CMedals.Silver%2CMedals.Bronze%2CUploader.UserId%2CUploader.Name%2CAuthors%5B%5D%2COnlineWR%2CUploadedAt%2CUpdatedAt%2CActivityAt%2CType%2CTrackValue%2CStyle%2CRoutes%2CDifficulty%2CEnvironment%2CVehicle%2CMood%2CAwardCount%2CCommentCount%2CReplayType
            }}
     | format = json with jsonpath
     | format = json with jsonpath
     | cache seconds = 300
     | cache seconds = 300
     | data =
     | data =
         id            = $.Results[0].TrackId,
         id            = {{#switch:{{lc:{{{site|tmnf}}}}}| tmuf | tmnf | original | sunrise | nations = $.Results[0].TrackId | tm2 | tm2020 = $.Results[0].MapId}},
         name          = $.Results[0].TrackName,
         name          = {{#switch:{{lc:{{{site|tmnf}}}}}| tmuf | tmnf | original | sunrise | nations = $.Results[0].TrackName | tm2 | tm2020 = $.Results[0].Name}},
         uid          = $.Results[0].UId,
         uid          = {{#switch:{{lc:{{{site|tmnf}}}}}| tmuf | tmnf | original | sunrise | nations = $.Results[0].UId | tm2 | tm2020 = $.Results[0].MapName}},
         time_author  = $.Results[0].AuthorTime,
         time_author  = {{#switch:{{lc:{{{site|tmnf}}}}}| tmuf | tmnf | original | sunrise | nations = $.Results[0].AuthorTime | tm2 | tm2020 = $.Results[0].Medals.Author}},
         score_author  = $.Results[0].AuthorScore,
         score_author  = {{#switch:{{lc:{{{site|tmnf}}}}}| tmuf | tmnf | original | sunrise | nations = $.Results[0].AuthorScore | tm2 | tm2020 = $.Results[0].Medals.Author}},
         time_gold    = $.Results[0].GoldTarget,
         time_gold    = {{#switch:{{lc:{{{site|tmnf}}}}}| tmuf | tmnf | original | sunrise | nations = $.Results[0].GoldTarget | tm2 | tm2020 = $.Results[0].Medals.Gold}},
         time_silver  = $.Results[0].SilverTarget,
         time_silver  = {{#switch:{{lc:{{{site|tmnf}}}}}| tmuf | tmnf | original | sunrise | nations = $.Results[0].SilverTarget | tm2 | tm2020 = $.Results[0].Medals.Silver}},
         time_bronze  = $.Results[0].BronzeTarget,
         time_bronze  = {{#switch:{{lc:{{{site|tmnf}}}}}| tmuf | tmnf | original | sunrise | nations = $.Results[0].BronzeTarget | tm2 | tm2020 = $.Results[0].Medals.Bronze}},
         uploader_id  = $.Results[0].Uploader.UserId,
         uploader_id  = $.Results[0].Uploader.UserId,
         uploader_name = $.Results[0].Uploader.Name,
         uploader_name = $.Results[0].Uploader.Name,
         wr_time      = $.Results[0].WRReplay.ReplayTime,
         wr_time      = {{#switch:{{lc:{{{site|tmnf}}}}}| tmuf | tmnf | original | sunrise | nations = $.Results[0].WRReplay.ReplayTime | tm2 | tm2020 = $.Results[0].OnlineWR.RecordTime}},  
         wr_player    = $.Results[0].WRReplay.User.Name,
         wr_player    = {{#switch:{{lc:{{{site|tmnf}}}}}| tmuf | tmnf | original | sunrise | nations = $.Results[0].WRReplay.User.Name | tm2 | tm2020 = $.Results[0].OnlineWR.DisplayName}},  
         uploaded_at  = $.Results[0].UploadedAt,
         uploaded_at  = $.Results[0].UploadedAt,
         updated_at    = $.Results[0].UpdatedAt,
         updated_at    = $.Results[0].UpdatedAt,
         activity_at  = $.Results[0].ActivityAt,
         activity_at  = $.Results[0].ActivityAt,
         primary_type  = $.Results[0].PrimaryType,
         primary_type  = {{#switch:{{lc:{{{site|tmnf}}}}}| tmuf | tmnf | original | sunrise | nations = $.Results[0].PrimaryType | tm2 | tm2020 = $.Results[0].Type}},  
         track_value  = $.Results[0].TrackValue,
         track_value  = $.Results[0].TrackValue,
         style        = $.Results[0].Style,
         style        = $.Results[0].Style,
Line 39: Line 49:
         difficulty    = $.Results[0].Difficulty,
         difficulty    = $.Results[0].Difficulty,
         environment  = $.Results[0].Environment,
         environment  = $.Results[0].Environment,
         car          = $.Results[0].Car,
         car          = {{#switch:{{lc:{{{site|tmnf}}}}}| tmuf | tmnf | original | sunrise | nations = $.Results[0].Car | tm2 | tm2020 = $.Results[0].Vehicle}},  
         mood          = $.Results[0].Mood,
         mood          = $.Results[0].Mood,
         awards        = $.Results[0].Awards,
         awards        = {{#switch:{{lc:{{{site|tmnf}}}}}| tmuf | tmnf | original | sunrise | nations = $.Results[0].Awards | tm2 | tm2020 = $.Results[0].AwardCount}},  
         comments      = $.Results[0].Comments,
         comments      = {{#switch:{{lc:{{{site|tmnf}}}}}| tmuf | tmnf | original | sunrise | nations = $.Results[0].Comments | tm2 | tm2020 = $.Results[0].CommentCount}},  
         replay_type  = $.Results[0].ReplayType,
         replay_type  = $.Results[0].ReplayType,
         authors_json  = $.Results[0].Authors[*].User.Name
         authors_json  = $.Results[0].Authors[*].User.Name
  }}
}}
{{#ifeq:{{lc:{{{site|tmnf}}}}}|tm2
  | {{#get_web_data:
  | url = https://tm.mania.exchange/api/replays?mapId={{#external_value:id}}
  | format = json with jsonpath
  | cache seconds = 300
  | data =
      wr_time  = $.Results[0].ReplayTime,
      wr_player = $.Results[0].User.Name
   }}
   }}
}}
}}
Line 56: Line 76:
|-
|-
| colspan="2" class="infobox-image" | {{ShowImage|https://{{#switch:{{lc:{{{site|tmnf}}}}}
| colspan="2" class="infobox-image" | {{ShowImage|https://{{#switch:{{lc:{{{site|tmnf}}}}}
         | tmuf    = tmuf.exchange
         | tmuf    = tmuf.exchange/trackshow/{{#external_value:id}}/image/1
         | tmnf    = tmnf.exchange
         | tmnf    = tmnf.exchange/trackshow/{{#external_value:id}}/image/1
         | original = original.tm-exchange.com
         | original = original.tm-exchange.com/trackshow/{{#external_value:id}}/image/1
         | sunrise  = sunrise.tm-exchange.com
         | sunrise  = sunrise.tm-exchange.com/trackshow/{{#external_value:id}}/image/1
         | nations  = nations.tm-exchange.com
         | nations  = nations.tm-exchange.com/trackshow/{{#external_value:id}}/image/1
         | #default = tmnf.exchange
        | tm2      = tm.mania.exchange/mapimage/{{#external_value:id}}/1
      }}/trackshow/{{#external_value:id}}/image/1}}
        | tm2020  = trackmania.exchange/mapimage/{{#external_value:id}}/1
         | #default = tmnf.exchange/trackshow/{{#external_value:id}}/image/1
      }}}}
|-
|-
! Game || {{{game|{{#switch: {{lc:{{{site|}}}}}
! Game || {{{game|{{#switch: {{lc:{{{site|}}}}}
Line 71: Line 93:
   | nations  = TrackMania Nations
   | nations  = TrackMania Nations
   | #default = TrackMania Nations Forever
   | #default = TrackMania Nations Forever
  | tm2      = TrackMania²
  | tm2020  = Trackmania 2020
}}}}}
}}}}}
|-
|-
Line 83: Line 107:
! World record || {{#if:{{{worldrecord|}}}
! World record || {{#if:{{{worldrecord|}}}
   | {{{worldrecord}}}
   | {{{worldrecord}}}
   | {{#invoke:TrackInfobox|formatWR
   | {{Time|{{#external_value:wr_time|}}}} by {{#external_value:wr_player|Unknown}}
      | {{#external_value:wr_time|}}
      | {{#external_value:wr_player|}}
      | Unknown
    }}
}}
}}
|-
|-
Line 93: Line 113:
   | {{{authormedal}}}
   | {{{authormedal}}}
   | {{#if:{{#external_value:time_author|}}
   | {{#if:{{#external_value:time_author|}}
       | {{#expr: {{#external_value:time_author}} / 1000 }}
       | {{Time|{{#external_value:time_author}}}}
       | N/A
       | N/A
     }} }}
     }} }}
Line 100: Line 120:
   | {{{goldmedal}}}
   | {{{goldmedal}}}
   | {{#if:{{#external_value:time_gold|}}
   | {{#if:{{#external_value:time_gold|}}
       | {{#expr: {{#external_value:time_gold}} / 1000 }}
       | {{Time|{{#external_value:time_gold}}}}
       | N/A
       | N/A
     }} }}
     }} }}
Line 107: Line 127:
   | {{{silvermedal}}}
   | {{{silvermedal}}}
   | {{#if:{{#external_value:time_silver|}}
   | {{#if:{{#external_value:time_silver|}}
       | {{#expr: {{#external_value:time_silver}} / 1000 }}
       | {{Time|{{#external_value:time_silver}}}}
       | N/A
       | N/A
     }} }}
     }} }}
Line 114: Line 134:
   | {{{bronzemedal}}}
   | {{{bronzemedal}}}
   | {{#if:{{#external_value:time_bronze|}}
   | {{#if:{{#external_value:time_bronze|}}
       | {{#expr: {{#external_value:time_bronze}} / 1000 }}
       | {{Time|{{#external_value:time_bronze}}}}
       | N/A
       | N/A
     }} }}
     }} }}
Line 121: Line 141:
   | {{{release_date}}}
   | {{{release_date}}}
   | {{#if:{{#external_value:uploaded_at|}}  
   | {{#if:{{#external_value:uploaded_at|}}  
       | {{#external_value:uploaded_at}}
       | {{#time:Y-m-d G:i:s e|{{#external_value:uploaded_at}}}}
       | N/A
       | N/A
     }} }}
     }} }}
Line 128: Line 148:
   | {{{lastupdated}}}
   | {{{lastupdated}}}
   | {{#if:{{#external_value:updated_at|}}  
   | {{#if:{{#external_value:updated_at|}}  
       | {{#external_value:updated_at}}
       | {{#time:Y-m-d G:i:s e|{{#external_value:uploaded_at}}}}
       | N/A
       | N/A
     }} }}
     }} }}
Line 135: Line 155:
   | {{{activity}}}
   | {{{activity}}}
   | {{#if:{{#external_value:activity_at|}}  
   | {{#if:{{#external_value:activity_at|}}  
       | {{#external_value:activity_at}}
       | {{#time:Y-m-d G:i:s e|{{#external_value:uploaded_at}}}}
       | N/A
       | N/A
     }} }}
     }} }}
Line 155: Line 175:
           | sunrise  = https://sunrise.tm-exchange.com
           | sunrise  = https://sunrise.tm-exchange.com
           | nations  = https://nations.tm-exchange.com
           | nations  = https://nations.tm-exchange.com
          | tm2      = https://tm.mania.exchange
          | tm2020  = https://trackmania.exchange
           | #default = https://tmnf.exchange
           | #default = https://tmnf.exchange
         }}/trackshow/{{#external_value:id|{{{trackId|}}}}} TrackMania Exchange]
         }}/trackshow/{{#external_value:id|{{{trackId|}}}}} TrackMania Exchange]
Line 168: Line 190:
   | sunrise  = TMS
   | sunrise  = TMS
   | nations  = TMN
   | nations  = TMN
  | tm2      = TM²
  | tm2020  = TM2020
   | #default = TMNF
   | #default = TMNF
}} Tracks|{{PAGENAME}}]]
}} Tracks|{{PAGENAME}}]]
Line 177: Line 201:
{{Infobox track
{{Infobox track
| trackId      = 123456
| trackId      = 123456
| site          = tmuf, tmnf, original, sunrise, nations (Default: tmnf)
| site          = tmuf, tmnf, original, sunrise, nations, tm2, tm2020 (Default: tmnf)
| title        = Track Title (Optional)
| title        = Track Title (Optional)
| image        = Example.jpg (Optional)
| image        = Example.jpg (Optional)
Line 183: Line 207:
}}
}}
</pre>
</pre>
 
{{Infobox track
| trackId = 1
| site = tm2020
}}
[[Category:Infobox templates]]
[[Category:Infobox templates]]
</noinclude>
</noinclude>

Revision as of 21:48, 25 January 2026

Usage

This is the infobox template for tracks. To use it, copy and paste the following code into an article (trackId is required, site is tmnf by default):

{{Infobox track
| trackId       = 123456
| site          = tmuf, tmnf, original, sunrise, nations, tm2, tm2020 (Default: tmnf)
| title         = Track Title (Optional)
| image         = Example.jpg (Optional)
| game          = TrackMania Game (Optional)
}}


Alive
aHR0cHM6Ly90cmFja21hbmlhLmV4Y2hhbmdlL21hcGltYWdlLzEvMQ==.jpg
Game Trackmania 2020
Author(s) Keissla.wp
World record 01:18.086 by meexz-
Author medal 01:26.495
Gold medal 01:32.000
Silver medal 01:44.000
Bronze medal 02:10.000
Uploaded 2020-07-01 20:12:09 UTC
Last updated 2020-07-01 20:12:09 UTC
Activity 2020-07-01 20:12:09 UTC
Awards / Comments 82 / 20
Link TrackMania Exchange
Contents