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
No edit summary
PJSans (talk | contribs)
Added dynamic categorization
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>
<includeonly>
<!-- Params:
  trackId = required (MX TrackId)
  site    = tmnf | tmuf | original | sunrise | nations  (default: tmnf)
  title, image, game = optional manual overrides (Game stays manual)
-->
{{#if:{{{trackId|}}}
{{#if:{{{trackId|}}}
  | {{#get_web_data:
  | {{#get_web_data:
     | url = https://tmnf.exchange/api/replays?trackId={{{trackId}}}&count=1&fields=User,ReplayTime&best=1
     | url = {{#switch:{{lc:{{{site|tmnf}}}}}
    | data = wr_time = $.Results[0].ReplayTime, wr_player = $.Results[0].User.Name
              | tmuf    = https://tmuf.exchange
              | tmnf    = https://tmnf.exchange
              | original = https://original.tm-exchange.com
              | sunrise  = https://sunrise.tm-exchange.com
              | nations  = https://nations.tm-exchange.com
              | #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
     | format = json with jsonpath
     | format = json with jsonpath
     | cache seconds = 300
     | cache seconds = 300
    | data =
        id            = $.Results[0].TrackId,
        name          = $.Results[0].TrackName,
        uid          = $.Results[0].UId,
        time_author  = $.Results[0].AuthorTime,
        score_author  = $.Results[0].AuthorScore,
        time_gold    = $.Results[0].GoldTarget,
        time_silver  = $.Results[0].SilverTarget,
        time_bronze  = $.Results[0].BronzeTarget,
        uploader_id  = $.Results[0].Uploader.UserId,
        uploader_name = $.Results[0].Uploader.Name,
        wr_time      = $.Results[0].WRReplay.ReplayTime,
        wr_player    = $.Results[0].WRReplay.User.Name,
        uploaded_at  = $.Results[0].UploadedAt,
        updated_at    = $.Results[0].UpdatedAt,
        activity_at  = $.Results[0].ActivityAt,
        primary_type  = $.Results[0].PrimaryType,
        track_value  = $.Results[0].TrackValue,
        style        = $.Results[0].Style,
        routes        = $.Results[0].Routes,
        difficulty    = $.Results[0].Difficulty,
        environment  = $.Results[0].Environment,
        car          = $.Results[0].Car,
        mood          = $.Results[0].Mood,
        awards        = $.Results[0].Awards,
        comments      = $.Results[0].Comments,
        replay_type  = $.Results[0].ReplayType,
        authors_json  = $.Results[0].Authors[*].User.Name
   }}
   }}
}}
}}
Line 11: Line 51:
{| class="wikitable infobox-track" style="width:300px; float:right; clear:right; margin-left:10px;"
{| class="wikitable infobox-track" style="width:300px; float:right; clear:right; margin-left:10px;"
|-
|-
! colspan="2" class="infobox-title" | {{{title|{{PAGENAME}}}}}
! colspan="2" class="infobox-title" | {{#if:{{{title|}}}
  | {{{title}}}
  | {{#if:{{#external_value:name|}}
      | {{#external_value:name}}
      | Unknown }} }}
|-
| colspan="2" class="infobox-image" | {{ShowImage|https://{{#switch:{{lc:{{{site|tmnf}}}}}
        | tmuf    = tmuf.exchange
        | tmnf    = tmnf.exchange
        | original = original.tm-exchange.com
        | sunrise  = sunrise.tm-exchange.com
        | nations  = nations.tm-exchange.com
        | #default = tmnf.exchange
      }}/trackshow/{{#external_value:id}}/image/1}}
|-
! Game || {{{game|{{#switch: {{lc:{{{site|}}}}}
  | tmuf    = TrackMania United Forever
  | tmnf    = TrackMania Nations Forever
  | original = TrackMania Original
  | sunrise  = TrackMania Sunrise
  | nations  = TrackMania Nations
  | #default = TrackMania Nations Forever
}}}}}
|-
! Author(s) || {{#if:{{{author|}}}
  | {{{author}}}
  | {{#if:{{#external_value:authors_json|}}
      | {{#external_value:authors_json}}
      | Unknown
    }} }}
|-
|-
| colspan="2" class="infobox-image" | [[File:{{{image|}}}|250px]]
 
! World record || {{#if:{{{worldrecord|}}}
  | {{{worldrecord}}}
  | {{#invoke:TrackInfobox|formatWR
      | {{#external_value:wr_time|}}
      | {{#external_value:wr_player|}}
      | Unknown
    }}
}}
|-
|-
! Game || {{{game|Unknown}}}
! Author medal || {{#if:{{{authormedal|}}}
  | {{{authormedal}}}
  | {{#if:{{#external_value:time_author|}}
      | {{#expr: {{#external_value:time_author}} / 1000 }}
      | N/A
    }} }}
|-
|-
! Author(s) || {{{author|Unknown}}}
! Gold medal || {{#if:{{{goldmedal|}}}
  | {{{goldmedal}}}
  | {{#if:{{#external_value:time_gold|}}
      | {{#expr: {{#external_value:time_gold}} / 1000 }}
      | N/A
    }} }}
|-
|-
! World record || {{#invoke:TrackInfobox|formatWR|{{#external_value:wr_time}}{{#if:{{#external_value:wr_time}}|}}{{#external_value:wr_player}}{{#if:{{#external_value:wr_player}}|}}{{{worldrecord|Unknown}}}}}
! Silver medal || {{#if:{{{silvermedal|}}}
  | {{{silvermedal}}}
  | {{#if:{{#external_value:time_silver|}}
      | {{#expr: {{#external_value:time_silver}} / 1000 }}
      | N/A
    }} }}
|-
|-
! Author medal || {{{authormedal|Unknown}}}
! Bronze medal || {{#if:{{{bronzemedal|}}}
  | {{{bronzemedal}}}
  | {{#if:{{#external_value:time_bronze|}}
      | {{#expr: {{#external_value:time_bronze}} / 1000 }}
      | N/A
    }} }}
|-
|-
! Gold medal || {{{goldmedal|Unknown}}}
! Uploaded || {{#if:{{{release_date|}}}
  | {{{release_date}}}
  | {{#if:{{#external_value:uploaded_at|}}
      | {{#external_value:uploaded_at}}
      | N/A
    }} }}
|-
|-
! Silver medal || {{{silvermedal|Unknown}}}
! Last updated || {{#if:{{{lastupdated|}}}
  | {{{lastupdated}}}
  | {{#if:{{#external_value:updated_at|}}
      | {{#external_value:updated_at}}
      | N/A
    }} }}
|-
|-
! Bronze medal || {{{bronzemedal|Unknown}}}
! Activity || {{#if:{{{activity|}}}
  | {{{activity}}}
  | {{#if:{{#external_value:activity_at|}}
      | {{#external_value:activity_at}}
      | N/A
    }} }}
|-
|-
! Release date || {{{release_date|Unknown}}}
! Awards / Comments || {{#if:{{{awardscomments|}}}
  | {{{awardscomments}}}
  | {{#if:{{#external_value:awards|dummy}}
      | {{#external_value:awards|0}} / {{#external_value:comments|0}}
      | N/A
    }} }}
|-
|-
! Link || {{{link|Unknown}}}
! Link || {{#if:{{{link|}}}
  | {{{link}}}
  | {{#if:{{#external_value:id|{{{trackId|}}}}}
      | [{{#switch:{{lc:{{{site|tmnf}}}}}
          | tmuf    = https://tmuf.exchange
          | tmnf    = https://tmnf.exchange
          | original = https://original.tm-exchange.com
          | sunrise  = https://sunrise.tm-exchange.com
          | nations  = https://nations.tm-exchange.com
          | #default = https://tmnf.exchange
        }}/trackshow/{{#external_value:id|{{{trackId|}}}}} TrackMania Exchange]
      | Unknown
    }} }}
|-
|-
|}
|}
[[Category:Games|{{PAGENAME}}]]
[[Category:{{uc:{{{site|tmnf}}}}} Tracks]]
[[Category:Tracks|{{PAGENAME}}]]
[[Category:{{#switch:{{lc:{{{site|tmnf}}}}}
  | tmuf    = TMUF
  | tmnf    = TMNF
  | original = TMO
  | sunrise  = TMS
  | nations  = TMN
  | #default = TMNF
}} Tracks|{{PAGENAME}}]]
</includeonly><noinclude>
</includeonly><noinclude>
== Usage ==
== Usage ==
This is the infobox template for video games. To use it, copy and paste the following code into an article:
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):


<pre>
<pre>
{{Infobox video game
{{Infobox track
| title        = Track Title
| trackId      = 123456
| image        = Example.jpg
| site          = tmuf, tmnf, original, sunrise, nations (Default: tmnf)
| game          = TrackMania Game
| title        = Track Title (Optional)
| author        = Track Author
| image        = Example.jpg (Optional)
| worldrecord  = XX.YY by Player
| game          = TrackMania Game (Optional)
| authormedal  = Author Medal
| goldmedal    = Gold Medal
| silvermedal  = Silver Medal
| bronzemedal  = Bronze Medal
| release_date  = YYYY-MM-DD
| link          = TrackMania Exchange link
}}
}}
</pre>
</pre>

Latest revision as of 21:43, 14 August 2025

Usage[edit]

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 (Default: tmnf)
| title         = Track Title (Optional)
| image         = Example.jpg (Optional)
| game          = TrackMania Game (Optional)
}}
Contents