Template talk:Effecttip

From Warcraft Wiki
Jump to navigation Jump to search

extension or no extension

{{Tooltip}} requires no extension on the icon name. This template does. --Eirik Ratcatcher (talk) 23:15, 2 April 2009 (UTC)

Making this a tooltip

Would it be possible to make this display as a tooltip when incoming links are hovered, as item and abilities do now? I realize this is used as a sub-template in many places so that's not always appropriate, but perhaps either a check to see if thats the only "tip" that could be displayed, a parameter to toggle tooltip-style display, or a wrapper template? Making the tooltip be the ability tip makes sense for player spells, but there are a number of server-side "spells" for which it's really the buff that's relevant (e.g. [Silithyst]). Take a look at the "Holiday Specific" section of Reputation#Reputation bonuses - that is a sea of dull blue links instead of the buff tooltips that should be available.

[Gaze of the Black Prince] cheats around this by treating it as a "passive ability". That pretty much works, although the formatting isn't quite the same, especially for debuffs. Bottom line is, we already have a template for "effects" - let's use those to their fullest!

In my opinion, this is the only thing other than items and abilities that really needs tooltipification, which makes it all the more frustrating...that "we're soo close" feeling haha. - jerodast (talk) 20:02, 24 August 2014 (UTC)

It would be possible, and you should totally do it. :) — foxlit (talk) 20:53, 29 August 2014 (UTC)
Well, unlike templates and other things that seem like basic parts of mediawiki, getting things on one page to show up in special javascript effects on other pages seemed like it would require some sort of special access or coding :) If it's simpler than it sounds, than point me in the right direction! But looking at (for instance) {{Infobox ability}}'s source, I do not have a clue which part to drill down on to figure out how to make that happen, hence my request :P Hell, I don't even know what to call this feature ("incoming link hover tooltips"?) since we already call static on-page infobox sections "tooltips" since they look like WoW tooltips... - jerodast (talk) 02:21, 30 August 2014 (UTC)
So there are four questions to investigate:
  1. How to make a link that displays content from the linked page when moused over. Perhaps the easiest example of this is {{achievement}}, which produces e.g.  Multichromatic Test Item.
  2. How to display content from {{effecttip}} when hovering over a link to the article using it; currently,  The Spirit of Sharing displays no tooltip. See e.g. {{currencytip}}, {{proftip}}, {{talenttip}}.
  3. How to make [[plain links]] use the tooltip-enabling formatting by default; see Help:DefaultLinks.
  4. How to add all that to effecttip without causing extraneous tooltips or incorrect link formatting for ability articles.
