MediaWiki:Gadget-DisplayFooter.js

/* MediaWiki:Gadget-DisplayFooter.js */ /* * Automatically generate page footer from values in * by user:GrafZahl and user:Tpt */

/* eslint-disable one-var, vars-on-top, no-jquery/no-global-selector */

$(function {	// Only active in the main namespace	// TODO: (for now; need to add Translation:)	if (mw.config.get('wgNamespaceNumber') !== 0) {		return;	}

// Disabled if explicitly requested. if ($("#nofooter").length !== 0) { return; }

// Grab the prev/next links from the var $headerBack = $(".wst-header-back-link"); var $headerForward = $(".wst-header-forward-link");

// If neither of them has content, bail. if ($headerBack.length === 0 && $headerForward.length === 0) { return; }

// The footer div. var $footer = $(" ").addClass("ws-footer ws-noexport noprint dynlayout-exempt");

// Copy the previous link and add it to the footer if ($headerBack.find("a").length !== 0) { $headerBack.clone .removeAttr("id") .removeClass("wst-header-back-link wst-header-back wst-header-previous") .addClass("ws-footer-back") .appendTo($footer); } else { $(" ").addClass("ws-footer-back ws-footer-empty") .appendTo($footer); }

// Add the "return to top" text var $footerCenter = $(" ") .addClass("ws-footer-center") .append( // TODO: this message name is needlessly cryptic			$('' + mw.msg('▲') + '')		); $footerCenter.appendTo($footer);

// Copy the next link and add it to the footer if ($headerForward.find("a").length !== 0) { $headerForward.clone .removeAttr("id") .removeClass("wst-header-forward-link wst-header-forward wst-header-next") .addClass("ws-footer-forward") .appendTo($footer); } else { $(" ").addClass("ws-footer-forward ws-footer-empty") .appendTo($footer); }

var $printlinksElt = $('.printfooter'); if ($printlinksElt.length !== 0) { // place footer before category box $printlinksElt.after($footer); } else { $('#mw-content-text').after($footer); } });