MediaWiki:Common.js: Difference between revisions

From SWCCG Wiki
Jump to navigation Jump to search
header/premiere thumbs
logo stays in sidebar
Line 1: Line 1:
/* Wikipedia-style: logo top-left, search immediately to its right. Account links stay far right. */
/* Keep the logo in the sidebar. Park search at the left of the header (right of the logo). */
(function () {
(function () {
   function ready(fn) {
   function ready(fn) {
Line 9: Line 9:
   }
   }
   ready(function () {
   ready(function () {
     var logo = document.getElementById('p-logo');
     var search = document.getElementById('p-search');
     var head = document.getElementById('mw-head');
     var head = document.getElementById('mw-head');
     var search = document.getElementById('p-search');
     if (search && head && search.parentNode !== head) {
    if (logo && head && logo.parentNode !== head) {
       head.insertBefore(search, head.firstChild);
       head.insertBefore(logo, head.firstChild);
    }
    if (search && logo && logo.parentNode) {
      if (search.previousElementSibling !== logo) {
        logo.parentNode.insertBefore(search, logo.nextSibling);
      }
     }
     }
   });
   });
})();
})();

Revision as of 00:34, 21 September 2026

/* Keep the logo in the sidebar. Park search at the left of the header (right of the logo). */
(function () {
  function ready(fn) {
    if (document.readyState !== 'loading') {
      fn();
    } else {
      document.addEventListener('DOMContentLoaded', fn);
    }
  }
  ready(function () {
    var search = document.getElementById('p-search');
    var head = document.getElementById('mw-head');
    if (search && head && search.parentNode !== head) {
      head.insertBefore(search, head.firstChild);
    }
  });
})();