| 5 | | |
| 6 | | <title>Run Perl 6 Now -- in your browser!</title> |
| 7 | | <link rel="stylesheet" type="text/css" href="/runpugs.css"> |
| 8 | | <script language="JavaScript"> |
| 9 | | var nchars=0; |
| 10 | | function getnchars() { |
| 11 | | return document.terminal.cmd.value.length |
| 12 | | } |
| 13 | | |
| 14 | | function getcursorpos() { |
| 15 | | var obj=document.terminal.cmd; |
| 16 | | if(document.selection) { |
| 17 | | obj.focus(); |
| 18 | | var rng=document.selection.createRange(); |
| 19 | | rng.moveStart('character',-nchars); |
| 20 | | return rng.text.length; |
| 21 | | } else if(obj.selectionStart>=0) { // FireFox |
| 22 | | var start = obj.selectionStart; |
| 23 | | var end = obj.selectionEnd; |
| 24 | | if (start<=end) { |
| 25 | | return start; |
| 26 | | } else { |
| 27 | | return end; |
| 28 | | } |
| 29 | | } |
| 30 | | } |
| 31 | | |
| 32 | | function catchbackspace(myfield,e) |
| 33 | | { |
| 34 | | var keycode; |
| 35 | | if (window.event) {keycode = window.event.keyCode; |
| 36 | | } |
| 37 | | else if (e) { |
| 38 | | keycode = e.which; |
| 39 | | } |
| 40 | | else return true; |
| 41 | | |
| 42 | | if (keycode == 13) |
| 43 | | { |
| 44 | | document.terminal.submit(); |
| 45 | | return false; |
| 46 | | } |
| 47 | | if (keycode==38) { |
| 48 | | return false; |
| 49 | | } |
| 50 | | if ((keycode==8)||(keycode==37)||(keycode==46)) { |
| 51 | | if ((getnchars()>nchars) && (getcursorpos() > nchars)) { |
| 52 | | return true; |
| 53 | | } else { |
| 54 | | return false; |
| 55 | | } |
| 56 | | } else { |
| 57 | | return true; |
| 58 | | } |
| 59 | | } |
| 60 | | |
| 61 | | // onkeypress="return catchbackspace(this,event)" onkeydown="return catchbackspace(this,event)" |
| 62 | | function submitenter(myfield,e) |
| 63 | | { |
| 64 | | var keycode; |
| 65 | | if (window.event) keycode = window.event.keyCode; |
| 66 | | else if (e) keycode = e.which; |
| 67 | | else return true; |
| 68 | | if (keycode == 13) |
| 69 | | { |
| 70 | | document.terminal.submit(); |
| 71 | | return false; |
| 72 | | } |
| 73 | | else { |
| 74 | | if (keycode == 8) { |
| 75 | | if (getnchars()>nchars) { |
| 76 | | return true; |
| 77 | | } else { |
| 78 | | return false; |
| 79 | | } |
| 80 | | } else { |
| 81 | | return true; |
| 82 | | } |
| 83 | | } |
| 84 | | } |
| 85 | | |
| 86 | | function select_enter() |
| 87 | | { |
| 88 | | /* _SKIPC_ |
| 89 | | document.terminal.cmdline.value=document.terminal.hist.options[document.terminal.hist.selectedIndex].value; |
| 90 | | document.terminal.hist.selectedIndex=0; |
| 91 | | document.terminal.cmdline.focus(); |
| 92 | | _SKIPC_ */ |
| 93 | | /* _SKIPT_ |
| 94 | | document.terminal.cmd.value+=document.terminal.hist.options[document.terminal.hist.selectedIndex].value; |
| 95 | | document.terminal.hist.selectedIndex=0; |
| 96 | | document.terminal.cmd.focus(); |
| 97 | | document.terminal.cmd.scrollTop =document.terminal.cmd.scrollHeight; |
| 98 | | _SKIPT_ */ |
| 99 | | } |
| 100 | | |
| 101 | | function select_enter_OFF(myfield,e) |
| 102 | | { |
| 103 | | var keycode; |
| 104 | | if (window.event) keycode = window.event.keyCode; |
| 105 | | else if (e) keycode = e.which; |
| 106 | | else return true; |
| 107 | | if (keycode == 13) |
| 108 | | { |
| 109 | | document.terminal.cmdline.value=document.terminal.hist.options[document.terminal.hist.selectedIndex].value; |
| 110 | | return false; |
| 111 | | } |
| 112 | | else |
| 113 | | return true; |
| 114 | | } |
| 115 | | </script> |
| 125 | | <input type="radio" id="rel" value="0" name="reldev" _REL_ ><label |
| 126 | | for="rel">Release version</label> |
| 127 | | <input type="radio" id="dev" value="1" name="reldev" _DEV_ ><label |
| 128 | | for="dev">Development version</label> |
| 129 | | <div id="termwindow"> |
| 130 | | <select name="history" id="hist" onChange="select_enter()"> |
| | 12 | <input type="radio" id="rel" value="0" name="reldev" _REL_ > |
| | 13 | <input type="radio" id="dev" value="1" name="reldev" _DEV_ > |
| | 14 | <select name="history" id="hist" > |
| 155 | | <script language="JavaScript"> |
| 156 | | document.terminal.enter.style.display='none'; |
| 157 | | document.terminal.cmdline.focus() // _SKIPT_ |
| 158 | | document.terminal.cmd.focus() // _SKIPC_ |
| 159 | | document.terminal.output.scrollTop =document.terminal.output.scrollHeight; // _SKIPT_ |
| 160 | | document.terminal.cmd.scrollTop =document.terminal.cmd.scrollHeight; // _SKIPC_ |
| 161 | | //if (document.terminal.output.rows==1) { |
| 162 | | //document.terminal.output.style.height="2ex"; |
| 163 | | //} |
| 164 | | nchars=document.terminal.cmd.value.length; |
| 165 | | </script> |
| 166 | | <p>This live web terminal runs the <a href="http://www.pugscode.org">pugs</a> interpreter for <a |
| 167 | | href="http://dev.perl.org/perl 6/">Perl 6</a>. Please <a |
| 168 | | href="http://feather.perl6.nl/~andara/runpugs/">read the documentation</a>. |
| 169 | | </p> |
| 170 | | <p class="copyright">© Copyright 2006 by Wim.Vanderbauwhede. Contact me |
| 171 | | at gmail.com.</p> |
| 172 | | </div> |