MediaWiki:Common.js: Difference between revisions

From Heritage Apple Corps
Add site-wide navigation bar
Add footer donate link
 
(2 intermediate revisions by the same user not shown)
Line 49: Line 49:
         $('#hac-mobile-nav').removeClass('active');
         $('#hac-mobile-nav').removeClass('active');
     });
     });
});
/* Footer disclaimer — public wiki */
$(function () {
    var msg =
        'Community‑edited information only. Not affiliated with any land‑management agency. ' +
        'Content may be inaccurate. Descriptions of trees or sites do not imply permission to cut, ' +
        'collect, or alter vegetation. Follow all laws, permits, and official guidance on public lands.';
    $('<div id="hac-footer-disclaimer"></div>').text(msg).appendTo('#mw-footer');
});
/* Footer donate link */
$(function () {
    var $link = $('<div id="hac-footer-donate"></div>').html(
        'Support our work preserving Central Oregon\'s heritage fruit trees &mdash; ' +
        '<a href="https://schoolofranch.regfox.com/contributions-heritage-apple-corps" target="_blank" rel="noopener">Contribute</a>'
    );
    var $disclaimer = $('#hac-footer-disclaimer');
    if ($disclaimer.length) {
        $disclaimer.before($link);
    } else {
        $('#mw-footer').append($link);
    }
});
});

Latest revision as of 19:52, 15 March 2026

/* Heritage Apple Corps customizations */
$(function () {
    // Inject site-wide navigation bar
    var navHTML =
        '<div id="hac-navbar">' +
          '<div class="hac-container">' +
            '<div class="hac-inner">' +
              '<div class="hac-branding"><a href="/site/"><img src="/logo.png" alt="" class="hac-logo">Heritage Apple Corps</a></div>' +
              '<nav class="hac-nav-wrap" aria-label="Primary">' +
                '<ul class="hac-nav">' +
                  '<li><a href="/site/">Home</a></li>' +
                  '<li class="hac-cta"><a href="/index.php/Main_Page">Tree Registry</a></li>' +
                  '<li><a href="/site/events/">Events</a></li>' +
                  '<li><a href="/site/news/">In the News</a></li>' +
                  '<li><a href="https://schoolofranch.regfox.com/contributions-heritage-apple-corps">Contribute</a></li>' +
                  '<li><a href="/site/contact/">Contact</a></li>' +
                '</ul>' +
              '</nav>' +
              '<button class="hac-toggle" aria-label="Open menu">' +
                '<svg viewBox="0 0 24 28" xmlns="http://www.w3.org/2000/svg"><path d="M24 21v2c0 .547-.453 1-1 1H1c-.547 0-1-.453-1-1v-2c0-.547.453-1 1-1h22c.547 0 1 .453 1 1zM24 13v2c0 .547-.453 1-1 1H1c-.547 0-1-.453-1-1v-2c0-.547.453-1 1-1h22c.547 0 1 .453 1 1zM24 5v2c0 .547-.453 1-1 1H1C.453 8 0 7.547 0 7V5c0-.547.453-1 1-1h22c.547 0 1 .453 1 1z"/></svg>' +
              '</button>' +
            '</div>' +
          '</div>' +
        '</div>' +
        '<div id="hac-mobile-nav">' +
          '<div class="hac-mobile-header">' +
            '<button class="hac-mobile-close" aria-label="Close menu">&times;</button>' +
          '</div>' +
          '<ul class="hac-mobile-list">' +
            '<li><a href="/site/">Home</a></li>' +
            '<li class="hac-cta"><a href="/index.php/Main_Page">Tree Registry</a></li>' +
            '<li><a href="/site/events/">Events</a></li>' +
            '<li><a href="/site/news/">In the News</a></li>' +
            '<li><a href="https://schoolofranch.regfox.com/contributions-heritage-apple-corps">Contribute</a></li>' +
            '<li><a href="/site/contact/">Contact</a></li>' +
          '</ul>' +
        '</div>';

    $('body').prepend(navHTML);

    // Mobile toggle handlers
    $('.hac-toggle').on('click', function () {
        $('#hac-mobile-nav').addClass('active');
    });
    $('.hac-mobile-close').on('click', function () {
        $('#hac-mobile-nav').removeClass('active');
    });
    $('#hac-mobile-nav .hac-mobile-list a').on('click', function () {
        $('#hac-mobile-nav').removeClass('active');
    });
});

/* Footer disclaimer — public wiki */
$(function () {
    var msg =
        'Community‑edited information only. Not affiliated with any land‑management agency. ' +
        'Content may be inaccurate. Descriptions of trees or sites do not imply permission to cut, ' +
        'collect, or alter vegetation. Follow all laws, permits, and official guidance on public lands.';
    $('<div id="hac-footer-disclaimer"></div>').text(msg).appendTo('#mw-footer');
});

/* Footer donate link */
$(function () {
    var $link = $('<div id="hac-footer-donate"></div>').html(
        'Support our work preserving Central Oregon\'s heritage fruit trees &mdash; ' +
        '<a href="https://schoolofranch.regfox.com/contributions-heritage-apple-corps" target="_blank" rel="noopener">Contribute</a>'
    );
    var $disclaimer = $('#hac-footer-disclaimer');
    if ($disclaimer.length) {
        $disclaimer.before($link);
    } else {
        $('#mw-footer').append($link);
    }
});