Revision 600617 of "Extension:ProcessingJs" on mediawikiwiki

{{XSS alert}}
{{Extension|templatemode=
|name          = processingjs
|status        = experimental
|type1         = Tag
|type2         =
|hook1         = 
|hook2         =
|username      = <!-- optional, but strongly recommended (this comment must be removed and the parameter must be blank if you want it to auto choose the username) -->
|author        = Cédric Doutriaux
|description   = integrate [[http://processingjs.org processingjs]] scripts in mediawiki
|image         = <!-- http://processingjs.org/images/header.png This will not work as it must be a local or commons image -->
|imagesize     =
|version       = 0.1
|update        =
|mediawiki     =
|php           =
|license       = <!-- what license your extension is released under -->
|download      = 
|readme        =
|changelog     =
|parameters    = <!-- configuration parameters, for use in LocalSettings.php -->
|tags          =
|rights        = <!-- user rights, for use with $wgGroupPermissions -->
|example       = http://fablabo.net/mediawiki/index.php?title=Extension:processingjs
|compatibility = 
}}

{{Extension code on wiki}}

==What can this extension do?==

This extension give the possibility to integrate [http://processingjs.org processingjs] scripts in a mediawiki

==Usage==
<nowiki><processingjs></nowiki>

<source lang="java">
void setup(){
  size( 200, 200 );
  strokeWeight( 10 );
}
void draw(){
  background(0);
  ellipse( mouseX, mouseY, 100, 100 );          
}
</source>
<nowiki></processingjs></nowiki>

==Code==
<source lang="php">

<?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' );

}
</source>

==Download instructions==
<!-- Revise these instructions if code is available via a download site. -->
Please copy and paste the code found [[#Code|below]] and place it in <code>$IP/extensions/processingjs/processingjs.php</code>.
Download https://github.com/downloads/processing-js/processing-js/processing-1.3.6.min.js and place this file in the folder  <code>$IP/extensions/processingjs/</code>

{{note|[[Manual:$IP|$IP]] stands for the root directory of your MediaWiki installation, the same directory that holds [[Manual:LocalSettings.php|LocalSettings.php]].}}

==Installation==

To install this extension, add the following to [[Manual:LocalSettings.php|LocalSettings.php]]:
<source lang="php">
#add configuration parameters here
#setup user rights here
require_once("$IP/extensions/processingjs/processingjs.php");
</source>

===Configuration parameters===
<!-- Explain the purpose of each configuration parameter provided to Template:Extension. -->

===User rights===
<!-- Explain the purpose of each user right provided to Template:Extension. -->

==See also==
<!-- Add other related extensions here, if applicable. If not, just delete this comment and the “See also” header. -->