MediaWiki:Common.js: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
mw.loader.load('//cdn.jsdelivr.net/npm/canvas-confetti@1.9.3/dist/confetti.browser.min.js');
mw.loader.load('//developer.valvesoftware.com/w/index.php?title=User:PabloS/blast.js&action=raw&ctype=text/javascript');
$( function () {
$( function () {
if ( $( '#ca-purge' ).length || !mw.config.get( 'wgIsArticle' ) ) return;
if ( $( '#ca-purge' ).length || !mw.config.get( 'wgIsArticle' ) ) return;
Line 13: Line 10:
'*'
'*'
);
);
    function waitFor(functionName, callback) {
        function check() {
          if (typeof window[functionName] === "function") {
            callback();
          } else {
            requestAnimationFrame(check);
          }
        }
        check();
    }
    waitFor("blast", function() {
        blast();
    });
});
});

Latest revision as of 09:33, 23 November 2024

/* Any JavaScript here will be loaded for all users on every page load. */
$( function () {
	if ( $( '#ca-purge' ).length || !mw.config.get( 'wgIsArticle' ) ) return;
	mw.util.addPortletLink(
		'p-cactions',
		mw.util.getUrl( null, { action: 'purge' } ),
		"Purge",
		'ca-purge',
		'Purge the server cache of this page',
		'*'
	);
});