* Empty portlets are now present but hidden; adding an element to a portlet unhides it.
* Drop-down menu portlets now have their own left border, so they'll look right even if there's no other portlet to the left of them. (If there is, the borders should overlap.)
* addPortletLink() now wraps its labels in <span> tags to be compatible with the Vector CSS for the "namespaces" and "views" portlets (bug 19531).
any change, in addition to onkeyup.
* Don't link to "edit this page" on MediaWiki:Noarticletext if user is not allowed
to create page. Done via new message MediaWiki:Noarticletext-nopermission
+* Improved compatibility between the Vector skin and addPortletLink() from wikibits.js:
+ empty portlets are now present but hidden, adding an element to a portlet unhides it
+* (bug 19531) addPortletLink() now wraps inserted labels in a <span> element to be
+ compatible with the CSS for the Vector skin
== API changes in 1.16 ==
echo "\n<!-- {$name} -->\n";
switch ( $element ) {
case 'NAMESPACES':
- if ( count( $this->data[ 'namespace_urls' ] ) > 0 ) {
?>
-<div id="namespaces" class="vectorTabs">
+<div id="namespaces" class="vectorTabs<?php if ( count( $this->data['namespace_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
<h5><?php $this->msg('namespaces') ?></h5>
<ul <?php $this->html('userlangattributes') ?>>
<?php foreach ($this->data['namespace_urls'] as $key => $link ): ?>
</ul>
</div>
<?php
- }
break;
case 'VARIANTS':
- if ( count( $this->data[ 'variant_urls' ] ) > 0 ) {
?>
-<div id="variants" class="vectorMenu">
+<div id="variants" class="vectorMenu<?php if ( count( $this->data['variant_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
<h5><span><?php $this->msg('variants') ?></span><a href="#"></a></h5>
<div class="menu">
<ul <?php $this->html('userlangattributes') ?>>
</div>
</div>
<?php
- }
break;
case 'VIEWS':
- if ( count( $this->data[ 'view_urls' ] ) > 0 ) {
?>
-<div id="views" class="vectorTabs">
+<div id="views" class="vectorTabs<?php if ( count( $this->data['view_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
<h5><?php $this->msg('views') ?></h5>
<ul <?php $this->html('userlangattributes') ?>>
<?php foreach ($this->data['view_urls'] as $key => $link ): ?>
</ul>
</div>
<?php
- }
break;
case 'ACTIONS':
- if ( count( $this->data[ 'action_urls' ] ) > 0 ) {
?>
-<div id="p-cactions" class="vectorMenu">
+<div id="p-cactions" class="vectorMenu<?php if ( count( $this->data['action_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
<h5><span><?php $this->msg('actions') ?></span><a href="#"></a></h5>
<div class="menu">
<ul <?php $this->html('userlangattributes') ?>>
</div>
</div>
<?php
- }
break;
case 'PERSONAL':
- if ( count( $this->data['personal_urls'] ) > 0 ) {
?>
-<div id="p-personal">
+<div id="p-personal" class="<?php if ( count( $this->data['personal_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
<h5><?php $this->msg('personaltools') ?></h5>
<ul <?php $this->html('userlangattributes') ?>>
<?php foreach($this->data['personal_urls'] as $key => $item): ?>
</ul>
</div>
<?php
- }
break;
case 'SEARCH':
?>
* @return Node -- the DOM node of the new item (an LI element) or null
*/
function addPortletLink(portlet, href, text, id, tooltip, accesskey, nextnode) {
- var node = document.getElementById(portlet);
- if ( !node ) return null;
- node = node.getElementsByTagName( "ul" )[0];
+ var root = document.getElementById(portlet);
+ if ( !root ) return null;
+ var node = root.getElementsByTagName( "ul" )[0];
if ( !node ) return null;
+ // unhide portlet if it was hidden before
+ root.className = root.className.replace( /(^| )emptyPortlet( |$)/, "$2" );
+
+ var span = document.createElement( "span" );
+ span.appendChild( document.createTextNode( text ) );
+
var link = document.createElement( "a" );
- link.appendChild( document.createTextNode( text ) );
+ link.appendChild( span );
link.href = href;
var item = document.createElement( "li" );
margin: 0;
padding: 0;
}
+ /* Hide empty portlets */
+ div.emptyPortlet {
+ display: none;
+ }
/* Personal */
#p-personal {
position: absolute;
direction: rtl;
}
/* @noflip */
- div.vectorMenu h5 {
+ #head div.vectorMenu h5 {
float: left;
+ background-image: url(images/tab-break.png);
+ background-position: bottom left;
+ background-repeat: no-repeat;
+ padding-left: 1px;
+ margin-left: -1px;
}
/* OVERRIDDEN BY COMPLIANT BROWSERS */
div.vectorMenu h5 a {
margin: 0;
padding: 0;
}
+ /* Hide empty portlets */
+ div.emptyPortlet {
+ display: none;
+ }
/* Personal */
#p-personal {
position: absolute;
direction: rtl;
}
/* @noflip */
- div.vectorMenu h5 {
+ #head div.vectorMenu h5 {
float: left;
+ background-image: url(images/tab-break.png);
+ background-position: bottom left;
+ background-repeat: no-repeat;
+ padding-left: 1px;
+ margin-left: -1px;
}
/* OVERRIDDEN BY COMPLIANT BROWSERS */
div.vectorMenu h5 a {