Diferencia entre revisiones de «MediaWiki:Launchpad.js»

De musiki
Sin resumen de edición
Sin resumen de edición
Línea 6: Línea 6:
*/
*/
init: function () {
init: function () {
if ( $( '.launchpad' ).length ) {
var launchpads = $( '#launchpad' )
if ( launchpads.length ) {
mw.loader.load( '/index.php?title=MediaWiki:Launchpad.css&action=raw&ctype=text/css', 'text/css' );
mw.loader.load( '/index.php?title=MediaWiki:Launchpad.css&action=raw&ctype=text/css', 'text/css' );
mw.loader.getScript( '//cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js' ).then( function () {
mw.loader.getScript( '//cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js' ).then( function () {
mw.loader.getScript( '//cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/addons/p5.dom.min.js' ).then( function () {
mw.loader.getScript( '//cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/addons/p5.dom.min.js' ).then( function () {
$( '#launchpad' ).each( Launchpad.build );
launchpads.each( Launchpad.build );
});
});
});
});

Revisión del 15:09 9 abr 2019

var Launchpad = {

	/**
	 * Initialization script
	 * Load p5 and the CSS, and then build the GUI for each launchpad
	 */
	init: function () {
		var launchpads = $( '#launchpad' )
		if ( launchpads.length ) {
			mw.loader.load( '/index.php?title=MediaWiki:Launchpad.css&action=raw&ctype=text/css', 'text/css' );
			mw.loader.getScript( '//cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js' ).then( function () {
				mw.loader.getScript( '//cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/addons/p5.dom.min.js' ).then( function () {
					launchpads.each( Launchpad.build );
				});
			});
		}
	},

	build: function () {
		setup();
	}
};

$( Launchpad.init );

function setup() {
	canvas = createCanvas(710, 400);
	canvas.parent( 'launchpad' );

	input = createInput();
	input.position(20, 65);

	button = createButton('submit');
	button.position(input.x + input.width, 65);
	button.mousePressed(greet);

	greeting = createElement('h2', 'what is your name?');
	greeting.position(20, 5);

	textAlign(CENTER);
	textSize(50);
}