User:Barto/common.js

From ProofWiki
Jump to navigation Jump to search

Note: After publishing, 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 / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/**
 * Deletes paragraphs created by double blank lines.
 * Whitespace is fixed using css instead, see $\href{common.css}{\text{user:barto/common.css}}$
 * Only on Main, ProofWiki, Help, Axiom, Definition namespaces.
 * ------------------------------------------------------------------
 */
$(".ns-0 p + h2, .ns-4 p + h2, .ns-12 p + h2, .ns-100 p + h2, .ns-102 p + h2," +
  ".ns-0 p + h3, .ns-4 p + h3, .ns-12 p + h3, .ns-100 p + h3, .ns-102 p + h3," +
  ".ns-0 p + h4, .ns-4 p + h4, .ns-12 p + h4, .ns-100 p + h4, .ns-102 p + h4").prev().filter(function() {
	s = $(this).html();
	return s.substring(0, s.length - 1) == "<br>";
}).remove();//css({"line-height": 0, "margin" : 0});

/**
 * Small margin for transcluded definitions (h3) on an equivalence of definitions page.
 * Done with css instead, so content moves less on page load.
 */
/** 
if (location.pathname.split('/').slice(-1)[0].startsWith("Equivalence_of_Definitions")) {
	$(".mw-body h3:not(:first-of-type)").filter(function() {return $(this).index() <= $(".mw-body h2:nth-of-type(2)").eq(0).index()}).css("margin-top", "0.3em");
}*/

/**
 * Lists with LaTeX numbering, not operational
 * ------------------------------------------------------
 */
 
$('.latexlist').parent().next().children().css('content', '":$(" + counter(item) + "): \quad$"')