MediaWiki:Nookipedia-timeless.js

From Nookipedia, the Animal Crossing wiki
Revision as of 19:11, March 31, 2022 by Jake (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: After saving, 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)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* 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) {
				if ($('#p-logo-text').css('opacity') === '0') {
					$('#p-logo-text').css('visibility', 'visible');
					$('#p-logo-text').stop().animate({ opacity: 1 }, 250);
				}
			} else {
				if ($('#p-logo-text').css('opacity') === '1') {
					$('#p-logo-text').css('visibility', 'hidden');
					$('#p-logo-text').stop().animate({ opacity: 0 }, 250);
				}
			}
		} else {
			if ($('#p-logo-text').css('opacity') === '0') {
				$('#p-logo-text').css('visibility', 'visible');
				$('#p-logo-text').stop().animate({ opacity: 1 }, 250);
			}
		}
	}

	toggleTextLogo();
	$(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' );
});