From 7821b1499c187d1c111220f48341a6050117762a Mon Sep 17 00:00:00 2001 From: Jan Drewniak Date: Wed, 10 Apr 2019 22:31:14 +0200 Subject: [PATCH] Removing code related to old page-action menu markup Bug: T218653 Change-Id: Ifafe86f36be59fc22bb02c42b3ff12509c67b53d --- .../pageactions.less | 62 ------------------- .../downloadPageAction.js | 18 ++---- resources/skins.minerva.scripts/init.js | 15 ++--- 3 files changed, 10 insertions(+), 85 deletions(-) diff --git a/resources/skins.minerva.base.styles/pageactions.less b/resources/skins.minerva.base.styles/pageactions.less index 2ae0cdb22..cc9c8e6bd 100644 --- a/resources/skins.minerva.base.styles/pageactions.less +++ b/resources/skins.minerva.base.styles/pageactions.less @@ -80,68 +80,6 @@ display: list-item; } -// TODO: T213352 Delete this nested block after varnish cache has cleared and selectors -// no longer apply. -#page-actions:not( .page-actions-menu__list ) { - font-size: @pageActionFontSize; - float: none; - border: 0; - overflow: hidden; - width: 100%; - margin-top: -2px; - border-top: @pageActionBorder solid @colorGray14; - border-bottom: @pageActionBorder solid @colorGray12; - padding: 0.5em 0; - - li { - display: inline-block; - // Needed for non-JavaScript users - position: relative; - cursor: pointer; - // Override .hlist rule. - margin-right: 0; - margin-bottom: 0; - float: right; - - // edit, language and watchstar - a { - // Needed for non-JavaScript users - position: absolute; - display: block; - width: 100%; - height: 100%; - // needed for ContentOverlay pointer arrow - margin: 0 0 8px; - cursor: pointer; - } - - &:first-child { - margin-top: 0; - } - } - - .language-selector { - float: left; - margin-left: -@iconGutterWidth; - - &.disabled { - cursor: default; - opacity: 0.25; - } - } - - #ca-edit { - margin-right: -@iconGutterWidth; - } -} - -// FIXME: cached HTML. Can be removed when work on T212216 -// has been deployed and varnish cache cleared. -.heading-holder #page-actions:not( .page-actions-menu__list ):first-child { - position: absolute; - bottom: 0; -} - // Watchstar is hidden for anonymous no-js users // While we could link the icon to the login/signup form, this is not // a perfect experience and could be confusing. diff --git a/resources/skins.minerva.scripts/downloadPageAction.js b/resources/skins.minerva.scripts/downloadPageAction.js index dae52510b..c57734822 100644 --- a/resources/skins.minerva.scripts/downloadPageAction.js +++ b/resources/skins.minerva.scripts/downloadPageAction.js @@ -125,12 +125,8 @@ * @returns {jQuery.Object|null} */ function downloadPageAction( skin, supportedNamespaces, windowObj ) { - var icon, spinner = icons.spinner(), - // TODO: T213352 Temporary cache compatibility - to be deleted. - // Any conditionals using this boolean should be DELETED when the - // old page action menu is no longer being served to users. - // eslint-disable-next-line no-jquery/no-global-selector - oldPageActionsDOM = $( '#page-actions.hlist' ).length > 0; + var icon, spinner = icons.spinner(); + if ( isAvailable( windowObj, skin.page, navigator.userAgent, @@ -141,17 +137,15 @@ glyphPrefix: 'minerva', title: msg( 'minerva-download' ), name: GLYPH, - tagName: oldPageActionsDOM ? 'div' : 'button', + tagName: 'button', events: { // will be bound to `this` click: getOnClickHandler( skin, spinner ) } } ); - if ( oldPageActionsDOM ) { - return $( '
  • ' ).append( icon.$el ).append( spinner.$el.hide() ); - } else { - return $( '
  • ' ).addClass( 'page-actions-menu__list-item' ).append( icon.$el ).append( spinner.$el.hide() ); - } + + return $( '
  • ' ).addClass( 'page-actions-menu__list-item' ).append( icon.$el ).append( spinner.$el.hide() ); + } else { return null; } diff --git a/resources/skins.minerva.scripts/init.js b/resources/skins.minerva.scripts/init.js index 1d1b885fd..fd9ca0aaa 100644 --- a/resources/skins.minerva.scripts/init.js +++ b/resources/skins.minerva.scripts/init.js @@ -207,19 +207,12 @@ */ function appendDownloadButton() { var $downloadAction = downloadPageAction( skin, - config.get( 'wgMinervaDownloadNamespaces', [] ), window ), - // TODO: T213352 Temporary cache compatibility - to be deleted. - // Any conditionals using this boolean should be DELETED when the - // old page action menu is no longer being served to users. - // eslint-disable-next-line no-jquery/no-global-selector - oldPageActionsDOM = $( '#page-actions.hlist' ).length > 0; + config.get( 'wgMinervaDownloadNamespaces', [] ), window ); if ( $downloadAction ) { - if ( oldPageActionsDOM ) { - $downloadAction.insertAfter( '#ca-watch' ); - } else { - $downloadAction.insertAfter( '.page-actions-menu__list-item:first-child' ); - } + + $downloadAction.insertAfter( '.page-actions-menu__list-item:first-child' ); + track( 'minerva.downloadAsPDF', { action: 'buttonVisible' } );