Template:ItemBox: Difference between revisions

applied new style by User:TheMilkMan
Vergir (talk | contribs)
Make the name area a query container so the measured name size can be emitted in cqw (with help from vergir-bot LLM)
 
(39 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<templatestyles src="Template:ItemBox/styles.css"/><includeonly><!--
<templatestyles src="Template:ItemBox/styles.css" /><includeonly>
-->{{#vardefine:item_key_or_en|{{{item_name|{{{1}}}}}}}}<!--
 
-->{{#vardefine:tier|{{#invoke:ItemData|get_prop|{{#var:item_key_or_en}}|Tier}}}}<!--
{{#vardefine:itemName|{{{itemName|{{{1}}}}}}}}<!--
--><div class="HeroCard2" style="transition:0.1s transform ease-in-out;display:inline-block; margin-left:5px; border-radius:9px;">
 
{|- style="font-family:'Retail Demo Regular',serif; text-align:center; border-collapse:collapse; width:100px !important; position:relative;"
    Display name: Lang string for the codename, else the raw name, then override.
|<span class="item-link-wrapper" data-item-name="{{{item_name|{{{1}}}}}}"><div style="position:absolute; z-index:0; transform-origin: top; transform: scale(1, 1.1);">[[File:{{#invoke:ItemData|get_prop|{{#var:item_key_or_en}}|Slot}} Card T{{#var:tier}}.png|100px|link={{#if:{{{link|}}}|{{{link}}}|{{{item_loc|{{{item_name|{{{1}}}}}}}}}}}]]</div></span><!--
-->{{#vardefine:displayName|{{#invoke:Lang|get_string|{{#invoke:ItemData|get_codename|{{#var:itemName}}}}}}}}<!--
--><div style="position:relative; pointer-events:none;"><!--
-->{{#vardefine:displayName|{{#if:{{#var:displayName}}|{{#var:displayName}}|{{#var:itemName}}}}}}<!--
--><div class="paper-texture tex-1" style="position:absolute; z-index:5; mix-blend-mode:multiply; opacity:0.9;">[[File:Card PaperTexture 1.png|100px|link=]]</div><!--
-->{{#vardefine:displayName|{{{overrideDisplayName|{{#var:displayName}}}}}}}<!--
--><div class="paper-texture tex-2" style="position:absolute; z-index:5; mix-blend-mode:multiply; opacity:0.9;">[[File:Card PaperTexture 2.png|100px|link=]]</div><!--
 
--><div class="paper-texture tex-3" style="position:absolute; z-index:5; mix-blend-mode:multiply; opacity:0.9;">[[File:Card PaperTexture 3.png|100px|link=]]</div><!--
    Measured name size (cqw) and stable per-item texture variety.
--><div class="paper-wear wear-1" style="position:absolute; z-index:6; mix-blend-mode:overlay; opacity:1; filter: sepia(70%)">[[File:Card PaperWear 1.png|100px|link=]]</div><!--
-->{{#vardefine:fontSize|{{#invoke:ItemBox|getFontSize|{{#var:displayName}}}}}}<!--
--><div class="paper-wear wear-2" style="position:absolute; z-index:6; mix-blend-mode:overlay; opacity:0.8; filter: sepia(70%)">[[File:Card PaperWear 2.png|100px|link=]]</div><!--
-->{{#vardefine:variants|{{#invoke:ItemBox|variants|{{#var:itemName}}}}}}<!--
--><div class="paper-wear wear-3" style="position:absolute; z-index:6; mix-blend-mode:overlay; opacity:1; filter: sepia(70%)">[[File:Card PaperWear 3.png|100px|link=]]</div><!--
 
--><div class="paper-wear wear-4" style="position:absolute; z-index:6; mix-blend-mode:overlay; opacity:1; filter: sepia(70%)">[[File:Card PaperWear 4.png|100px|link=]]</div></div>
    Modifier classes: slot (Weapon/Armor/Tech from data, or Weapon/Vitality/Spirit override -> weapon/vitality/spirit), tier, tags.
|- style="text-align:center; position:relative; pointer-events:none;"
-->{{#vardefine:slot|{{#switch:{{{overrideSlot|{{#invoke:ItemData|get_prop|{{#var:itemName}}|Slot}}}}}|Weapon=itembox-weapon|Armor|Vitality=itembox-vitality|Tech|Spirit=itembox-spirit}}}}<!--
| <span class="item-card-icon" style="transition:0.1s transform ease-in-out; position:relative; bottom:-1px;">[[File:{{{item_name|{{{1}}}}}}.png|96px|link=]]</span>{{#if:{{{ignore|}}}||{{#ifeq: {{#invoke:ItemData|is_active|{{{item_name|{{{1}}}}}}}}|true|<div style="position:relative; display:flex; justify-content:center; align-items:center; z-index:6;"><div style="background-color:#161A13; color:#FFFFF5; border-radius:3px; padding:2px 2px; font-size:12px; margin:0; width:48px; height:16px; position:absolute; bottom:-9px; line-height:15px; letter-spacing:-0.5px; font-family:'Retail Demo Regular', serif;">'''ACTIVE'''</div></div>}}}}
-->{{#vardefine:tier|itembox-tier-{{{overrideTier|{{#invoke:ItemData|get_prop|{{#var:itemName}}|Tier}}}}}}}<!--
|- style="height:55px; font-size:14px; font-family:'Retail Demo Regular'; line-height:18px; position:relative; z-index:1; pointer-events:none; {{#ifexpr:{{#var:tier}} > 3|{{#switch: {{#invoke:ItemData|get_prop|{{#var:item_key_or_en}}|Slot}}
-->{{#vardefine:showTierTag|{{#ifeq:{{{showTierTag|}}}|true|itembox-show-tier}}}}<!--
| Weapon = color: #e2c5a1 !important;
-->{{#vardefine:isActive|{{{overrideIsActive|{{#invoke:ItemData|is_active|{{#var:itemName}}}}}}}}}<!--
| Armor = color: #b8dcc4 !important;
-->{{#vardefine:isActive|{{#ifeq:{{#var:isActive}}|true|itembox-active}}}}<!--
| Tech = color: #ccbfda !important;
-->{{#vardefine:isImbue|{{{overrideIsImbue|{{#invoke:ItemData|get_prop|{{#var:itemName}}|IsImbue}}}}}}}<!--
| color: #000000;}}|color: #11140e; !important}}"
-->{{#vardefine:isImbue|{{#ifeq:{{#var:isImbue}}|true|itembox-imbue}}}}<!--
! style="padding: 0 4px;" |{{{item_loc|{{{item_name|{{{1}}}}}}}}}
 
|}</div></includeonly><noinclude>{{Documentation}}</noinclude>
    lowGraphics=true is for callers that place dozens of cards on one page (the
    card navboxes). It swaps the paper texture from the normal-mode multiply,
    which blends two images and so is re-rasterised every scrolled frame, to a
    transparent-paper overlay that is a single cacheable image. On the profiled
    navbox this took the render thread's OpenGL work from ~230 ms/s to ~10 and
    roughly doubled the frame rate. The wear and icon masks are clips of a
    single image, not blends, so they cache once rasterised and stay at full
    detail. The overlay itself is defined in [[Template:ItemBox/styles.css]] and
    keyed off the same per-item texture-vN class, so a card keeps its paper
    across both modes.
-->{{#vardefine:lowGraphics|{{#ifeq:{{{lowGraphics|}}}|true|itembox-lowgfx}}}}<!--
 
    Links.
-->{{#vardefine:linkTooltip|{{{overrideLinkTooltip|{{#var:itemName}}}}}}}<!--
-->{{#vardefine:linkImage|{{{overrideLinkImage|{{#var:itemName}}}}}}}<!--
-->{{#vardefine:linkClick|{{{overrideLinkClick|{{#var:itemName}}{{If lang}}}}}}}<!--
 
--><div class="itembox {{#var:showTierTag}} {{#var:tier}} {{#var:slot}} {{#var:isActive}} {{#var:isImbue}} {{#var:variants}} {{#var:lowGraphics}}" style="font-size:{{#expr: 10 * {{#if:{{{size|}}}|{{{size}}}|1}} }}px;">
<div class="itembox-background">
<div class="itembox-card">
<div class="itembox-icon-area">
<div class="itembox-icon">[[File:{{#var:linkImage}}.png|160px|link=]]</div>
<div class="itembox-tier-badge">
<div class="itembox-tier-badge-shadow"></div>
<div class="itembox-tier-badge-fill"></div>
<div class="itembox-tier-badge-number"></div>
</div>
<div class="itembox-imbue-tag">{{#invoke:Lang|get_string|item_info_imbue}}</div>
</div>
<!-- container-type is inline because TemplateStyles strips it; the name's cqw size measures against this box. -->
<div class="itembox-name-area" style="container-type: inline-size;">
<p class="itembox-name" style="font-size:{{#var:fontSize}};text-wrap:balance;">{{#var:displayName}}</p>
</div>
<div class="itembox-wear"></div>
<div class="itembox-texture"></div>
<div class="itembox-bevel"></div>
<div class="itembox-active-tag">{{#invoke:Lang|get_string|item_info_active}}</div>
<div class="itembox-outline"></div>
</div>
</div>
<div class="item-link-wrapper" data-item-name="{{#var:linkTooltip}}">[[{{#var:linkClick}}|<span></span>]]</div>
</div></includeonly><noinclude>{{Documentation}}</noinclude>