MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
Line 562: Line 562:
     loadData();
     loadData();
   });
   });
})();
// Category Grid Component - background images for ax-cat-grid
(function() {
  // Map of card ID -> background image URL and fallback gradient
  var catImages = {
    'ax-cat-img-1': { url: 'https://alphax.wiki/images/4/43/Sexual_Health_Hero.jpg', pos: 'center center' },
    'ax-cat-img-2': { url: 'https://alphax.wiki/images/e/e5/Kink_BDSM_Hero.png', pos: 'center center' },
    'ax-cat-img-3': { gradient: 'linear-gradient(135deg, #0D1B2A 0%, #1B3A4B 40%, #0D2B3E 100%)' },
    'ax-cat-img-4': { gradient: 'linear-gradient(135deg, #1A0D0D 0%, #3A1A0D 50%, #2B1A0D 100%)' },
    'ax-cat-img-5': { url: 'https://alphax.wiki/images/0/0b/Dating_Sex_Relationships_Hero.png', pos: 'center 30%' },
    'ax-cat-img-6': { gradient: 'linear-gradient(135deg, #1A0D1A 0%, #2E0D3A 50%, #1A0D2B 100%)' },
    'ax-cat-img-7': { url: 'https://alphax.wiki/images/2/25/Culture_History_Politics_Hero.png', pos: 'center center' },
    'ax-cat-img-8': { gradient: 'linear-gradient(135deg, #0D1A0D 0%, #0D2B1A 50%, #0D1A2B 100%)' }
  };
  function applyCatImages() {
    Object.keys(catImages).forEach(function(id) {
      var el = document.getElementById(id);
      if (!el) return;
      var cfg = catImages[id];
      if (cfg.url) {
        el.style.backgroundImage = 'url("' + cfg.url + '")';
        el.style.backgroundSize = 'cover';
        el.style.backgroundPosition = cfg.pos || 'center center';
      } else if (cfg.gradient) {
        el.style.backgroundImage = cfg.gradient;
      }
    });
  }
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', applyCatImages);
  } else {
    applyCatImages();
  }
})();
})();