Difference between revisions of "User:TidB/Map locations"

From Team Fortress Wiki
Jump to: navigation, search
(Created page with "{| class="mw-collapsible {{#if:{{{collapsed|}}} | mw-collapsed |}} navbox maploc" |- ! style="background: #1c1c1c; font-size: 12px;" | {{#if:{{{templatename|}}}|<span class="c...")
 
(Added 'nobox' parameter for inclusion into the {{tabs}} template, removed 'templatename' parameter)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{| class="mw-collapsible {{#if:{{{collapsed|}}} | mw-collapsed |}} navbox maploc"
+
<includeonly>{| class="{{#if:{{{nobox|}}} | | mw-collapsible {{#if:{{{collapsed|}}} | mw-collapsed }} navbox |}} maploc"
|-
+
{{#if:{{{nobox|}}} | |
! style="background: #1c1c1c; font-size: 12px;" | {{#if:{{{templatename|}}}|<span class="controls">[[Template:{{{templatename}}}|v]] &middot; [[Template talk:{{{templatename}}}|d]] &middot; <span class="plainlinks">[{{fullurl:Template:{{{templatename}}}|action=edit}} e]</span></span>|}}{{{title}}}
+
{{!}}-
 +
! style="background: #1c1c1c; font-size: 12px; color: #ffffff" {{!}} {{{title}}}
 +
}}
 
|-
 
|-
 
| <div class="container">[[Image:{{{image}}}|800px|link=]]
 
| <div class="container">[[Image:{{{image}}}|800px|link=]]
 
{{#if:{{{area1|}}}|<div class="marker" style="left: {{{x1}}}; top: {{{y1}}};"><div>{{{area1}}}</div></div>|}}{{#if:{{{area2|}}}|<div class="marker" style="left: {{{x2}}}; top: {{{y2}}};"><div>{{{area2}}}</div></div>|}}{{#if:{{{area3|}}}|<div class="marker" style="left: {{{x3}}}; top: {{{y3}}};"><div>{{{area3}}}</div></div>|}}{{#if:{{{area4|}}}|<div class="marker" style="left: {{{x4}}}; top: {{{y4}}};"><div>{{{area4}}}</div></div>|}}{{#if:{{{area5|}}}|<div class="marker" style="left: {{{x5}}}; top: {{{y5}}};"><div>{{{area5}}}</div></div>|}}{{#if:{{{area6|}}}|<div class="marker" style="left: {{{x6}}}; top: {{{y6}}};"><div>{{{area6}}}</div></div>|}}{{#if:{{{area7|}}}|<div class="marker" style="left: {{{x7}}}; top: {{{y7}}};"><div>{{{area7}}}</div></div>|}}{{#if:{{{area8|}}}|<div class="marker" style="left: {{{x8}}}; top: {{{y8}}};"><div>{{{area8}}}</div></div>|}}{{#if:{{{area9|}}}|<div class="marker" style="left: {{{x9}}}; top: {{{y9}}};"><div>{{{area9}}}</div></div>|}}{{#if:{{{area10|}}}|<div class="marker" style="left: {{{x10}}}; top: {{{y10}}};"><div>{{{area10}}}</div></div>|}}{{#if:{{{area11|}}}|<div class="marker" style="left: {{{x11}}}; top: {{{y11}}};"><div>{{{area11}}}</div></div>|}}{{#if:{{{area12|}}}|<div class="marker" style="left: {{{x12}}}; top: {{{y12}}};"><div>{{{area12}}}</div></div>|}}{{#if:{{{area13|}}}|<div class="marker" style="left: {{{x13}}}; top: {{{y13}}};"><div>{{{area13}}}</div></div>|}}{{#if:{{{area14|}}}|<div class="marker" style="left: {{{x14}}}; top: {{{y14}}};"><div>{{{area14}}}</div></div>|}}{{#if:{{{area15|}}}|<div class="marker" style="left: {{{x15}}}; top: {{{y15}}};"><div>{{{area15}}}</div></div>|}}
 
{{#if:{{{area1|}}}|<div class="marker" style="left: {{{x1}}}; top: {{{y1}}};"><div>{{{area1}}}</div></div>|}}{{#if:{{{area2|}}}|<div class="marker" style="left: {{{x2}}}; top: {{{y2}}};"><div>{{{area2}}}</div></div>|}}{{#if:{{{area3|}}}|<div class="marker" style="left: {{{x3}}}; top: {{{y3}}};"><div>{{{area3}}}</div></div>|}}{{#if:{{{area4|}}}|<div class="marker" style="left: {{{x4}}}; top: {{{y4}}};"><div>{{{area4}}}</div></div>|}}{{#if:{{{area5|}}}|<div class="marker" style="left: {{{x5}}}; top: {{{y5}}};"><div>{{{area5}}}</div></div>|}}{{#if:{{{area6|}}}|<div class="marker" style="left: {{{x6}}}; top: {{{y6}}};"><div>{{{area6}}}</div></div>|}}{{#if:{{{area7|}}}|<div class="marker" style="left: {{{x7}}}; top: {{{y7}}};"><div>{{{area7}}}</div></div>|}}{{#if:{{{area8|}}}|<div class="marker" style="left: {{{x8}}}; top: {{{y8}}};"><div>{{{area8}}}</div></div>|}}{{#if:{{{area9|}}}|<div class="marker" style="left: {{{x9}}}; top: {{{y9}}};"><div>{{{area9}}}</div></div>|}}{{#if:{{{area10|}}}|<div class="marker" style="left: {{{x10}}}; top: {{{y10}}};"><div>{{{area10}}}</div></div>|}}{{#if:{{{area11|}}}|<div class="marker" style="left: {{{x11}}}; top: {{{y11}}};"><div>{{{area11}}}</div></div>|}}{{#if:{{{area12|}}}|<div class="marker" style="left: {{{x12}}}; top: {{{y12}}};"><div>{{{area12}}}</div></div>|}}{{#if:{{{area13|}}}|<div class="marker" style="left: {{{x13}}}; top: {{{y13}}};"><div>{{{area13}}}</div></div>|}}{{#if:{{{area14|}}}|<div class="marker" style="left: {{{x14}}}; top: {{{y14}}};"><div>{{{area14}}}</div></div>|}}{{#if:{{{area15|}}}|<div class="marker" style="left: {{{x15}}}; top: {{{y15}}};"><div>{{{area15}}}</div></div>|}}
 
</div>
 
</div>
|}<noinclude>
+
|}</includeonly><noinclude>
 
== Usage ==
 
== Usage ==
 
This template allows you to add markers to an image. When hovering over the marker, the name of the area will appear.
 
This template allows you to add markers to an image. When hovering over the marker, the name of the area will appear.
  
 
This template's parameters are:
 
This template's parameters are:
* <code>templatename</code> - Name of the template, without the ''Template:'' prefix. Enables the shorthand view/discussion/edit menu.
+
* <code>nobox</code> - Use <code>nobox = true</code> to remove the navbox styling around the image, including the header. Useful when putting this template into {{tl|Tabs}}. Using this setting makes <code>collapse</code> and <code>title</code> obsolete.
 
* <code>collapse</code> - Collapses the box on load. Off by default. Use <code>collapse = true</code> to collapse the box.
 
* <code>collapse</code> - Collapses the box on load. Off by default. Use <code>collapse = true</code> to collapse the box.
 
* <code>title</code> - Title of the box.
 
* <code>title</code> - Title of the box.
Line 61: Line 63:
 
  | y5 = 213px
 
  | y5 = 213px
 
}}
 
}}
 +
 +
With the <code>nobox</code> option activated, it will yield
 +
 +
{{User:TidB/Map locations
 +
| nobox = true
 +
| image = Badlands2.png
 +
| area1 = Train
 +
| x1 = 325px
 +
| y1 = 173px
 +
| area2 = Balcony
 +
| x2 = 204px
 +
| y2 = 294px
 +
| area3 = Shithouse
 +
| x3 = 680px
 +
| y3 = 286px
 +
| area4 = Valley
 +
| x4 = 416px
 +
| y4 = 277px
 +
| area5 = Hoodoo
 +
| x5 = 295px
 +
| y5 = 213px
 +
}}
 +
 +
The CSS necessary for this to work is
 +
<pre>
 +
.maploc {
 +
    width: 810px;
 +
    margin-top: 0;
 +
    margin-right: auto;
 +
    margin-bottom: 0;
 +
    margin-left: auto;
 +
}
 +
 +
.maploc div.container {
 +
    margin: 0 auto;
 +
    position: relative;
 +
    width: 800px;
 +
}
 +
 +
.maploc div.container div.marker {
 +
    background: url(../../w/images/d/d5/Map_marker.png);
 +
    cursor: pointer;
 +
    height: 31px;
 +
    position: absolute;
 +
    width: 21px;
 +
    z-index: 0;
 +
}
 +
 +
.maploc div.container div.marker div {
 +
    background-color: white;
 +
    background-image: linear-gradient( to bottom, white, #eee );
 +
    border-radius: 10px;
 +
    box-shadow: 0px 5px 5px rgba(0,0,0,0.5);
 +
    display: none;
 +
    font-size: small;
 +
    height: 20px;
 +
    left: -69px;
 +
    position: relative;
 +
    text-align: center;
 +
    top: -25px;
 +
    width: 160px;
 +
}
 +
 +
.maploc div.container div.marker:hover div {
 +
    display: block;
 +
    z-index: 1;
 +
}
 +
 +
@media screen and (max-width: 1024px) {
 +
  .maploc div.container div.marker:active div {   
 +
    display: block;   
 +
    z-index: 1;
 +
  }
 +
}
 +
</pre>

Latest revision as of 10:44, 18 September 2019

Usage

This template allows you to add markers to an image. When hovering over the marker, the name of the area will appear.

This template's parameters are:

  • nobox - Use nobox = true to remove the navbox styling around the image, including the header. Useful when putting this template into {{Tabs}}. Using this setting makes collapse and title obsolete.
  • collapse - Collapses the box on load. Off by default. Use collapse = true to collapse the box.
  • title - Title of the box.
  • image - Filename of the image to be used as the base for the map location template. The image will be automatically resized to be 800 pixels wide.
  • You can add up to 15 locations on the map. Every location is controlled by three attributes.
    • arean - Name of a given area/location.
    • xn and yn - X and Y coordinates of the map marker. The best way to get those coordinates is to copy an 800px wide version of the image you will be using, then copying the map marker file, adjusting them in the appropiate places, then getting the coordinates of the upper left corner of the marker.
  • The n in the above fields' names is to be replaced with a number from the range (1-15).

Example

{{Map locations
 | title = Badlands - Middle point
 | image = Badlands2.png
 | area1 = Train
 | x1 = 325px
 | y1 = 173px
 | area2 = Balcony
 | x2 = 204px
 | y2 = 294px
 | area3 = Shithouse
 | x3 = 680px
 | y3 = 286px
 | area4 = Valley
 | x4 = 416px
 | y4 = 277px
 | area5 = Hoodoo
 | x5 = 295px
 | y5 = 213px
}}

will yield

With the nobox option activated, it will yield

Badlands2.png
Train
Balcony
Shithouse
Valley
Hoodoo

The CSS necessary for this to work is

.maploc {
    width: 810px;
    margin-top: 0;
    margin-right: auto;
    margin-bottom: 0;
    margin-left: auto;
}

.maploc div.container {
    margin: 0 auto;
    position: relative;
    width: 800px;
}

.maploc div.container div.marker {
    background: url(../../w/images/d/d5/Map_marker.png);
    cursor: pointer;
    height: 31px;
    position: absolute;
    width: 21px;
    z-index: 0;
}

.maploc div.container div.marker div {
    background-color: white;
    background-image: linear-gradient( to bottom, white, #eee );
    border-radius: 10px;
    box-shadow: 0px 5px 5px rgba(0,0,0,0.5);
    display: none;
    font-size: small;
    height: 20px;
    left: -69px;
    position: relative;
    text-align: center;
    top: -25px;
    width: 160px;
}

.maploc div.container div.marker:hover div {
    display: block;
    z-index: 1;
}

@media screen and (max-width: 1024px) {
  .maploc div.container div.marker:active div {    
    display: block;    
    z-index: 1;
  }
}