Extension:ProcessingJs

From MediaWiki.org
Jump to: navigation, search


MediaWiki extensions manual
Crystal Clear action run.png
processingjs

Release status: experimental

Implementation Tag
Description integrate [processingjs] scripts in mediawiki
Author(s) Cédric Doutriaux
Latest version 0.1
License No license specified
Download No link
Example http://fablabo.net/mediawiki/index.php?title=Extension:processingjs

Translate the ProcessingJs extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

What can this extension do?[edit | edit source]

This extension give the possibility to integrate processingjs scripts in a mediawiki

Usage[edit | edit source]

<processingjs>

void setup(){
  size( 200, 200 );
  strokeWeight( 10 );
}
void draw(){
  background(0);
  ellipse( mouseX, mouseY, 100, 100 );          
}

</processingjs>

Code[edit | edit source]

<?php
/**
*               last change: 2012-03-29
*      EXTENSION PROCESSINGJS
* Cédric Doutriaux [email protected]
*                                                                                         *
*******************************************************************************************/ 
 
 
 
$wgExtensionFunctions[] = 'processingjs';
$wgExtensionCredits['parserhook'][] = array(
	'path' => __FILE__,
        'name' => 'processingjs',
        'description' => 'intégration de scripts processingjs',
        'author' => 'Cédric Doutriaux',
        'url' => 'http://fablabo.net/mediawiki/index.php?title=Extension:processingjs'
);
 
function processingjs() {
        global $wgParser;
        $wgParser->setHook('processingjs', 'renderPJS');
 
}
 
function renderPJS($input){
$output .="<script src=\"extensions/processingjs/processing-1.3.6.min.js\"></script>
<script type=\"text/processing\" target=\"processing-canvas-$id\">".$input."</script>
<canvas id=\"processing-canvas-$id\"> </canvas>";
 
return array( $output, "markerType" => 'nowiki' );
 
}

Download instructions[edit | edit source]

Please copy and paste the code found below and place it in $IP/extensions/processingjs/processingjs.php. Download https://github.com/downloads/processing-js/processing-js/processing-1.3.6.min.js and place this file in the folder $IP/extensions/processingjs/

$IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation[edit | edit source]

To install this extension, add the following to LocalSettings.php:

#add configuration parameters here
#setup user rights here
require_once("$IP/extensions/processingjs/processingjs.php");

Configuration parameters[edit | edit source]

User rights[edit | edit source]

See also[edit | edit source]