ACQ INC M15Launch EN.jpg


From Neverwinter Wiki
Jump to: navigation, search

Current status[edit source]

The tooltip system described on this page is currently active, but is a beta feature. Please report any issues you may encounter on the talk page.

Normally, tooltip systems on wikis draw their data from data mining sites, but it sounds unlikely that there will be any of these for Neverwinter. Instead, we're looking at setting up a tooltip system that will draw its data from the wiki itself.

Setting up tooltip data[edit source]

On the main content page[edit source]

To enable the tooltip system to more smoothly load data, tooltip data should not be included directly on their associated pages. Instead, include {{Tooltip section}} on the main page for an item, ability, or other entity that has a tooltip.

Example[edit source]
{{Infobox item
  |class=<div>[[Trickster Rogue]]</div>
  |value=1 {{copper}}
}}[[File:Soiled Tunic.jpg|thumb|right|280px|A female [[Tiefling]] [[character|player character]] wears the Soiled Tunic.]]
A '''Soiled Tunic''' is the first chest armor piece acquired by Trickster Rogues.

{{Tooltip section}}

*[[Signs of Life]]: found during quest

If the tooltip data page doesn't currently exist, the tooltip section will automatically display a link and instructions for creating the page. Otherwise, it will display the actual tooltip data and a link for editing it.

Creating the data page[edit source]

For a given page, its data page is included on the "/Tooltip" subpage. For example, the tooltip data for Help:Tooltips example is at Help:Tooltips example/Tooltip.

Once the page is open for editing, add this to the page:

{{ {{#if:{{{1|}}}|{{{1}}}|Tooltip page box}}
|body=<div>first line</div>
<div>second line</div>
...and so on...

Add the tooltip content between |body= and the }} at the bottom.

The title[edit source]

Normally, the |title= line can be left as is. But assume that you're creating a page for an item called "Unstoppable Force" and there is a quest also called "Unstoppable Force". Thus, you've had to name the item page "Unstoppable Force (weapon)". The tooltip will end up displaying "Unstoppable Force (weapon)", which won't match the in-game text.

To fix this, change the |title= line to |title=Unstoppable Force. The title will still appear incorrectly while the data is loaded, but it will be corrected as soon as the data loads.

Tooltip content style guidelines[edit source]

Class Example Code Output
white <span class="white">Example</span>
gray <span class="gray">Example</span>
slate <span class="slate">Example</span>
blue <span class="blue">Example</span>
violet <span class="violet">Example</span>
purple <span class="purple">Example</span>
pink <span class="pink">Example</span>
red <span class="red">Example</span>
beige <span class="beige">Example</span>
orange <span class="orange">Example</span>
gold <span class="gold">Example</span>
topaz <span class="topaz">Example</span>
yellow <span class="yellow">Example</span>
green <span class="green">Example</span>
olive <span class="olive">Example</span>
darkgreen <span class="darkgreen">Example</span>

Tooltip content has some differences in style guidelines from regular page content because the tooltips are meant to emulate the in-game look.

  • Don't use links in tooltip content.
    • They are usually redundant on the pages where the tooltip appears, and when the tooltip is displayed when hovering over a link, the links in the tooltip can't be used anyway. Usually, the only thing they do is disrupt the formatting.
  • For the same reason, don't use the {{item}} template. That template is intended for regular page content only.
  • Don't define custom colors. Use the color classes to the right to help maintain consistency across the wiki.
    • if there are missing colors, please provide a screenshot on the talk page of a tooltip with the missing color and we'll add it as soon as possible.

Common Elements[edit source]

Common elements present in tooltips may include any of the following.

<div class="right">{{boe}}</div> or <div class="right">{{bop}}</div>

<div>474-580 Damage</div>

{{green|Equip:}} {{white|+11}} AC <br>
{{green|Equip:}} {{white|+427}} Power <br>
{{green|Equip:}} {{white|+427}} Critical Strike <br>
{{green|Equip:}} {{white|+315}} Recovery <br>
{{green|Equip:}} {{white|+266}} Defense<br>

<div class="slot">Defense Slot: Empty</div>
<div class="slot">Offense Slot: Empty</div>
<div class="slot">Utility Slot: Empty</div>
<div class="eslot">Armor Enhancement Slot: Empty</div><br>
<div class="eslot">Weapon Enhancement Slot: Empty</div><br>

<div>Requires Class: Devoted Cleric</div>
<div>Requires Level: 60</div><br>
<div class="right">{{gold}}1 {{silver}}60 {{copper}}43</div>

Updating tooltip data[edit source]

All you have to do is edit the tooltip page as you would any other wiki page. Just maintain the correct structure.

Displaying the hover tooltips[edit source]

Once you've done the above, there's nothing more you need to do. But note that the system requires Javascript to function. You won't see any hover tooltips if you have Javascript disabled. For those of you using a NoScript extension, the Javascript in question comes from

Caching[edit source]

But note that the tooltip system only looks for links that need tooltips when you load a page. If a tooltip page is added for an page that didn't previously have one, you need to refresh the page.

Also, the tooltip system caches data in your browser when it first loads it on a page. When you hover over a link to a page with tooltip data, the system tries to load it then. For example, if there is a link on "Unstoppable Force (quest)" to "Unstoppable Force (weapon)", the first time you hover the cursor over any link to "Unstoppable Force (weapon)", it will load the data for "Unstoppable Force (weapon)" and cache it in the page. You won't see any changes until you refresh or in some other way reload the page to clear its cache.

The cache is specific not just to which page you have loaded, but is also limited to the tab or window the page is opened in. If you have "Unstoppable Force" open in two different tabs, each has its own cache for tooltip data.

Using tooltip data in pages[edit source]

You can display tooltips in pages by treating the tooltip data pages like templates. For example, to show a tooltip for Unstoppable Force (weapon), you'd just include the following in a page:

{{:Unstoppable Force (weapon)/Tooltip}}

If the tooltip page has been correctly created, it will automatically use {{Tooltip page box}} to layout the data.

You can specify a different template if you wish. This works as follows:

{{:Unstoppable Force (weapon)/Tooltip | Tooltip float right}}

to use {{Tooltip float right}} instead, which places the tooltip at the right and causes page content to wrap around it.

Framework[edit source]

The tooltip system is mostly comprised of Javascript located on MediaWiki:Common.js, but {{Tooltip hover box}} and {{Tooltip hover box loading}} are used to format the data. There are also styles in MediaWiki:Hydradark.css that affect the appearance of tooltips and their contents.