Difference between revisions of "MediaWiki:Nookipedia-timeless.js"

From Nookipedia, the Animal Crossing wiki
m
Tag: Undo
(Fine, we'll do it the boring way)
Line 21: Line 21:
 
$(window).resize(toggleTextLogo);
 
$(window).resize(toggleTextLogo);
 
 
/* Open Social/API links in new tab/window */
+
/* Open Social links in new tab/window */
$( '#p-navigation-list' ).find( 'li a' ).filter( \"[href^='https://']\" ).attr( 'target' , '_blank' );
+
$( '#n-Discord' ).find( 'a' ).attr( 'target' , '_blank' );
 +
$( '#n-Twitter' ).find( 'a' ).attr( 'target' , '_blank' );
 +
$( '#n-Instagram' ).find( 'a' ).attr( 'target' , '_blank' );
 +
$( '#n-Facebook' ).find( 'a' ).attr( 'target' , '_blank' );
 
});
 
});

Revision as of 14:29, June 1, 2021

/* Any JavaScript here will be loaded for users using the Timeless skin */
/*
   JavaScript for Timeless is also loaded from the following gadgets:
     MediaWiki:Gadget-CollapsibleNav.js
*/

$(document).ready(function() {
	/* On desktop, display text logo once user scrolls down */
	function toggleTextLogo() {
		if ($(window).width() > 1099) {
			if ($(window).scrollTop() > 130) {
				$('#p-logo-text').fadeIn();
			} else {
				$('#p-logo-text').fadeOut();
			}
		} else {
			$('#p-logo-text').fadeIn();
		}
	}
	$(window).scroll(toggleTextLogo);
	$(window).resize(toggleTextLogo);
	
	/* Open Social links in new tab/window */
	$( '#n-Discord' ).find( 'a' ).attr( 'target' , '_blank' );
	$( '#n-Twitter' ).find( 'a' ).attr( 'target' , '_blank' );
	$( '#n-Instagram' ).find( 'a' ).attr( 'target' , '_blank' );
	$( '#n-Facebook' ).find( 'a' ).attr( 'target' , '_blank' );
});