Information regarding the Club Penguin Wiki Network

The Club Penguin Wiki Network was abandoned by its tech staff. These are recreations of the original sites. Your original CPWN account will not work here. Any issues, please contact Sky.

MediaWiki:Common.js: Difference between revisions

From Club Penguin Archives
Jump to navigation Jump to search
No edit summary
No edit summary
Line 38: Line 38:
gtag('js', new Date());
gtag('js', new Date());
gtag('config', 'G-BG7QK5EC81');
gtag('config', 'G-BG7QK5EC81');
$(function () {
  $('#siteNotice').attr('aria-hidden', 'true');
});

Revision as of 19:02, 14 May 2025

/*** Any JavaScript here will be loaded for all users on every page load. ***/
/* PURGE CACHE */
$( function () {
    if ( !$( '#ca-purge' ).length && mw.config.get( 'wgIsArticle' ) ) {
        mw.util.addPortletLink(
            'p-cactions',
            mw.util.getUrl( mw.config.get( 'wgPageName' ) ) + '?action=purge', 'Purge',
            'ca-purge',
            'Purge the server cache of this page',
            '*'
        );
    }
});
/* SHOW/HIDE ROWS - By Grunny for Wookieepedia */
$( function () {
	if( !$( '.row-toggles' ).length ) {
		return;
	}
	$( '.row-toggles' ).find( 'td > a' ).click( function () {
		var	hideBtnClass = $( this ).parent().attr( 'class' ),
			$hideContent = $( 'tr.' + hideBtnClass );
		if( !$hideContent.length ) {
			return;
		}
		$hideContent.toggle();
		if ( $( this ).text().indexOf( 'hide' ) >= 1 ) {
			$( this ).text( $( this ).text().replace( 'hide', 'show' ) );
		} else {
			$( this ).text( $( this ).text().replace( 'show', 'hide' ) );
		}
	} );
} );

// Google Tag (gtag.js)
mw.loader.load('https://www.googletagmanager.com/gtag/js?id=G-BG7QK5EC81', 'text/javascript');
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-BG7QK5EC81');

$(function () {
  $('#siteNotice').attr('aria-hidden', 'true');
});