Template:Location map many: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>Wikid77
hacking spaghetti code of nested div-sections
meta>Wikid77
added program NOTES comments, finally!!
Line 1: Line 1:
<includeonly><div style="width: {{#expr: {{{width|240}}} + 2 }}px; {{#if: {{{caption|}}}  
<includeonly><!--
-- Template for image with markers/labels (see bottom NOTES)
-->
<div style="width: {{#expr: {{{width|240}}} + 2 }}px; {{#if: {{{caption|}}}  
   | padding: 3px; border: 1px solid {{#if: {{{border|}}}  
   | padding: 3px; border: 1px solid {{#if: {{{border|}}}  
     | {{{border|none}}}  
     | {{{border|none}}}  
Line 13: Line 16:
   | {{{label}}}  
   | {{{label}}}  
   | {{PAGENAME}}  
   | {{PAGENAME}}  
}} ({{Location map {{{1}}}|name}})]]<br /><!-- ------ Marker #1
}} ({{Location map {{{1}}}|name}})]]<br /><!--
----------------------------------------------- Marker/Label #1
--><div style="position: absolute; z-index: 2; top: {{#expr:  
--><div style="position: absolute; z-index: 2; top: {{#expr:  
   100 * ({{Location map {{{1}}}|top}} - {{#if: {{{lat_deg|}}}  
   100 * ({{Location map {{{1}}}|top}} - {{#if: {{{lat_deg|}}}  
Line 51: Line 55:
   | {{{label}}}  
   | {{{label}}}  
   | {{PAGENAME}}  
   | {{PAGENAME}}  
}} ({{Location map {{{1}}}|name}})}}}</div><!-- ------ Marker 2 HUH?
}} ({{Location map {{{1}}}|name}})}}}</div><!--
--><div style="position: absolute; z-index: 2; top: {{#expr:
------------------------------------------------ Marker/Label #2
  100 * ({{Location map {{{1}}}|top}} - {{#if: {{{lat_deg|}}}
    | {{#expr: {{#ifeq: {{{lat_dir|}}}|S|-1|1}} * ({{{lat_deg|0}}} + ({{{lat_min|0}}} / 60) + ({{{lat_sec|0}}} / 3600)) }}
    | {{{lat|0}}}
  }}) / ({{Location map {{{1}}}|top}} - {{Location map {{{1}}}|bottom}}) round 1
}}%; left: {{#expr:
  {{#expr:{{#if:{{Location map {{{1}}}|crosses180}}|{{#ifeq: {{{lon_dir|}}}|W|-36000/({{Location map {{{1}}}|left}}-{{Location map {{{1}}}|right}})|}}|}}}} + 100 * ({{#if: {{{lon_deg|}}}
    | {{#expr: {{#ifeq: {{{lon_dir|}}}|W|-1|1}} * ({{{lon_deg|0}}} + ({{{lon_min|0}}} / 60) + ({{{lon_sec|0}}} / 3600)) +0.200000000000000}}
    | {{{long|0}}}
  }} - {{Location map {{{1}}}|left}}) / ({{Location map {{{1}}}|right}} - {{Location map {{{1}}}|left}}) round 1
}}%; height: 0; width: 0; margin: 0; padding: 0;"><div style="position: relative; text-align: center; {{#if: {{{marksize|}}}
  | left: -{{#expr: {{{marksize}}} / 2 round 0 }}px; top: -{{#expr: {{{marksize}}} / 2 round 0 }}px; width: {{{marksize}}}px; font-size: {{{marksize}}}px;
  | left: -{{#expr: {{#if: {{Location map {{{1}}}|marksize}}|{{Location map {{{1}}}|marksize}}|8}} / 2 round 0 }}px; top: -{{#expr: {{#if: {{Location map {{{1}}}|marksize}}|{{Location map {{{1}}}|marksize}}|8}} / 2 round 0 }}px; width: {{#if: {{Location map {{{1}}}|marksize}}|{{Location map {{{1}}}|marksize}}|8}}px; font-size: {{#if: {{Location map {{{1}}}|marksize}}|{{Location map {{{1}}}|marksize}}|8}}px;
}}">[[Image:{{#if: {{{mark|}}}
  | {{{mark}}}
  | {{#if: {{Location map {{{1}}}|mark}}|{{Location map {{{1}}}|mark}}|Red pog.svg}}
}}|{{#if: {{{marksize|}}}
  | {{{marksize}}}x{{{marksize}}}
  | {{#if: {{Location map {{{1}}}|marksize}}|{{Location map {{{1}}}|marksize}}|8}}x{{#if: {{Location map {{{1}}}|marksize}}|{{Location map {{{1}}}|marksize}}|8}}
}}px|{{#if: {{{label2|}}} <!-- ------ Label #2 sort-of -->
  | {{{label2}}}
  | {{PAGENAME}}
}}]]</div>{{#ifeq: {{{position|}}} | none
  |
  |<div style="font-size: {{{label2_size|90}}}%; line-height: 110%; position: relative; top: -1.5em; width: 6em; {{#switch: {{{position}}}
    |left = left: -6.5em; text-align: right;
    |right = left: 0.5em; text-align: left;
    |top = top:-2.65em; left:-3em; text-align: center;
    |bottom = top:-0.15em; left: -3em; text-align: center;
    |left: 0.5em; text-align: left;
  }}"><span style="padding: 1px; {{#if: {{{background|}}}
    | background-color: {{{background}}};
  }}">{{{label2|}}}</span></div>
}}</div><!--
------------------------------------------------------ Marker #2
--><div style="position: absolute; z-index: 2; top: {{#expr:  
--><div style="position: absolute; z-index: 2; top: {{#expr:  
   100 * ({{Location map {{{1}}}|top}} - {{#if: {{{lat2_deg|}}}  
   100 * ({{Location map {{{1}}}|top}} - {{#if: {{{lat2_deg|}}}  
Line 121: Line 91:
   }}">{{{label2|}}}</span></div>
   }}">{{{label2|}}}</span></div>
}}</div><!-- end #2
}}</div><!-- end #2
------------------------------------------------------ Marker #3
-------------------------------------------------- Marker/Label #3
--><div style="position: absolute; z-index: 2; top: {{#expr:  
--><div style="position: absolute; z-index: 2; top: {{#expr:  
   100 * ({{Location map {{{1}}}|top}} - {{#if: {{{lat3_deg|}}}  
   100 * ({{Location map {{{1}}}|top}} - {{#if: {{{lat3_deg|}}}  
Line 156: Line 126:
   }}">{{{label3|}}}</span></div>
   }}">{{{label3|}}}</span></div>
}}</div><!-- end #3
}}</div><!-- end #3
--></div></includeonly><noinclude>{{/doc}}
--></div></includeonly><noinclude><!--
--
-- NOTES:
--  This code generates an HTML division to show the map image,
--  overlayed with a marker-image division & label division,
--  for each pair of the marker/label points.
--
--  The "map image" can be any image, allowing markers/labels
--  to annotate any picture.  Set marksize=0 to show labels only.
--
--  [ These comments take < 1 second per 5,000 comment lines. ]
--  [ Be sure to close comments: primitive editors don't check. ]
--
--HISTORY:
-- 06Sep07 Created/debugged to allow 3 markers.
-->
{{/doc}}


[[Category:Graphic templates]]
[[Category:Graphic templates]]
[[Category:Mapping templates]]
[[Category:Mapping templates]]
</noinclude>
</noinclude>

Revision as of 10:53, 6 September 2007