MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1,370: Line 1,370:


         // Remove “empty” optional sections so they don’t leave gaps in print.
         // Remove “empty” optional sections so they don’t leave gaps in print.
         // Kill UA paragraph margins & set compact rhythm inside the print iframe
         // Kill UA paragraph margins & set compact rhythm (ES5-safe)
         var compactCSS = doc.createElement("style");
         var compactCSS = doc.createElement("style");
         compactCSS.textContent = `
         compactCSS.type = "text/css";
         @media print {
         compactCSS.appendChild(
          /* nuke default <p> margins everywhere in the printable area */
          doc.createTextNode(
          .print-only p { margin: 0 !important; }
            "@media print {" +
 
              "  .print-only p { margin:0 !important; }" +
          /* compact vertical rhythm between top-level blocks */
              "  #article-content > * { margin-top:0 !important; margin-bottom:0 !important; }" +
          #article-content > * { margin-top: 0 !important; margin-bottom: 0 !important; }
              "  #article-content > * + * { margin-top:2mm !important; }" +
 
              "  .article-description p," +
          /* small, consistent space only between siblings (tweak as you like) */
              "  .article-reflection p," +
          #article-content > * + * { margin-top: 2mm !important; }
              "  .article-external-reference p," +
 
              "  .article-quote { margin:0 0 1.2mm 0 !important; }" +
          /* paragraphs inside text sections: very small trailing space */
              "  .article-description p:last-child," +
          .article-description p,
              "  .article-reflection p:last-child," +
          .article-reflection p,
              "  .article-external-reference p:last-child { margin-bottom:0 !important; }" +
          .article-external-reference p,
              "  .article-label-description," +
          .article-quote { margin: 0 0 1.2mm 0 !important; }
              "  .article-label-reflection," +
          .article-description p:last-child,
              "  .article-label-external-reference," +
          .article-reflection p:last-child,
              "  .article-label-quote," +
          .article-external-reference p:last-child { margin-bottom: 0 !important; }
              "  .article-label-modification-date { margin:0 !important; }" +
 
              "  .article-entry-number," +
          /* labels sit tight with the block that follows */
              "  .link-pdf," +
          .article-label-description,
              "  .article-type," +
          .article-label-reflection,
              "  .article-metadata," +
          .article-label-external-reference,
              "  .article-images," +
          .article-label-quote,
              "  .article-description," +
          .article-label-modification-date { margin: 0 !important; }
              "  .article-reflection," +
 
              "  .article-external-reference," +
          /* hairline sections already use padding-bottom;
              "  .article-quote," +
            make sure there's no extra margin on either side */
              "  .article-mod-line { margin:0 !important; }" +
          .article-entry-number,
              "}"
          .link-pdf,
          )
          .article-type,
         );
          .article-metadata,
          .article-images,
          .article-description,
          .article-reflection,
          .article-external-reference,
          .article-quote,
          .article-mod-line { margin: 0 !important; }
        }
         `;
         doc.head.appendChild(compactCSS);
         doc.head.appendChild(compactCSS);


Navigation menu