java script:with(window.open(%22%22,%22_blank%22,%22width=%22+screen.width*.6+%22,left=%22+screen.width*.35+%22,height=%22+screen.height*.9+%22,resizable,scrollbars=yes%22)){document.write(%22<head><title>JavaScript Development Environment 2.0.1</title></head><frameset rows=\%2225,*,*\%22>\n\n <frame name=\%22toolbarFrame\%22 src=\%22about:blank\%22 noresize=\%22noresize\%22>\n\n <frame name=\%22inputFrame\%22 src=\%22about:blank\%22>\n\n <frame name=\%22outputFrame\%22 src=\%22about:blank\%22>\n\n</frameset>\n\n%22);document.close(); frames[0].document.write(%22<head><title>toolbarFrame</title>\n\n\n\n<style type=\%22text/css\%22>\nhtml,body { width: 100%25; height: 100%25; border: none; margin: 0px; padding: 0px; }\nbutton { height: 100%25; }\n</style>\n\n<script type=\%22text/javascript\%22>\n\nvar outputFrame = parent.outputFrame;\nvar inputFrame = parent.inputFrame;\nvar framesetElement = parent.document.documentElement.getElementsByTagName(\%22frameset\%22)[0];\n\nvar savedRows;\n\n\n// Need to use C-style comments in handleError() and print() \n// because IE retains them when decompiling a function.\n\n\n\nfunction print(s, c) {\n var outputFrame = parent.outputFrame; /* duplicated here in case this function is elsewhere */\n var doc = outputFrame.document;\n\n var newdiv = doc.createElement(\%22div\%22);\n newdiv.appendChild(doc.createTextNode(s));\n if ©\n newdiv.style.color = c;\n doc.body.appendChild(newdiv);\n}\n\nfunction handleError(er, file, lineNumber) \n{\n print(\%22Error on line \%22 + lineNumber + \%22: \%22 + er, \%22red\%22); \n \n /* Find the character offset for the line */\n /* (code adapted from blogidate xml well-formedness bookmarklet) */\n var ta = inputFrame.document.getElementById(\%22input\%22);\n var lines = ta.value.split(\%22\\n\%22);\n var cc = 0; \n var i;\n for(i=0; i < (lineNumber - 1); ++i) \n cc += lines[i].length + 1;\n\n /* Hacky(?) workaround for IE's habit of including \\r's in strings */\n if (ta.value.split(\%22\\r\%22).length > 1)\n cc -= lineNumber - 1;\n\n /* Select the line */\n if(document.selection) { \n /* IE (Leonard Lin gave me this code) */\n var sel = ta.createTextRange(); \n sel.moveStart(\%22character\%22, cc); \n sel.collapse(); \n sel.moveEnd(\%22character\%22, lines[i].length); \n sel.select();\n } else { \n /* Mozilla */\n ta.selectionStart = cc; \n ta.selectionEnd = cc + lines[i].length; \n }\n \n /* return true; */ /* nah, let the error go through to IE's js consolish thing! */\n}\n\n\n\n\n\nfunction showHideOutput()\n{\n if (outputFrame.document.body.clientHeight > 100) {\n // hide\n savedRows = framesetElement.rows; \n framesetElement.rows = \%2225,*,0\%22;\n }\n else {\n // show. use the previous size, if possible\n if (savedRows) {\n framesetElement.rows = savedRows;\n savedRows = null;\n }\n else {\n framesetElement.rows = \%2225,*,*\%22;\n }\n }\n}\n\nfunction refocus()\n{\n inputFrame.document.getElementById(\%22input\%22).focus();\n}\n\n\nfunction clearOutput()\n{\n var b = outputFrame.document.body;\n while(b.firstChild)\n b.removeChild(b.firstChild);\n}\n\nfunction stripLineBreaks(s)\n{\n return s.replace(/\\n/g, \%22\%22).replace(/\\r/g, \%22\%22); // stripping \\r is for IE\n}\n\nfunction execute()\n{\n var js = inputFrame.document.getElementById(\%22input\%22).value;\n\n var useOpener = parent.opener && !parent.opener.closed;\n var oldStyle = !! document.all; // lame but meh.\n \n print(\%22Running\%22 + (useOpener ? \%22 in bookmarklet mode\%22 : \%22\%22) + (oldStyle ? \%22 in make-IE-happy mode\%22 : \%22\%22) + \%22...\%22, \%22orange\%22);\n\n if (useOpener)\n executeWithJSURL(js, parent.opener); // only way to execute against another frame\n else if (oldStyle)\n executeWithDW(js, execFrame); // only way to get line numbers in IE\n else\n executeWithJSURL(js, execFrame); // faster in Mozilla \n}\n\n// Advantages: can get line numbers in IE.\nfunction executeWithDW(js, win)\n{\n win.document.open();\n win.inputFrame = inputFrame;\n win.outputFrame = outputFrame;\n win.document.write(\n stripLineBreaks(\n '<!DOCTYPE HTML PUBLIC \%22-//W3C//DTD HTML 4.01//EN\%22 \%22http://www.w3.org/TR/html4/strict.dtd\%22>' +\n '<html><head><title>execFrame<\\/title><script type=\%22text/javascript\%22>'\n + print // yay for decompilation!\n + handleError \n + \%22window.onerror = handleError;\%22\n + \%22<\\/script><\\/head>\%22\n ) \n + '<body><script type=\%22text/javascript\%22>'\n + js // should escape it a little to remove the string <\\/script> at least...\n + \%22<\\/script><\\/body><\\/html>\%22\n );\n win.document.close();\n}\n\n// Advantages: can be used to inject a script into another window, faster in Mozilla.\nfunction executeWithJSURL(js, win)\n{\n // isolate scope\n js = \%22(function(){ \%22 + js + \%22 \\n })()\%22;\n\n win.print = print;\n win.onerror = handleError;\n\n // double encodeURIComponent because java script: URLs themselves are encoded!\n win.location.href = 'java script:eval(decodeURIComponent(\%22' + encodeURIComponent(encodeURIComponent(js)) + '\%22)); void 0;';\n \n refocus();\n}\n\n// Other ideas I haven't tried lately: create a <script> element, eval.\n\n\nfunction makeUserScript(userScriptLink)\n{\n userScriptLink.href = \n \%22data:text/javascript;charset=utf-8,\%22 + \n encodeURIComponent(inputFrame.document.getElementById(\%22input\%22).value + \%22//.user.js\%22);\n}\n\n</script></head><body>\n\n<button accesskey=\%22E\%22 onclick=\%22execute(); refocus();\%22><u>E</u>xecute</button>\n\n<button accesskey=\%22C\%22 onclick=\%22clearOutput(); refocus();\%22><u>C</u>lear output</button>\n<button accesskey=\%22S\%22 onclick=\%22showHideOutput(); refocus();\%22><u>S</u>how/hide output</button>\n\n\n<a href=\%22data:text/html,...\%22 onfocus=\%22makeUserScript(this);\%22 onmouseover=\%22makeUserScript(this);\%22 target=\%22_blank\%22>Install as user script</a>\n\n<div style=\%22visibility: hidden;\%22>\n<iframe name=\%22execFrame\%22 src=\%22about:blank\%22 height=\%225\%22 width=\%225\%22></iframe>\n</div>\n\n</body>%22); frames[0].document.close(); frames[1].document.write(%22<head><title>inputFrame</title>\n\n\n\n\n\n<style type=\%22text/css\%22>\n\nhtml,body,form,textarea { width: 100%25; height: 100%25; border: none; margin: 0px; padding: 0px; }\nhtml,body { overflow: hidden; }\n\n</style></head><body onload=\%22document.getElementById('input').select();\%22>\n<textarea style=\%22background-color: rgb(221, 238, 255);\%22 id=\%22input\%22>// ==UserScript==\n// @namespace
http://www.squarefree.com/jsenv/autogenerated\n// @name Unnamed script\n// @description Undescribed script\n// ==/UserScript==\n\nprint(\%22Squares of numbers 0 through 4:\%22);\nfor (var i = 0; i < 5; ++i)\n print(i * i);\n\nthis.statement.causes(an.error);\n</textarea>\n</body>%22); frames[1].document.close(); }void 0