jenkins-bot has submitted this change and it was merged. Change subject: Make mdot landing page faster ......................................................................
Make mdot landing page faster Now the landing page on mdot will load fast like on zerodot. A separate patch is being created for core for logo thumbnails. Just like mdot, the zerodot landing page will now also show the community provided quote. Change-Id: Id50f5aaba65241649dc7938786bc29ab32780d48 --- M includes/ZeroSpecialPage.php 1 file changed, 21 insertions(+), 68 deletions(-) Approvals: Yurik: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/ZeroSpecialPage.php b/includes/ZeroSpecialPage.php index 0594a23..c0b99bd 100644 --- a/includes/ZeroSpecialPage.php +++ b/includes/ZeroSpecialPage.php @@ -4,9 +4,9 @@ use Language; use UnlistedSpecialPage; use Html; -use MobileContext; use WebRequest; use Xml; +use CSSMin; /** * Default startup page for ZeroBanner extension that shows the list of available languages. @@ -62,7 +62,7 @@ $out->addHTML( $output ); } else { $config = $state->getZeroConfig(); - if ( $config && $state->isZeroSubdomain() ) { + if ( $config ) { $out->disable(); $req = $this->getRequest(); $resp = $req->response(); @@ -75,14 +75,10 @@ $output = $this->renderSimplerSpecialPage( $state ); echo $output; - } elseif ( $config || $state->isZeroSubdomain() ) { + } elseif ( $state->isZeroSubdomain() ) { $out->addModules( 'zerobanner.special.scripts' ); $out->addModuleStyles( 'zerobanner.special.styles' ); - if ( $config ) { - $output = $this->renderSpecialPage( $state ); - } else { - $output = $this->renderUnknownZeroPartnerPage( $state ); - } + $output = $this->renderUnknownZeroPartnerPage( $state ); $out->addHTML( $output ); } } @@ -114,64 +110,6 @@ wfLogWarning( "Error $retval executing $cmd: $output" ); return false; } - } - - /** - * @param PageRendering $state - * @throws \MWException - * @return string - */ - private function renderSpecialPage( PageRendering $state ) { - $output = ''; - - // CSS hack to get rid of the header that comes from the mobile frontend - $output .= '<style type="text/css">.header {display: none}</style>'; - $output .= $this->msg( 'zero-landing-welcome' )->parseAsBlock() . Html::element( 'hr' ); - - $config = $state->getZeroConfig(); - - $languageNames = $this->getLangNamesWithOverrides( $config ); - $output .= $this->renderPrimaryLangs( $state, $config, $languageNames); - $output .= Html::element( 'hr' ); - $output .= wfMessage( 'zero-home-page-selection-text' )->escaped(); - $output .= Html::openElement( 'form' ); - $currentTitle = $this->getPageTitle(); - $defaultUrl = MobileContext::singleton()->getMobileUrl( $currentTitle->getFullURL() ); - $output .= Html::element( 'input', array( 'type' => 'hidden', - 'name' => 'from', - 'value' => $currentTitle, - ) ); - // TODO: Remove unnecessary 'id' attributes - $output .= Html::openElement( 'select', - array( 'id' => 'languageselection', - 'onchange' => 'javascript:window.location = this.options[this.selectedIndex].value;', - 'class' => 'mw-zero-language', - 'name' => 'to', - ) - ); - $output .= Html::element( 'option', - array( 'value' => $defaultUrl ), - wfMessage( 'zero-language-selection' )->text() - ); - - $freeLangs = $config->whitelistedLangs(); - foreach ( $languageNames as $languageCode => $languageName ) { - $isFree = count( $freeLangs ) === 0 || in_array( $languageCode, $freeLangs ); - $url = $state->getStartPageUrl( $languageCode, $isFree ? 0 : PageRendering::FORCE_MDOT ); - if ( !$isFree ) { - $url = $state->makeRedirect( $url ); - } - $output .= Html::element( 'option', array( 'value' => $url ), $languageName ); - } - $output .= Html::closeElement( 'select' ); - $output .= Html::element( 'input', - array( 'type' => 'submit', - 'value' => wfMessage( 'go' )->text(), - 'class' => 'mw-zero-language', - ) - ); - $output .= Html::closeElement( 'form' ); - return $output; } /** @@ -222,14 +160,27 @@ $output .= Html::element( 'meta', array( 'name' => 'viewport', 'content' =>'width=device-width' ) ); $output .= Html::element( 'title', null, $wgSitename ); - $output .= Html::element( 'style', null, 'body{text-align:center} #center{width:100%;margin:0 auto} hr{width:80%;height:1px} p,small {font-family:Tahoma,sans-serif}' ); + $style = <<<'EOM' +body{text-align:center;color:#000000;background-color:#ffffff} +#center{width:100%;margin:0 auto} +hr{width:80%;height:1px} +p.header, blockquote {font-family:"Linux Libertine",Georgia,Times,serif;font-size:1.2em;margin:0 0 1em;padding-top:1em} +p,small {font-family:"Helvetica Neue","Helvetica","Nimbus Sans L","Arial","Liberation Sans",sans-serif} +form {margin-bottom:1em} +blockquote {font-size:1.0em;quotes:"\201C" "\201D";padding:1em 25px 1em 30px;position:relative;overflow:hidden} +blockquote:after {content:close-quote;font-size: 1.3em;line-height:1;position:absolute;right:0px;bottom:0px} +blockquote:before {content:open-quote;font-size: 1.3em;position:absolute;left:0px;top:0px} +EOM; + $style = str_replace( "\n", '', $style); + $output .= Html::element( 'style', null, $style ); $output .= Html::element( 'link', array( 'rel' => 'shortcut icon', 'href' => '#' ) ); $output .= Html::closeElement( 'head' ); $output .= Html::openElement( 'body', array( 'onLoad' => 'document.searchform.search.focus();' ) ); - $output .= Html::element( 'p', null, $state->getBannerText( $config ) ); + $output .= Html::element( 'p', array( 'class' => 'header' ), $state->getBannerText( $config ) ); $output .= Html::openElement( 'div', array( 'id' => 'center' ) ); $output .= Html::openElement( 'form', array( 'name' => 'searchform', 'action' => $wgScript ) ); + $output .= Html::element( 'p', array( 'class' => 'bg' ), null ); $output .= Html::element( 'input', array( 'type' => 'search', 'name' => 'search', 'size' => '21', @@ -250,6 +201,8 @@ $languageNames = $this->getLangNamesWithOverrides( $config ); $output .= $this->renderPrimaryLangs( $state, $config, $languageNames, 'p' ); $output .= $hrTag; + $output .= $this->msg( 'zero-landing-welcome' )->parseAsBlock(); + $output .= $hrTag; $output .= Html::openElement( 'small' ); // START Adapted from SkinMinerva.php -- To view, visit https://gerrit.wikimedia.org/r/170483 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id50f5aaba65241649dc7938786bc29ab32780d48 Gerrit-PatchSet: 15 Gerrit-Project: mediawiki/extensions/ZeroBanner Gerrit-Branch: master Gerrit-Owner: Dr0ptp4kt <ab...@wikimedia.org> Gerrit-Reviewer: Dr0ptp4kt <ab...@wikimedia.org> Gerrit-Reviewer: Jhobs <jhob...@wikimedia.org> Gerrit-Reviewer: Yurik <yu...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits