Page MenuHomePhabricator

Vector skin does not support jsMsg() javascript function
Closed, ResolvedPublic

Description

The vector skin does not support the jsMsg javascript function (which is defined in wikibits.js). This causes the "This page has been watched" message, "this page has been flagged" message, etc not to appear (as well as breaking some custom user js). To fix, an empty div with the id "mw-js-message" should be added somewhere near where the sitenotice is.

Thanks,
[[n:user:Bawolff]]


Version: 1.13.x
Severity: minor

Details

Reference
bz19546

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:39 PM
bzimport set Reference to bz19546.

Amalthea.wikimedia wrote:

That's how Modern does it. Some other skins like Monobook created the div dynamically, using the following code from wikiBits:

if ( document.getElementById( 'column-content' )
&& document.getElementById( 'content' ) ) {
  // MonoBook, presumably
  document.getElementById( 'content' ).insertBefore(
    messageDiv,
    document.getElementById( 'content' ).firstChild
  );
} else if ( document.getElementById('content')
&& document.getElementById( 'article' ) ) {
  // Non-Monobook but still recognizable (old-style)
  document.getElementById( 'article').insertBefore(
    messageDiv,
    document.getElementById( 'article' ).firstChild
  );
}

That's of course ugly enough. I think the best way would be to change the "Monobook, presumably" way to always insert the message div right before the #top element. Or better yet, do that and change all skins so that they *have* a #top element (which would be useful in any case) and remove the skin branching from wikibits.js.

(In reply to comment #1)

That's how Modern does it. Some other skins like Monobook created the div
dynamically, using the following code from wikiBits:

if ( document.getElementById( 'column-content' )
&& document.getElementById( 'content' ) ) {
  // MonoBook, presumably
  document.getElementById( 'content' ).insertBefore(
    messageDiv,
    document.getElementById( 'content' ).firstChild
  );
} else if ( document.getElementById('content')
&& document.getElementById( 'article' ) ) {
  // Non-Monobook but still recognizable (old-style)
  document.getElementById( 'article').insertBefore(
    messageDiv,
    document.getElementById( 'article' ).firstChild
  );
}

That's of course ugly enough. I think the best way would be to change the
"Monobook, presumably" way to always insert the message div right before the
#top element. Or better yet, do that and change all skins so that they *have* a
#top element (which would be useful in any case) and remove the skin branching
from wikibits.js.

Fixed this logic to do proper skin detection in r52821.

herd wrote:

Fixed this logic to do proper skin detection in r52821.

Yes the original code was bad, but this is worse. >_<

This presumably breaks it in chick, myskin, and simple, as well as any other user-defined monobook+template skins, which use the same HTML as Monobook (and are basically "Monobook" skins), but have a different name. You shouldn't rely on a js-based skin-name check, but fix the underlying problems with vector. Or do what the code suggests:
We special-case skin structures provided by the software. Skins that
choose to abandon or significantly modify our formatting can just define
// an mw-js-message div to start with.

  • Bug 19486 has been marked as a duplicate of this bug. ***

herd wrote:

(In reply to comment #5)

Done better in r52849

Sweet!