Matmarex has uploaded a new change for review. https://gerrit.wikimedia.org/r/57845
Change subject: remove references to removed skins from mediawiki.util.js ...................................................................... remove references to removed skins from mediawiki.util.js Dead code removal. Followup to Ia6d73c2d. Change-Id: Ic43462d6775af682626e43a1bdfab3f8077f0101 --- M resources/mediawiki/mediawiki.util.js 1 file changed, 67 insertions(+), 80 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/45/57845/1 diff --git a/resources/mediawiki/mediawiki.util.js b/resources/mediawiki/mediawiki.util.js index 5211b0d..1bd7430 100644 --- a/resources/mediawiki/mediawiki.util.js +++ b/resources/mediawiki/mediawiki.util.js @@ -364,87 +364,74 @@ $link.attr( 'title', tooltip ); } - // Some skins don't have any portlets - // just add it to the bottom of their 'sidebar' element as a fallback - switch ( mw.config.get( 'skin' ) ) { - case 'standard': - $( '#quickbar' ).append( $link.after( '<br/>' ) ); - return $link[0]; - case 'nostalgia': - $( '#searchform' ).before( $link ).before( ' | ' ); - return $link[0]; - default: // Skins like chick, modern, monobook, myskin, simple, vector... - - // Select the specified portlet - $portlet = $( '#' + portlet ); - if ( $portlet.length === 0 ) { - return null; - } - // Select the first (most likely only) unordered list inside the portlet - $ul = $portlet.find( 'ul' ).eq( 0 ); - - // If it didn't have an unordered list yet, create it - if ( $ul.length === 0 ) { - - $ul = $( '<ul>' ); - - // If there's no <div> inside, append it to the portlet directly - if ( $portlet.find( 'div:first' ).length === 0 ) { - $portlet.append( $ul ); - } else { - // otherwise if there's a div (such as div.body or div.pBody) - // append the <ul> to last (most likely only) div - $portlet.find( 'div' ).eq( -1 ).append( $ul ); - } - } - // Just in case.. - if ( $ul.length === 0 ) { - return null; - } - - // Unhide portlet if it was hidden before - $portlet.removeClass( 'emptyPortlet' ); - - // Wrap the anchor tag in a list item (and a span if $portlet is a Vector tab) - // and back up the selector to the list item - if ( $portlet.hasClass( 'vectorTabs' ) ) { - $item = $link.wrap( '<li><span></span></li>' ).parent().parent(); - } else { - $item = $link.wrap( '<li></li>' ).parent(); - } - - // Implement the properties passed to the function - if ( id ) { - $item.attr( 'id', id ); - } - if ( accesskey ) { - $link.attr( 'accesskey', accesskey ); - tooltip += ' [' + accesskey + ']'; - $link.attr( 'title', tooltip ); - } - if ( accesskey && tooltip ) { - util.updateTooltipAccessKeys( $link ); - } - - // Where to put our node ? - // - nextnode is a DOM element (was the only option before MW 1.17, in wikibits.js) - if ( nextnode && nextnode.parentNode === $ul[0] ) { - $(nextnode).before( $item ); - - // - nextnode is a CSS selector for jQuery - } else if ( typeof nextnode === 'string' && $ul.find( nextnode ).length !== 0 ) { - $ul.find( nextnode ).eq( 0 ).before( $item ); - - // If the jQuery selector isn't found within the <ul>, - // or if nextnode was invalid or not passed at all, - // then just append it at the end of the <ul> (this is the default behavior) - } else { - $ul.append( $item ); - } - - - return $item[0]; + // Select the specified portlet + $portlet = $( '#' + portlet ); + if ( $portlet.length === 0 ) { + return null; } + // Select the first (most likely only) unordered list inside the portlet + $ul = $portlet.find( 'ul' ).eq( 0 ); + + // If it didn't have an unordered list yet, create it + if ( $ul.length === 0 ) { + + $ul = $( '<ul>' ); + + // If there's no <div> inside, append it to the portlet directly + if ( $portlet.find( 'div:first' ).length === 0 ) { + $portlet.append( $ul ); + } else { + // otherwise if there's a div (such as div.body or div.pBody) + // append the <ul> to last (most likely only) div + $portlet.find( 'div' ).eq( -1 ).append( $ul ); + } + } + // Just in case.. + if ( $ul.length === 0 ) { + return null; + } + + // Unhide portlet if it was hidden before + $portlet.removeClass( 'emptyPortlet' ); + + // Wrap the anchor tag in a list item (and a span if $portlet is a Vector tab) + // and back up the selector to the list item + if ( $portlet.hasClass( 'vectorTabs' ) ) { + $item = $link.wrap( '<li><span></span></li>' ).parent().parent(); + } else { + $item = $link.wrap( '<li></li>' ).parent(); + } + + // Implement the properties passed to the function + if ( id ) { + $item.attr( 'id', id ); + } + if ( accesskey ) { + $link.attr( 'accesskey', accesskey ); + tooltip += ' [' + accesskey + ']'; + $link.attr( 'title', tooltip ); + } + if ( accesskey && tooltip ) { + util.updateTooltipAccessKeys( $link ); + } + + // Where to put our node ? + // - nextnode is a DOM element (was the only option before MW 1.17, in wikibits.js) + if ( nextnode && nextnode.parentNode === $ul[0] ) { + $(nextnode).before( $item ); + + // - nextnode is a CSS selector for jQuery + } else if ( typeof nextnode === 'string' && $ul.find( nextnode ).length !== 0 ) { + $ul.find( nextnode ).eq( 0 ).before( $item ); + + // If the jQuery selector isn't found within the <ul>, + // or if nextnode was invalid or not passed at all, + // then just append it at the end of the <ul> (this is the default behavior) + } else { + $ul.append( $item ); + } + + return $item[0]; }, /** -- To view, visit https://gerrit.wikimedia.org/r/57845 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic43462d6775af682626e43a1bdfab3f8077f0101 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Matmarex <matma....@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits