Difference between revisions of "MediaWiki:Common.js"

From Helderberg Hilltowns of Albany County, NY
 
 
(4 intermediate revisions by the same user not shown)
Line 10: Line 10:


$('#menu-toggle').click(function(){
$('#menu-toggle').click(function(){
$('#aht-footer').toggleClass('position-fixed');
$('#aht-footer').toggleClass('position-fixed full-height');
});
});


$(function() {
$(function() {
$('#toc ul').addClass('aht-toc').detach().appendTo('#aht-sidebar');
$('#aht-footer .aht-footer-menu.social a.fas, #aht-footer .aht-footer-menu.social a.far, #aht-footer .aht-footer-menu.social a.fab').show().addClass('d-flex');
$('#aht-footer .aht-footer-menu.social a.fas, #aht-footer .aht-footer-menu.social a.far, #aht-footer .aht-footer-menu.social a.fab').show().addClass('d-flex');
$('#mw-navigation [href="/Special:UserLogin"]');
});
});



Latest revision as of 13:35, May 17, 2022

/* Any JavaScript here will be loaded for all users on every page load. */

$('#aht-banner').insertBefore('#ayso-subcontent');	

$('#aht-subcontent-wrapper').prepend($('#subcontent'));

$('.page-Main_Page #firstHeading').appendTo($('.main-page-visible > div:first-of-type'));

$('#aht-footer .aht-footer-menu.social a.fas, #ayso-footer .aht-footer-menu.social a.far, #aht-footer .aht-footer-menu.social a.fab').empty();

$('#menu-toggle').click(function(){
	$('#aht-footer').toggleClass('position-fixed full-height');
});

$(function() {
	$('#aht-footer .aht-footer-menu.social a.fas, #aht-footer .aht-footer-menu.social a.far, #aht-footer .aht-footer-menu.social a.fab').show().addClass('d-flex');	
	$('#mw-navigation [href="/Special:UserLogin"]');
});

var resizeId;

$(window).resize(function() {
    clearTimeout(resizeId);
    resizeId = setTimeout(doneResizing, 500);
});

function doneResizing(){
	$( "#aht-banner" ).load(window.location.href + " #aht-slides" );
}

$.fn.isInViewport = function() {
    var elementTop = $(this).offset().top;
    var elementBottom = elementTop + $(this).outerHeight();

    var viewportTop = $(window).scrollTop();
    var viewportBottom = viewportTop + $(window).height();

    return elementBottom > viewportTop && elementTop < viewportBottom;
};

$(window).on('resize scroll', function() {
	if ($('#aht-footer').isInViewport()) {
		$('#aht-sidebar').css({"height": "calc(100% - 54px - 210px )"});
	} else {
		$('#aht-sidebar').css({"height": "calc(100% - 54px )"});
	}
});