Index: trunk/phase3/skins/common/wikibits.js |
— | — | @@ -287,13 +287,19 @@ |
288 | 288 | * @return Node -- the DOM node of the new item (an LI element) or null |
289 | 289 | */ |
290 | 290 | function addPortletLink(portlet, href, text, id, tooltip, accesskey, nextnode) { |
291 | | - var node = document.getElementById(portlet); |
| 291 | + var root = document.getElementById(portlet); |
| 292 | + if ( !root ) return null; |
| 293 | + var node = root.getElementsByTagName( "ul" )[0]; |
292 | 294 | if ( !node ) return null; |
293 | | - node = node.getElementsByTagName( "ul" )[0]; |
294 | | - if ( !node ) return null; |
295 | 295 | |
| 296 | + // unhide portlet if it was hidden before |
| 297 | + root.className = root.className.replace( /(^| )emptyPortlet( |$)/, "$2" ); |
| 298 | + |
| 299 | + var span = document.createElement( "span" ); |
| 300 | + span.appendChild( document.createTextNode( text ) ); |
| 301 | + |
296 | 302 | var link = document.createElement( "a" ); |
297 | | - link.appendChild( document.createTextNode( text ) ); |
| 303 | + link.appendChild( span ); |
298 | 304 | link.href = href; |
299 | 305 | |
300 | 306 | var item = document.createElement( "li" ); |
Index: trunk/phase3/skins/Vector.php |
— | — | @@ -691,9 +691,8 @@ |
692 | 692 | echo "\n<!-- {$name} -->\n"; |
693 | 693 | switch ( $element ) { |
694 | 694 | case 'NAMESPACES': |
695 | | - if ( count( $this->data[ 'namespace_urls' ] ) > 0 ) { |
696 | 695 | ?> |
697 | | -<div id="namespaces" class="vectorTabs"> |
| 696 | +<div id="namespaces" class="vectorTabs<?php if ( count( $this->data['namespace_urls'] ) == 0 ) echo ' emptyPortlet'; ?>"> |
698 | 697 | <h5><?php $this->msg('namespaces') ?></h5> |
699 | 698 | <ul <?php $this->html('userlangattributes') ?>> |
700 | 699 | <?php foreach ($this->data['namespace_urls'] as $key => $link ): ?> |
— | — | @@ -702,12 +701,10 @@ |
703 | 702 | </ul> |
704 | 703 | </div> |
705 | 704 | <?php |
706 | | - } |
707 | 705 | break; |
708 | 706 | case 'VARIANTS': |
709 | | - if ( count( $this->data[ 'variant_urls' ] ) > 0 ) { |
710 | 707 | ?> |
711 | | -<div id="variants" class="vectorMenu"> |
| 708 | +<div id="variants" class="vectorMenu<?php if ( count( $this->data['variant_urls'] ) == 0 ) echo ' emptyPortlet'; ?>"> |
712 | 709 | <h5><span><?php $this->msg('variants') ?></span><a href="#"></a></h5> |
713 | 710 | <div class="menu"> |
714 | 711 | <ul <?php $this->html('userlangattributes') ?>> |
— | — | @@ -718,12 +715,10 @@ |
719 | 716 | </div> |
720 | 717 | </div> |
721 | 718 | <?php |
722 | | - } |
723 | 719 | break; |
724 | 720 | case 'VIEWS': |
725 | | - if ( count( $this->data[ 'view_urls' ] ) > 0 ) { |
726 | 721 | ?> |
727 | | -<div id="views" class="vectorTabs"> |
| 722 | +<div id="views" class="vectorTabs<?php if ( count( $this->data['view_urls'] ) == 0 ) echo ' emptyPortlet'; ?>"> |
728 | 723 | <h5><?php $this->msg('views') ?></h5> |
729 | 724 | <ul <?php $this->html('userlangattributes') ?>> |
730 | 725 | <?php foreach ($this->data['view_urls'] as $key => $link ): ?> |
— | — | @@ -732,12 +727,10 @@ |
733 | 728 | </ul> |
734 | 729 | </div> |
735 | 730 | <?php |
736 | | - } |
737 | 731 | break; |
738 | 732 | case 'ACTIONS': |
739 | | - if ( count( $this->data[ 'action_urls' ] ) > 0 ) { |
740 | 733 | ?> |
741 | | -<div id="p-cactions" class="vectorMenu"> |
| 734 | +<div id="p-cactions" class="vectorMenu<?php if ( count( $this->data['action_urls'] ) == 0 ) echo ' emptyPortlet'; ?>"> |
742 | 735 | <h5><span><?php $this->msg('actions') ?></span><a href="#"></a></h5> |
743 | 736 | <div class="menu"> |
744 | 737 | <ul <?php $this->html('userlangattributes') ?>> |
— | — | @@ -748,12 +741,10 @@ |
749 | 742 | </div> |
750 | 743 | </div> |
751 | 744 | <?php |
752 | | - } |
753 | 745 | break; |
754 | 746 | case 'PERSONAL': |
755 | | - if ( count( $this->data['personal_urls'] ) > 0 ) { |
756 | 747 | ?> |
757 | | -<div id="p-personal"> |
| 748 | +<div id="p-personal" class="<?php if ( count( $this->data['personal_urls'] ) == 0 ) echo ' emptyPortlet'; ?>"> |
758 | 749 | <h5><?php $this->msg('personaltools') ?></h5> |
759 | 750 | <ul <?php $this->html('userlangattributes') ?>> |
760 | 751 | <?php foreach($this->data['personal_urls'] as $key => $item): ?> |
— | — | @@ -762,7 +753,6 @@ |
763 | 754 | </ul> |
764 | 755 | </div> |
765 | 756 | <?php |
766 | | - } |
767 | 757 | break; |
768 | 758 | case 'SEARCH': |
769 | 759 | ?> |
Index: trunk/phase3/skins/vector/main-ltr.css |
— | — | @@ -62,6 +62,10 @@ |
63 | 63 | margin: 0; |
64 | 64 | padding: 0; |
65 | 65 | } |
| 66 | + /* Hide empty portlets */ |
| 67 | + div.emptyPortlet { |
| 68 | + display: none; |
| 69 | + } |
66 | 70 | /* Personal */ |
67 | 71 | #p-personal { |
68 | 72 | position: absolute; |
— | — | @@ -204,8 +208,13 @@ |
205 | 209 | direction: rtl; |
206 | 210 | } |
207 | 211 | /* @noflip */ |
208 | | - div.vectorMenu h5 { |
| 212 | + #head div.vectorMenu h5 { |
209 | 213 | float: left; |
| 214 | + background-image: url(images/tab-break.png); |
| 215 | + background-position: bottom left; |
| 216 | + background-repeat: no-repeat; |
| 217 | + padding-left: 1px; |
| 218 | + margin-left: -1px; |
210 | 219 | } |
211 | 220 | /* OVERRIDDEN BY COMPLIANT BROWSERS */ |
212 | 221 | div.vectorMenu h5 a { |
Index: trunk/phase3/skins/vector/main-rtl.css |
— | — | @@ -62,6 +62,10 @@ |
63 | 63 | margin: 0; |
64 | 64 | padding: 0; |
65 | 65 | } |
| 66 | + /* Hide empty portlets */ |
| 67 | + div.emptyPortlet { |
| 68 | + display: none; |
| 69 | + } |
66 | 70 | /* Personal */ |
67 | 71 | #p-personal { |
68 | 72 | position: absolute; |
— | — | @@ -204,8 +208,13 @@ |
205 | 209 | direction: rtl; |
206 | 210 | } |
207 | 211 | /* @noflip */ |
208 | | - div.vectorMenu h5 { |
| 212 | + #head div.vectorMenu h5 { |
209 | 213 | float: left; |
| 214 | + background-image: url(images/tab-break.png); |
| 215 | + background-position: bottom left; |
| 216 | + background-repeat: no-repeat; |
| 217 | + padding-left: 1px; |
| 218 | + margin-left: -1px; |
210 | 219 | } |
211 | 220 | /* OVERRIDDEN BY COMPLIANT BROWSERS */ |
212 | 221 | div.vectorMenu h5 a { |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -474,6 +474,10 @@ |
475 | 475 | any change, in addition to onkeyup. |
476 | 476 | * Don't link to "edit this page" on MediaWiki:Noarticletext if user is not allowed |
477 | 477 | to create page. Done via new message MediaWiki:Noarticletext-nopermission |
| 478 | +* Improved compatibility between the Vector skin and addPortletLink() from wikibits.js: |
| 479 | + empty portlets are now present but hidden, adding an element to a portlet unhides it |
| 480 | +* (bug 19531) addPortletLink() now wraps inserted labels in a <span> element to be |
| 481 | + compatible with the CSS for the Vector skin |
478 | 482 | |
479 | 483 | == API changes in 1.16 == |
480 | 484 | |