Diferencia entre revisiones de «MediaWiki:Launchpad.js»

De musiki
Sin resumen de edición
Sin resumen de edición
Línea 25: Línea 25:


function setup() {
function setup() {
canvas = createCanvas(710, 400);
div = createDiv( 'All OK!' );
canvas.parent( 'launchpad' );
div.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);
}
}

Revisión del 15:11 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() {
	div = createDiv( 'All OK!' );
	div.parent( 'launchpad' );
}