Last modified: 2012-09-27 01:10:44 UTC
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]]
Fixed differently in r52855 by renaming actions to p-cactions. addPortletLink() now successfully adds dropdown actions in Vector, although it's not possible to add namespace or action tabs (but those categories don't even exist in Monobook and other skins anyway).
How about 'personal' to 'p-personal'. As far as i can tell that portlet is almost identical to monobook, and there are things that add to it. (For example the utcclock gadget on enwikinews, but thats a bad example as it was recently modified to detect vector, and handle the differences). Well the namespace tabs don't exist on monobook, it would still be very nice to be able to add to them, and necessary for any gadget that makes it look like there are more linked namespaces than the standard 2.
(In reply to comment #2) > How about 'personal' to 'p-personal'. As far as i can tell that portlet is > almost identical to monobook, and there are things that add to it. (For example > the utcclock gadget on enwikinews, but thats a bad example as it was recently > modified to detect vector, and handle the differences). > This has already happened on trunk, and will likely be pushed live tomorrow. > Well the namespace tabs don't exist on monobook, it would still be very nice to > be able to add to them, and necessary for any gadget that makes it look like > there are more linked namespaces than the standard 2. > You can do this, but you'd have to differ between skins anyway because of the inherent incompatibility.