Modèle:Icon : Différence entre versions

De Lotro-wiki
Sauter à la navigation Sauter à la recherche
(Page créée avec « <includeonly><span style="font-size: {{#switch:{{{size|{{{3}}}}}} |1=1.4 |2=1.2 |4=0.85 |3 |#default=1}}em;"><!-- Explanations: "right" : minus the icon size "bottom": ... »)
 
 
Ligne 1 : Ligne 1 :
<includeonly><span style="font-size:  
+
<noinclude>
{{#switch:{{{size|{{{3}}}}}}
+
;Description
|1=1.4
+
:Creates an item icon with a stack count overlay.
|2=1.2
+
;Syntax
|4=0.85
+
:{{t1link|Icon|icon<nowiki>>
|3
+
|<</nowiki>stack<nowiki>>
|#default=1}}em;"><!--
+
|<</nowiki>size<nowiki>>
 
+
|<</nowiki>size<nowiki>=>
Explanations:  
+
|<</nowiki>float<nowiki>=>
"right" : minus the icon size
+
|<</nowiki>margin<nowiki>=</nowiki>}}
"bottom": minus the icon size -3px, as the ancestor element moves the child element (the numbers) a few (~3) pixels to the top
+
;Example
 
+
:<nowiki>{{Icon</nowiki>
-->{{#if: {{{2|}}} | <span style="position: absolute"><span style="z-index:1; position: absolute; {{#switch:{{{size|{{{3}}}}}}
+
::|<nowiki>Pure Athelas Extract-icon</nowiki>
|1 = right: -64px; bottom: -67px;
+
::|<nowiki>5</nowiki>
|2 = right: -48px; bottom: -51px;
+
:<nowiki>}}</nowiki>
|4 = right: -24px; bottom: -27px;
+
;Result
|3
+
:{{Icon|Pure Athelas Extract-icon|5}}{{clrl}}
|#default = right: -32px; bottom: -35px;
+
;Template
}}" class="icon-stack">{{{2|}}}</span></span>}}<!--
+
:</noinclude><div style="position: relative; float: {{{float|left}}}; margin: {{{margin|0.3em}}}; font-size: {{#switch:{{{size|{{{3}}}}}}|1=1.4|2=1.2|3=1|4=0.85|1.4}}em;">[[Image:{{{1|-icon}}}.png|{{#switch:{{{size|{{{3}}}}}}|1=64|2=48|3=32|4=24|{{{width|64}}}}}x{{#switch:{{{size|{{{3}}}}}}|1=64|2=48|3=32|4=24|{{{height|64}}}}}px]]<span style="position: absolute; {{#switch:{{{size|{{{3}}}}}}|1=bottom: 0.2em; right: 0.5em;|2=bottom: 0.15em; right: 0.4em;|3=bottom:0.1em; right: 0.4em;|4=bottom: -0.1em; right: 0.4em;|bottom: 0.2em; right: 0.5em;}} color: #000; font-weight: bold;"><span style="position: relative; left: 1px; top: 1px;">{{{2|}}}</span></span><span style="position: absolute; {{#switch:{{{size|{{{3}}}}}}|1=bottom: 0.2em; right: 0.5em;|2=bottom: 0.15em; right: 0.4em;|3=bottom: 0.1em; right: 0.4em;|4=bottom: -0.1em; right: 0.4em;|bottom: 0.2em; right: 0.5em;}} color:gold; font-weight: bold;">{{{2|}}}</span></div><noinclude>
 
 
We check if the icon file exists in the Media (not, File!) namespace and if not
 
* we replace the icon with "File:-icon.png"
 
* add the template {{IN}} into the [[File]] tag (yes, this works for categories!)
 
* link the icon to the supposed-to-be icon page, if the parameter {{{link}}} has NOT been specified
 
 
 
-->[[File:{{#ifexist: {{ns:-2}}:{{{1|}}}.png | {{{1|}}}.png | -icon.png {{!}} {{IN}} {{#if: {{{link|}}} | | {{!}} link={{ns:6}}:{{{1|}}}.png }} }}|{{#switch:{{{size|{{{3}}}}}}
 
|1=64
 
|2=48
 
|4=24
 
|3
 
|#default=32}}px|{{#if: {{{link|}}} | link={{{link}}} }} {{#if: {{{float|}}} | {{!}}{{{float}}} }}]]</span>
 
</includeonly><noinclude>
 
{{Icon/doc}}
 
 
[[Category:Item Templates|Icon]]
 
[[Category:Item Templates|Icon]]
 
</noinclude>
 
</noinclude>

Version actuelle datée du 20 mai 2013 à 22:33

Description
Creates an item icon with a stack count overlay.
Syntax
{{Icon|<icon> |<stack> |<size> |<size=> |<float=> |<margin=>}}
Example
{{Icon
|Pure Athelas Extract-icon
|5
}}
Result
Modèle:Clrl
Template