https://bugzilla.wikimedia.org/show_bug.cgi?id=19559
Summary: JS addPortletLink() should perhaps have vector specific
code in order to be compatible
Product: MediaWiki
Version: 1.13-svn
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: Normal
Component: Vector Skin
AssignedTo: [email protected]
ReportedBy: [email protected]
Very similar to Bug 19531 . Basically, Vector changes the portlet structure of
the html, thus making the javascript function addPortletLink() not work as
expected in some cases. Perhaps there should be some special case code in the
function to make it compatible with vector in so much that it would behave in
the way most closey to that as it would on monobook.
For example if in vector, addPortletLink() should do the following:
if the portlet id is namespaces or views it should wrap the new portlet link
in a span
if on vector, and portlet id is 'p-personal' it should make it go to the id
'personal'
if on vector, and portlet id is 'p-cactions' it should make it go to id
'actions' (as thats the closest)
Modifying the function from wikibits as follows would accomplish that:
function addPortletLink(portlet, href, text, id, tooltip, accesskey, nextnode)
{
var wrapSpan = false; //default
if (skin === "vector") {
if (portlet === "namespaces" || portlet === "views") {
wrapSpan = true;
}
else if (portlet === 'p-personal') {
portlet = 'personal';
}
else if (portlet === 'p-cactions') {
portlet = 'actions';
}
}
var node = document.getElementById(portlet);
if ( !node ) return null;
node = node.getElementsByTagName( "ul" )[0];
if ( !node ) return null;
var link = document.createElement( "a" );
var linkText;
if (wrapSpan) {
linkText = document.createElement('span');
linkText.appendChild( document.createTextNode( text ) );
} else {
linkText = document.createTextNode( text );
}
link.appendChild( linkText );
link.href = href;
var item = document.createElement( "li" );
item.appendChild( link );
if ( id ) item.id = id;
if ( accesskey ) {
link.setAttribute( "accesskey", accesskey );
tooltip += " ["+accesskey+"]";
}
if ( tooltip ) {
link.setAttribute( "title", tooltip );
}
if ( accesskey && tooltip ) {
updateTooltipAccessKeys( new Array( link ) );
}
if ( nextnode && nextnode.parentNode == node )
node.insertBefore( item, nextnode );
else
node.appendChild( item ); // IE compatibility (?)
return item;
}
Thanks,
[[n:user:Bawolff]]
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l