MediaWiki:DisplayFooter.js

From En JW United
Revision as of 16:44, 17 August 2019 by Administrator (talk | contribs) (Created page with "********************* *** Automatically generate page footer from values in <nowiki>{{header}}</nowiki> *** by user:GrafZahl and user:Tpt *********************: //...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/**********************
*** Automatically generate page footer from values in <nowiki>{{header}}</nowiki>
*** by [[user:GrafZahl]] and [[user:Tpt]]
**********************/
// <source lang="javascript">

$( document ).ready( function() {
	if( mw.config.get( 'wgNamespaceNumber' ) !== 0 || mw.util.getParamValue( 'match' ) !== null ) {
		return;
	}
	var $nofooterElt = $( '#nofooter' );
	var $hp = $( '#headerprevious' );
	var $hn = $( '#headernext' );
 	var $contentElt = $( '#mw-content-text' );
	if( $contentElt.length === 0 || ($hp.length === 0 && $hn.length === 0) || $nofooterElt.length !== 0 ) {
		return; 
	}

	var footer = '<div class="footertemplate ws-noexport noprint" id="footertemplate" style="margin-top:1em; clear:both;">';
	footer += '<div style="width:100%; padding-left:0px; padding-right:0px; background-color:transparent;">';
	if( $hp.length !== 0 ) {
		footer += '<div style="text-align:left; float:left; max-width:40%;"><span id="footerprevious">' + $hp.html() + '</span></div>';
	}
	if( $hn.length !== 0 ) {
		footer += '<div style="text-align:right; float:right; max-width:40%;"><span id="footernext">' + $hn.html() + '</span></div>';
	}
	footer += '<div style="text-align:center; margin-left:25%; margin-right:25%;"><a href="#top">' + ws_msg( '▲' ) + '</a></div>';
	footer += '</div><div style="clear:both;"></div></div>';

		var $printlinksElt = $( 'div.printfooter' );
		if( $printlinksElt.length !== 0 ) { 	// place footer before category box
			$printlinksElt.after( footer );
		} else {
			$contentElt.after( footer );
		}
	}
);

// </source>