Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js

MediaWiki interface page
Revision as of 07:46, 24 August 2025 by Eloise Zomia (talk | contribs)

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)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* Landrace.wiki – Interactive map bootstrap (single, fixed block) */
(function () {
  var LVER = '1.9.4';
  var CDN  = 'https://unpkg.com/leaflet@' + LVER + '/dist/';

  console.log('[Landrace] Common.js boot');

  /* --- load Leaflet --- */
  function addCSS(href, id) {
    if (id && document.getElementById(id)) return;
    var l = document.createElement('link');
    l.rel = 'stylesheet'; l.href = href; if (id) l.id = id;
    document.head.appendChild(l);
  }
  function addJS(src, cb) {
    if (window.L) return cb();
    var s = document.createElement('script');
    s.src = src; s.onload = cb;
    s.onerror = function(){ console.error('[Landrace] Leaflet failed:', src); };
    document.head.appendChild(s);
  }

  /* --- UI helpers --- */
  function statusColor(s) {
    return ({
      Stable:'#2ecc71', Vulnerable:'#f1c40f',
      Endangered:'#e67e22', Critical:'#e74c3c', Lost:'#95a5a6'
    })[s] || '#3498db';
  }
  function popup(kind, p) {
    if (kind === 'accessions') {