User:Lupin/evaluator.js

//////////////////////////////////////////////////////////////// // Evaluator // Source: http://krolik.net/js-eval.shtml

var evaluatorHTML='' + '' + '' + '' + '' + '' + '';

function ObjectDump(strObject) { var strOutput; var vTemp; var vAnotherTemp; var vElement; vElement = eval(strObject); strOutput = "typeof = " + typeof(vElement) + "\n\n"; AppendOutput(strOutput); for (var x in vElement ) {   vTemp = strObject + "." + x.toString ; vAnotherTemp = strObject + "[" + x + "]" ; strOutput = strOutput + vTemp + " = " + eval(vTemp) + "\n"; AppendOutput(vTemp + " = " + eval(vTemp) + "\n"); }  return strOutput ; } function AppendOutput(strText) { document.Tester.MyResult.value = document.Tester.MyResult.value + strText; } function Output(strText) { document.Tester.MyResult.value = strText; } function ObjectDumpClicked { document.Tester.MyResult.value=""; ObjectDump(document.Tester.MyCommand.value); return false; } function TesterExecute {        document.Tester.MyResult.value=""; document.Tester.MyResult.value=eval(document.Tester.MyCommand.value); return false; }

function addEvaluator { try { var evalNode=document.createElement('div'); evalNode.id='evalNode'; evalNode.innerHTML=evaluatorHTML; document.body.appendChild(evalNode); document.Tester=document.getElementById('Tester'); } catch(err){}; }

$(addEvaluator);

// // end evaluator ////////////////////////////////////////////////////////////////