kd3 also has a guide to wowpedia's tooltip implementation that may be helpful.— foxlit (talk) 16:19, 30 August 2014 (UTC)
I imagine you may have already put together what I've been working on, but let me just reply to you here :) First of all, thanks for all the info! Just knowing I was looking for DefaultLink was very helpful, as was kd3's little guide. I think my new version of effecttip at User:Jerodast/Effecttip is pretty good, and I suspect you already know I used Sandbox (displayed as Sandbox) to test it out. Feel free to take a look...I still have a couple questions which I will jot down here shortly :) - jerodast (talk) 20:44, 3 September 2014 (UTC)
Okay. So just to overview what I've done, I first noticed there was already a ttc ("tool tip content") parameter in this template but it didn't seem to be used on any page. It was also set up a little weird so I changed it to basically just add "tooltip-content" to the div's classes when the parameter was set. Seemed to work with a manual ajaxttlink span. Then I modified defaultlink code from {{achievementtip}} and stuck it at the end of the effecttip, also conditional on that parameter. Looking at Sandbox, seems to work. Most recently I added some non-critical logic about when and when not to use "tooltip-content" and DEFAULTLINK, which might make rollout easier.
In terms of pushing the functionality out, there is a clear pattern as to which pages want effecttip to be their tooltip and which don't: if it's floating right, then probably tooltip, otherwise something else is probably the tooltip. There are about 200 pages that use effecttip so I haven't checked them all, but I DID check all the templates that use effecttip, and none of them have float=right, so they should be unaffected by the hovertipification. So right now that logic is in my draft. If you go a couple edits back, you'll see the simpler logic that doesn't look at floats, only that ttc parameter. (With the complex logic, ttc can be used to explicitly opt in or out. I have tested the 9 combinations of float=left/right/blank and ttc=no/yes/blank and they all look as they should.)
Whatever version we go with, I see 200 pages effecttip is actually used on, so that's a preeetty manageable project for me to take on to either manually set any parameters that need setting, or hopefully just check that everything looks as it should after we go with the smarter-but-slightly-more-confusing logic. I realize a script is a possibility, but frankly I would want to look through the results myself anyway for any page-specific quirks, and I'm not sure I really want to spend the time figuring out how all THAT works just now :P
SO, mainly I just wanted someone to take a look at the code (not terribly long) before I put in the changes, since I know it's used in a number of critical infoboxes. But I did have a few extra questions:
  1. Does defaultlinks provide a way to simply check if a defaultlink is already defined on the page?
    • No.
  2. Should effecttip use "silent" with defaultlinks? Achievementtip and itemtip both use it. The rest don't.
    • Those templates are sometimes used in the User: namespace for fan-created content; "silent" suppresses the "you can't use that here!" warning on those pages. We probably should be using it everywhere, but until someone actually complains about those warning messages being in places they shouldn't be, I'm indifferent to it.
  3. I notice none of the defaultlink icons are part of the hover link. When I experimented trying to put the icon inside the link, it basically broke it, but I wasn't sure if I just mismatched braces somewhere. Is that a MediaWiki limitation?
    • Yes; you can't use the image-embedding syntax within a link caption. {{cost}}/{{costitem}} do provide an example of working around this, but it's okay that only the text is clickable/hoverable here.
  4. When I search "effecttip ttc" (without quotes) and get no results besides effecttip itself, that means the ttc parameter isn't used anywhere on the wiki, right?
    • Not necessarily; it's just difficult to search code.
  5. Is there a way to search for pages that use specific parameters of a template? With certain values?
    • Generally, there's no passive way to search for these types of things; see 7.
  6. Trying to analyze current usage of effecttip, I was looking for the exclusionary search terms that Google et al offers, like "effecttip -questbox" to filter out quest pages. Is that possible on MediaWiki? How about filtering out by category? I didn't see anything along those lines at http://www.mediawiki.org/wiki/Help:Searching .
    • I don't think this is possible; the search index is probably not aware of category structures. You could probably use the mediawiki API and some custom code to perform the intersection/union logic.
  7. Same vein: [Silithyst] used to be set up as an abilitybox but with no class defined (since it's a server-triggered effect). I'd like to find others in that sorry state (already found one manually) and make them effecttips as they should be, but can't think how without nice search filtering. Any advice?
  8. {{Achievementtip}} uses {{{data-source|{{PARENTNAME}}}}}. I left it like that since it didn't seem to break anything, but I'm not sure what all goes on with UsingData. Should I care about that? How about the fact that itemtips all use #data:? Don't worry about it?
    • Help:UsingData might provide some background; in general, #data:/#using: replace the old onlyinclude/tpl style of transcluding page content, which was primarily useful for embedding item tooltips in other pages (loot/quest rewards). Unless {{effecttip}} is already wrapped in <onlyinclude> and transcluded, you don't have to use #data:.
    • Both the parameter and the magic word are a replacement for the |disambigpage= parameter (the transcluded tooltip needs to know which page to link to, as it's not always the item/achievement/quest name).
    • {{{data-source}}} is only special if the template is called via the #data: or #using: parser functions, in which case it contains the title of the page the data stems from; otherwise, it is an ordinary template parameter (undefined most of the time).
    • {{PARENTNAME}} is the title of the page calling the template. If effecttip is called through {{Infobox ability}}, it would be Template:Infobox ability.
  9. Is there a better parameter name than "ttc"? It's not very descriptive, yet I can't really think of a good substitute.
    • I like kd3's approach of using |inner= in calling templates to suppress tooltip-content/defaultlink; it seems simpler than conditioning on |float=/|ttc=. If it turns out that |ttc= isn't used, you could remove it outright.
  10. Got any better formatting ideas for the link itself? Buffs aren't linkable in WoW so brackets didn't seem appropriate. Maybe this is enough.
    • Treat them as spells; they can probably be linked from the combat log.
Thanks again for teh guidance! Even if I am half convinced you prodded me to do it myself so I would be impressed that YOU wrote the damn extensions :P - jerodast (talk) 03:24, 4 September 2014 (UTC)
Your code looks sane to me; it might be worth going through the css styles and classes and removing those that do not actually have any impact. — foxlit (talk) 13:28, 4 September 2014 (UTC)