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 51: Line 51:
         "name": "Club Penguin Archives",
         "name": "Club Penguin Archives",
         "url": "https://archives.clubpenguinwiki.info",
         "url": "https://archives.clubpenguinwiki.info",
         "logo": "https://archives.clubpenguinwiki.info/wiki/images/thumb/4/4e/Wiki.png/200px-Wiki.png", // Replace with real logo
         "logo": "https://archives.clubpenguinwiki.info/images/archives/c/c9/Logo.png",
        "sameAs": [
            "https://www.youtube.com/@ClubPenguinArchives",
            "https://discord.gg/YOURINVITE" // Replace with real
        ]
     });
     });
     document.head.appendChild(script);
     document.head.appendChild(script);

Revision as of 19:12, 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');
});

mw.loader.using('mediawiki.util', function () {
    var script = document.createElement('script');
    script.type = 'application/ld+json';
    script.text = JSON.stringify({
        "@context": "https://schema.org",
        "@type": "Organization",
        "name": "Club Penguin Archives",
        "url": "https://archives.clubpenguinwiki.info",
        "logo": "https://archives.clubpenguinwiki.info/images/archives/c/c9/Logo.png",
    });
    document.head.appendChild(script);
});

function addMeta(name, content, prop = 'name') {
    var meta = document.createElement('meta');
    meta.setAttribute(prop, name);
    meta.setAttribute('content', content);
    document.head.appendChild(meta);
}

mw.loader.using('mediawiki.util', function () {
    addMeta('og:title', 'Club Penguin Archives', 'property');
    addMeta('og:description', 'The most comprehensive archive of Club Penguin SWFs, assets, and history.', 'property');
    addMeta('og:image', 'https://archives.clubpenguinwiki.info/images/archives/c/c9/Logo.png', 'property'); // Replace with real logo
    addMeta('og:url', window.location.href, 'property');
});

mw.loader.using('mediawiki.util', function () {
    var links = [
        { rel: 'icon', href: '/images/archives/6/64/Favicon.ico' }
    ];
    links.forEach(function (l) {
        var link = document.createElement('link');
        link.rel = l.rel;
        link.href = l.href;
        document.head.appendChild(link);
    });
});

mw.loader.using('mediawiki.util', function () {
    var link = document.createElement('link');
    link.rel = 'canonical';
    link.href = window.location.href;
    document.head.appendChild(link);
});