MediaWiki:Gadget-Test.js

From ARK Wiki
Jump to navigation Jump to search

In other languages: DeutschEspañolFrançaisItaliano日本語PolskiPortuguês do BrasilРусскийไทย


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: 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.
$( function () {
	if ( document.getElementById( 'ooui-test' ) ) {
		mw.loader.load( 'https://terraria.wiki.gg/wiki/MediaWiki:Gadget-oouiDemo/core.js?action=raw&ctype=text/javascript' );
	}
	if ( document.querySelectorAll( '.widetable' ).length > 0 ) {
		arkImportArticles( [ 'en:MediaWiki:FloatingTableScroll.js' ] );
	}
} );

mw.loader.using( 'ext.themes.jsapi', function () {
	mw.loader.require( 'ext.themes.jsapi' ).whenCoreLoaded( function() {
		if ( MwSkinTheme.getCurrent() === 'dark-test-fullwidth2023' ) {
			if ($('#toc').length > 0) {
				var $toc = $( '<aside id="sidebar-toc" class="toc">' )
					.append($('<p>Table of Contents</p>'))
					.append($('#toc').find( '> ul' ).clone( true ));
				var $contentBody = $( '#content > .content-body' );
				var $ads = $contentBody.find( '> .games-showcase-sidebar' );
				if ( $ads.length > 0 ) {
					$toc.insertBefore( $ads );
				} else {
					$toc.appendTo( $contentBody );
				}
			}
		}
	} );
} );