1

Starting somewhere around Semantic MediaWiki version 1.0* certain errors stopped being reported as text, and were replaced with a yellow triangular warning icon (Semantic MediaWiki error.png) with the error text in a rollover tooltip.

(Image from: http://semantic-mediawiki.org/w/extensions/SemanticMediaWiki/skins/images/warning.png)

Is there a way to change this behavior to show the text instead?

* http://semantic-mediawiki.org/wiki/Help:Upgrading_from_0.7_to_1.0

Edit: Here's an example of the HTML in which this icon appears:

<span class="smwttpersist"><span class="smwtticon">warning.png</span>
<span class="smwttcontent"><ul>
<li>Some subquery has no valid condition.</li></ul></span></span>

I'd prefer a toggle in a prefs file somewhere, but a JavaScript workaround would also be welcome.

Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
meetar
  • 7,443
  • 8
  • 42
  • 73

1 Answers1

1

It is fairly easy to transform tooltips to normal text with javascript, e. g.:

$(function() {
    $('img[src$="warning.png"]').each(function() {
        var tooltip = $(this).attr('title');
        $(this).after($('<span>').text(tooltip));
    });
});

If it is not a normal tooltip (title attribute) but something more fancy, then it is usually enough to just override the CSS with something like:

.tooltip-class {
    display: inline;
    position: static;
    border: 0;
    padding: 0;
    background-color: transparent;
}

You can use the wiki page MediaWiki:Common.js for placing javascript and MediaWiki:Common.css for CSS code.

Tgr
  • 27,442
  • 12
  • 81
  • 118
  • The simplest way to add custom javascript is modifying the wiki page `MediaWiki:Common.js` is . – Tgr May 02 '12 at 07:12
  • Thanks! Sadly this isn't working for me – the tooltip appears to be a custom span which only appears after the icon is clicked, rather than a typical browser "title" attribute that pops up on a hover. I'll add an example to the question. – meetar May 02 '12 at 21:19
  • That makes it simpler, you just need to override the CSS to make it appear as plaintext instead of a tooltip. It is hard to be more specific without seeing an example, though. – Tgr May 03 '12 at 20:34
  • I added example in the question – are you thinking custom CSS, or is this also something you could do with JavaScript? – meetar May 03 '12 at 21:27
  • Custom CSS. You could probably do it with javascript too, but that is more fragile and more complicated. I meant a live example - the right CSS rules to change could probably be found if one went through all the CSS files in SMW, but that is a lot of effort, and the same takes just a few seconds with a live example and Firebug. – Tgr May 03 '12 at 21:57
  • Okay, I think that gives me enough to go on - if you update your answer with the above I'll accept that! – meetar May 03 '12 at 22:52