Ah, sorry, i overlooked wfCalculator function, which is not correct, i think, please use:
function wfCalculator(Parser $parser) {
$parser->setFunctionHook( 'calc', 'renderCalculator' );
return true;
}
And then add a function to the hook BeforePageDisplay to add your javascript file:
$wgHooks['BeforePageDisplay'][] = 'onBeforePageDisplay';
function onBeforePageDisplay( &$out, &$skin ) {
$out->addScriptFile(__DIR__ . '/calculator.js', $wgStyleVersion);
}
After this you can implement your ParserHook:
function renderCalculator( $parser, $arg ) {
$output = '';
$output .= '<form name="data";">';
$output .= '<table bgcolor="#FFFFFF"><tr><td>';
$output .= '<textarea name="tarea" cols="30" rows="10" wrap="off"/>';
$output .= $arg;
$output .= '</textarea></td><td><textarea name="result" cols="20" rows="10" value=""/></textarea></td></tr>';
$output .= '<tr><td><input type="button" value="calculate" onclick="calculate()"/></td>';
$output .= '<td><input type="button" value="delete" onclick="delete_all()"/></td>';
$output .= '</tr></table>';
$output .= '</form>';
$output .= '</center>';
// Output for a parser hook isn't set via OutputPage, you just return the content (the tag will be replaced with this return)
return $output;
}
Something like this. Hope you can work with this :)