MediaWiki:Common.css: Difference between revisions

From Bose Portable PA Knowledge
Jump to navigation Jump to search
mNo edit summary
Tag: Reverted
m auto hide sidebar < 768 pix
 
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* MediaWiki:Common.js
/** CSS placed here will be applied to all skins */
   Lightweight fallback mobile menu
 
   Activates only when Minerva/native mobile menu is not present
/* -------------------------
*/
   Fonts
   ------------------------- */
@font-face {
    font-family: "Gotham-Black";
    src: url("/styles/Gotham-Black.otf") format("opentype");
}
 
@font-face {
    font-family: "Gotham-BlackItalic";
    src: url("/styles/Gotham-BlackItalic.otf") format("opentype");
}


mw.hook('wikipage.content').add(function () {
@font-face {
  // Only run on narrow screens
    font-family: "Gotham-Bold";
  if (window.innerWidth > 800) return;
    src: url("/styles/Gotham-Bold.otf") format("opentype");
}


  // If native Minerva menu exists, do nothing
@font-face {
  if (document.querySelector('.minerva-menu-button, .minerva-hamburger, .mw-mobile-menu')) return;
    font-family: "Gotham-BoldItalic";
    src: url("/styles/Gotham-BoldItalic.otf") format("opentype");
}


  // Avoid injecting twice
@font-face {
  if (document.querySelector('.fallback-mobile-hamburger')) return;
    font-family: "Gotham-Book";
    src: url("/styles/Gotham-Book.otf") format("opentype");
}


  // Create hamburger button
@font-face {
  var btn = document.createElement('button');
    font-family: "Gotham-BookItalic";
  btn.className = 'fallback-mobile-hamburger';
    src: url("/styles/Gotham-BookItalic.otf") format("opentype");
  btn.type = 'button';
}
  btn.setAttribute('aria-label', 'Open menu');
  btn.setAttribute('aria-expanded', 'false');
  btn.innerHTML = '&#9776;';


  // Insert into header area (best-effort)
/* Base typography */
  var header = document.querySelector('.minerva-header') || document.querySelector('#mw-head') || document.body;
body {
  try {
     font-family: "Gotham-Book", Montserrat, sans-serif;
     header.insertBefore(btn, header.firstChild);
     max-width: 1366px;
  } catch (e) {
}
     document.body.appendChild(btn);
  }


  // Create overlay and panel
h1, h2, h3, h4, h5, h6 {
  var overlay = document.createElement('div');
    font-family: "Gotham-Book", Montserrat, sans-serif;
  overlay.className = 'fallback-mobile-overlay';
    /* text-transform: uppercase; */
  overlay.setAttribute('role', 'dialog');
}
  overlay.setAttribute('aria-modal', 'true');
  overlay.style.display = 'none';


  var panel = document.createElement('nav');
.mw-body h1,
  panel.className = 'fallback-mobile-panel';
.mw-body h2,
  panel.setAttribute('aria-label', 'Mobile menu');
.mw-body h3,
  panel.setAttribute('role', 'menu');
.mw-body h4,
.mw-body h5 {
    font-family: "Gotham-Book", Montserrat, sans-serif;
}


  overlay.appendChild(panel);
/* Headline box */
.mw-headline {
    font-family: "Gotham-Bold", "Gotham-Book", Montserrat, sans-serif;
    background: #ffffff;
    /* previous alternatives:
      background: #cef2e0;
      background-color: #CCFFCC;
      border-radius: 5px;
      border: 1px outset #008080;
    */
    padding: 2px;
    width: 300px;
}


  // Close control
/* Hide structured data block if present */
  var close = document.createElement('div');
.structuredData {
  close.className = 'fallback-mobile-close';
    display: none;
  close.innerHTML = '<a href="#" aria-label="Close menu">✕</a>';
}
  panel.appendChild(close);


  // Menu links — mirror typical Mobile-menu entries
/* Table cell vertical alignment */
  var links = [
td {
    { href: mw.util.getUrl('Main_Page'), label: 'Home' },
     vertical-align: top;
     { href: mw.util.getUrl('Special:Search'), label: 'Search' },
}
    { href: mw.util.getUrl('Recentchanges'), label: 'Recent changes' },
    { href: mw.util.getUrl('Special:Random'), label: 'Random page' },
    { href: mw.util.getUrl('Special:AllPages'), label: 'All pages' },
    { href: mw.util.getUrl('Special:Categories'), label: 'Categories' },
    { href: mw.util.getUrl('Special:Upload'), label: 'Upload file' }
  ];


  links.forEach(function (lnk) {
/* ****************** NO TITLE ON MAINPAGE *************** */
     var a = document.createElement('a');
/* Adjust page name(s) to match your actual main page slug(s) */
     a.href = lnk.href;
/*
     a.textContent = lnk.label;
.page-Bose_Portable_PA_Knowledge.action-view h1.firstHeading,
     a.setAttribute('role', 'menuitem');
.page-Bose_Portable_PA_Knowledge.action-submit h1.firstHeading {
     a.tabIndex = 0;
     display: none;
     panel.appendChild(a);
}
  });
*/
/* Responsive images */
img {
    max-width: 100%;
    height: auto;
    -webkit-touch-callout: none;
     -webkit-user-select: none;
     -khtml-user-select: none;
     -moz-user-select: none;
     -ms-user-select: none;
     user-select: none;
}


  document.body.appendChild(overlay);
/* DivToc: responsive table of contents with introduction */
.tocdiv {
    max-width: 1366px;
    display: grid;
    grid-gap: 15px;
    column-gap: 30px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    grid-template-rows: auto;
}


  // Focus management helpers
/* Mobile fix for DivToc layout */
  function trapFocus(container) {
@media screen and (max-width: 700px) {
     var focusable = container.querySelectorAll('a, button, [tabindex]:not([tabindex="-1"])');
     .tocdiv {
     if (!focusable.length) return null;
        display: block !important;
    var first = focusable[0];
     }
     var last = focusable[focusable.length - 1];
    .tocdiv > div {
        width: 100% !important;
        margin: 0 !important;
     }
}


    function handleTab(e) {
/* Responsive iframe for YouTube videos */
      if (e.key !== 'Tab') return;
@media screen and (max-width: 750px) {
      if (e.shiftKey && document.activeElement === first) {
    iframe {
         e.preventDefault();
         max-width: 100% !important;
         last.focus();
         width: auto !important;
      } else if (!e.shiftKey && document.activeElement === last) {
         height: auto !important;
        e.preventDefault();
         first.focus();
      }
     }
     }
     document.addEventListener('keydown', handleTab);
}
     return function remove() { document.removeEventListener('keydown', handleTab); };
 
  }
/* Power Characters */
@font-face {
    font-family: 'power_symbols';
     src: url('/fonts/unicode/Unicode_IEC_symbol.woff2') format('woff2'),
        url('/fonts/unicode/Unicode_IEC_symbol.woff') format('woff'),
        url('/fonts/unicode/Unicode_IEC_symbol.ttf') format('truetype');
     font-weight: normal;
    font-style: normal;
}
 
.power {
    font-family: 'power_symbols';
    font-style: normal;
}
 
/* ---------- Link colors (LVHA order) ---------- */
.mw-body-content a:link { color: #0645AD; }
.mw-body-content a:visited { color: #551A8B; }
.mw-body-content a:hover { color: #0B0080; text-decoration: underline; }
.mw-body-content a:active { color: #C00000; }
 
/* Special link types */
.mw-body-content a.new { color: #CC0000; }
.mw-body-content a.external,
.mw-body-content a.extiw { color: #3366BB; }
.mw-body-content a.stub { color: #772233; }
 
/* === L1 comparison table scroll container === */
.mw-parser-output .l1-compare-wrap {
    display: block;
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
}


   var removeTrap = null;
/* === CRITICAL OVERRIDE: defeat Vector/Minerva table width clamp === */
.mw-parser-output .l1-compare-wrap table.l1-compare {
    white-space: nowrap;
    width: max-content;
    min-width: 1400px;
    max-width: none !important;   /* ensure table can overflow horizontally */
    border-collapse: separate;
    border-spacing: 0;
}


  function openMenu() {
/* === Sticky header row === */
    overlay.style.display = 'flex';
.mw-parser-output .l1-compare-wrap table.l1-compare th {
    document.body.style.overflow = 'hidden';
     position: sticky;
     btn.setAttribute('aria-expanded', 'true');
     top: 0;
     // focus first link
     background: #f8f9fa;
     var firstLink = panel.querySelector('a');
     color: #202122;
     if (firstLink) firstLink.focus();
     z-index: 10;
     removeTrap = trapFocus(panel);
}
  }


  function closeMenu() {
/* === Sticky first column === */
    overlay.style.display = 'none';
.mw-parser-output .l1-compare-wrap table.l1-compare th:first-child,
    document.body.style.overflow = '';
.mw-parser-output .l1-compare-wrap table.l1-compare td:first-child {
     btn.setAttribute('aria-expanded', 'false');
    position: sticky;
     if (removeTrap) { removeTrap(); removeTrap = null; }
     left: 0;
     btn.focus();
     background: #ffffff;
  }
    z-index: 9;
     border-right: 1px solid #a2a9b1;
}


  // Event listeners
/* === Image display on hover over text === */
  btn.addEventListener('click', function (e) {
.hover-image-wrapper {
     e.preventDefault();
     position: relative;
     openMenu();
    display: inline-block;
  });
     cursor: help;
}


  overlay.addEventListener('click', function (e) {
.hover-image-popup {
     if (e.target === overlay) closeMenu();
     position: absolute;
  });
    top: 1.2em;
    left: 0;
    z-index: 9999;
    background: #fff;
    padding: 4px;
    border: 1px solid #ccc;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.15s ease-in-out;
}


  close.addEventListener('click', function (e) {
.hover-image-wrapper:hover .hover-image-popup {
     e.preventDefault();
     visibility: visible !important;
     closeMenu();
    opacity: 1 !important;
  });
     pointer-events: auto !important;
}


  // Close on Escape
/* Hide page action tabs for users who are NOT logged in
  document.addEventListener('keydown', function (e) {
  Uses body:not(.mw-user) because this site does not use mw-anonuser/logged-in */
    if (e.key === 'Escape' && overlay.style.display === 'flex') {
body:not(.mw-user) #p-views,
      closeMenu();
body:not(.mw-user) #p-views > ul,
     }
body:not(.mw-user) #p-views > ul > li,
  });
body:not(.mw-user) #left-navigation,
body:not(.mw-user) #right-navigation,
body:not(.mw-user) .vector-page-tools,
body:not(.mw-user) .vector-page-tools .vector-menu-content,
body:not(.mw-user) .vector-page-tools .vector-menu-content > li,
body:not(.mw-user) .vector-menu-tabs,
body:not(.mw-user) .vector-menu-tabs ul,
body:not(.mw-user) .vector-menu-tabs li,
body:not(.mw-user) .minerva-page-actions,
body:not(.mw-user) .minerva-page-actions li,
body:not(.mw-user) .page-actions-menu,
body:not(.mw-user) .page-actions-menu li {
     display: none !important;
}


  // If viewport is resized to desktop, remove fallback elements
/* Ensure TOC is visible unless explicitly hidden elsewhere */
   window.addEventListener('resize', function () {
#toc, .toc {
     if (window.innerWidth > 800) {
    display: block !important;
      if (overlay.parentNode) overlay.parentNode.removeChild(overlay);
}
      if (btn.parentNode) btn.parentNode.removeChild(btn);
@media (max-width: 768px) {
      document.body.style.overflow = '';
   .vector-sidebar, .mw-sidebar {
     }
     transform: translateX(-100%);
   });
    transition: transform .25s ease;
});
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    z-index: 9999;
    background: var(--bg-color, #fff);
    box-shadow: 0 0 12px rgba(0,0,0,.2);
  }
  .vector-sidebar.open {
    transform: translateX(0);
  }
  /* Add space for a toggle button */
  .vector-main-content { padding-left: 0 !important; }
  .sidebar-toggle {
    position: fixed;
    left: 8px;
    top: 8px;
    z-index: 10001;
    background: #fff;
    border-radius: 4px;
    padding: 6px;
     box-shadow: 0 1px 4px rgba(0,0,0,.2);
   }
}

Latest revision as of 21:18, 2 April 2026

/** CSS placed here will be applied to all skins */

/* -------------------------
   Fonts
   ------------------------- */
@font-face {
    font-family: "Gotham-Black";
    src: url("/styles/Gotham-Black.otf") format("opentype");
}

@font-face {
    font-family: "Gotham-BlackItalic";
    src: url("/styles/Gotham-BlackItalic.otf") format("opentype");
}

@font-face {
    font-family: "Gotham-Bold";
    src: url("/styles/Gotham-Bold.otf") format("opentype");
}

@font-face {
    font-family: "Gotham-BoldItalic";
    src: url("/styles/Gotham-BoldItalic.otf") format("opentype");
}

@font-face {
    font-family: "Gotham-Book";
    src: url("/styles/Gotham-Book.otf") format("opentype");
}

@font-face {
    font-family: "Gotham-BookItalic";
    src: url("/styles/Gotham-BookItalic.otf") format("opentype");
}

/* Base typography */
body {
    font-family: "Gotham-Book", Montserrat, sans-serif;
    max-width: 1366px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Gotham-Book", Montserrat, sans-serif;
    /* text-transform: uppercase; */
}

.mw-body h1,
.mw-body h2,
.mw-body h3,
.mw-body h4,
.mw-body h5 {
    font-family: "Gotham-Book", Montserrat, sans-serif;
}

/* Headline box */
.mw-headline {
    font-family: "Gotham-Bold", "Gotham-Book", Montserrat, sans-serif;
    background: #ffffff;
    /* previous alternatives:
       background: #cef2e0;
       background-color: #CCFFCC;
       border-radius: 5px;
       border: 1px outset #008080;
    */
    padding: 2px;
    width: 300px;
}

/* Hide structured data block if present */
.structuredData {
    display: none;
}

/* Table cell vertical alignment */
td {
    vertical-align: top;
}

/* ****************** NO TITLE ON MAINPAGE *************** */
/* Adjust page name(s) to match your actual main page slug(s) */
/* 
.page-Bose_Portable_PA_Knowledge.action-view h1.firstHeading,
.page-Bose_Portable_PA_Knowledge.action-submit h1.firstHeading {
    display: none;
}
*/
/* Responsive images */
img {
    max-width: 100%;
    height: auto;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* DivToc: responsive table of contents with introduction */
.tocdiv {
    max-width: 1366px;
    display: grid;
    grid-gap: 15px;
    column-gap: 30px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    grid-template-rows: auto;
}

/* Mobile fix for DivToc layout */
@media screen and (max-width: 700px) {
    .tocdiv {
        display: block !important;
    }
    .tocdiv > div {
        width: 100% !important;
        margin: 0 !important;
    }
}

/* Responsive iframe for YouTube videos */
@media screen and (max-width: 750px) {
    iframe {
        max-width: 100% !important;
        width: auto !important;
        height: auto !important;
    }
}

/* Power Characters */
@font-face {
    font-family: 'power_symbols';
    src: url('/fonts/unicode/Unicode_IEC_symbol.woff2') format('woff2'),
         url('/fonts/unicode/Unicode_IEC_symbol.woff') format('woff'),
         url('/fonts/unicode/Unicode_IEC_symbol.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

.power {
    font-family: 'power_symbols';
    font-style: normal;
}

/* ---------- Link colors (LVHA order) ---------- */
.mw-body-content a:link { color: #0645AD; }
.mw-body-content a:visited { color: #551A8B; }
.mw-body-content a:hover { color: #0B0080; text-decoration: underline; }
.mw-body-content a:active { color: #C00000; }

/* Special link types */
.mw-body-content a.new { color: #CC0000; }
.mw-body-content a.external,
.mw-body-content a.extiw { color: #3366BB; }
.mw-body-content a.stub { color: #772233; }

/* === L1 comparison table scroll container === */
.mw-parser-output .l1-compare-wrap {
    display: block;
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
}

/* === CRITICAL OVERRIDE: defeat Vector/Minerva table width clamp === */
.mw-parser-output .l1-compare-wrap table.l1-compare {
    white-space: nowrap;
    width: max-content;
    min-width: 1400px;
    max-width: none !important;   /* ensure table can overflow horizontally */
    border-collapse: separate;
    border-spacing: 0;
}

/* === Sticky header row === */
.mw-parser-output .l1-compare-wrap table.l1-compare th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    color: #202122;
    z-index: 10;
}

/* === Sticky first column === */
.mw-parser-output .l1-compare-wrap table.l1-compare th:first-child,
.mw-parser-output .l1-compare-wrap table.l1-compare td:first-child {
    position: sticky;
    left: 0;
    background: #ffffff;
    z-index: 9;
    border-right: 1px solid #a2a9b1;
}

/* === Image display on hover over text === */
.hover-image-wrapper {
    position: relative;
    display: inline-block;
    cursor: help;
}

.hover-image-popup {
    position: absolute;
    top: 1.2em;
    left: 0;
    z-index: 9999;
    background: #fff;
    padding: 4px;
    border: 1px solid #ccc;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.15s ease-in-out;
}

.hover-image-wrapper:hover .hover-image-popup {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Hide page action tabs for users who are NOT logged in
   Uses body:not(.mw-user) because this site does not use mw-anonuser/logged-in */
body:not(.mw-user) #p-views,
body:not(.mw-user) #p-views > ul,
body:not(.mw-user) #p-views > ul > li,
body:not(.mw-user) #left-navigation,
body:not(.mw-user) #right-navigation,
body:not(.mw-user) .vector-page-tools,
body:not(.mw-user) .vector-page-tools .vector-menu-content,
body:not(.mw-user) .vector-page-tools .vector-menu-content > li,
body:not(.mw-user) .vector-menu-tabs,
body:not(.mw-user) .vector-menu-tabs ul,
body:not(.mw-user) .vector-menu-tabs li,
body:not(.mw-user) .minerva-page-actions,
body:not(.mw-user) .minerva-page-actions li,
body:not(.mw-user) .page-actions-menu,
body:not(.mw-user) .page-actions-menu li {
    display: none !important;
}

/* Ensure TOC is visible unless explicitly hidden elsewhere */
#toc, .toc {
    display: block !important;
}
@media (max-width: 768px) {
  .vector-sidebar, .mw-sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    z-index: 9999;
    background: var(--bg-color, #fff);
    box-shadow: 0 0 12px rgba(0,0,0,.2);
  }
  .vector-sidebar.open {
    transform: translateX(0);
  }
  /* Add space for a toggle button */
  .vector-main-content { padding-left: 0 !important; }
  .sidebar-toggle {
    position: fixed;
    left: 8px;
    top: 8px;
    z-index: 10001;
    background: #fff;
    border-radius: 4px;
    padding: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
  }
}