MediaWiki:Common.js
From Heritage Apple Corps
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.
/* Heritage Apple Corps customizations */
$(function () {
// Logo and site name link to main website
$('#p-logo a, #p-banner').attr('href', '/site/');
// 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/">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">×</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');
});
});

