From f752a7079622ab23bb818d1dd996bb9d25f356e9 Mon Sep 17 00:00:00 2001 From: glaisher Date: Sat, 22 Nov 2014 14:35:58 +0500 Subject: [PATCH] Hide 'redirectedfrom' notice when printing articles Wrap the 'redirectedfrom' message in "mw-redirectedfrom" id and then add it to commonPrint.css to hide it when printing. Bug: 16296 Change-Id: I077bda9596c37b122a1f6964470d9d85108d834e --- includes/page/Article.php | 8 ++++++-- resources/src/mediawiki.legacy/commonPrint.css | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/page/Article.php b/includes/page/Article.php index cf53f1d59a..e3541bd9a8 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -1003,7 +1003,9 @@ class Article implements Page { array( 'redirect' => 'no' ) ); - $outputPage->addSubtitle( wfMessage( 'redirectedfrom' )->rawParams( $redir ) ); + $outputPage->addSubtitle( "" . + wfMessage( 'redirectedfrom' )->rawParams( $redir )->parse() + . "" ); // Add the script to update the displayed URL and // set the fragment if one was specified in the redirect @@ -1025,7 +1027,9 @@ class Article implements Page { // If it was reported from a trusted site, supply a backlink. if ( $wgRedirectSources && preg_match( $wgRedirectSources, $rdfrom ) ) { $redir = Linker::makeExternalLink( $rdfrom, $rdfrom ); - $outputPage->addSubtitle( wfMessage( 'redirectedfrom' )->rawParams( $redir ) ); + $outputPage->addSubtitle( "" . + wfMessage( 'redirectedfrom' )->rawParams( $redir )->parse() + . "" ); // Add the script to update the displayed URL $outputPage->addJsConfigVars( array( diff --git a/resources/src/mediawiki.legacy/commonPrint.css b/resources/src/mediawiki.legacy/commonPrint.css index 9405719f96..ef2d71e128 100644 --- a/resources/src/mediawiki.legacy/commonPrint.css +++ b/resources/src/mediawiki.legacy/commonPrint.css @@ -34,6 +34,7 @@ span.mw-filepage-other-resolutions, #filetoc, .usermessage, .patrollink, +.ns-0 .mw-redirectedfrom, #mw-navigation, #siteNotice { display: none; -- 2.20.1