Changeset 14885 for misc/runpugs/data

Show
Ignore:
Timestamp:
12/13/06 11:12:45 (2 years ago)
Author:
andara
Message:

[runpugs]
-Devel version now more responsive thanks to mod_perl.
It's my first mod_perl script, please test it at
http://feather.perl6.nl:8080/runpugs/
-Next release will preload Pugs to cut startup delay.

Location:
misc/runpugs/data
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • misc/runpugs/data/runpugs.html

    r14733 r14885  
    77<link rel="stylesheet" type="text/css" href="/runpugs.css"> 
    88<script language="JavaScript"> 
     9var nchars=0; 
     10function getnchars() { 
     11return document.terminal.cmd.value.length 
     12} 
    913 
     14function 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 
     32function catchbackspace(myfield,e) 
     33{ 
     34var keycode; 
     35if (window.event) {keycode = window.event.keyCode; 
     36} 
     37else if (e) { 
     38keycode = e.which; 
     39} 
     40else return true; 
     41 
     42if (keycode == 13) 
     43{ 
     44document.terminal.submit();  
     45return false; 
     46} 
     47if (keycode==38) { 
     48return false; 
     49} 
     50if ((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)" 
    1062function submitenter(myfield,e) 
    1163{ 
     
    1971return false; 
    2072} 
     73else { 
     74if (keycode == 8) { 
     75if (getnchars()>nchars) { 
     76return true; 
     77} else { 
     78return false; 
     79} 
     80} else { 
     81return true; 
     82} 
     83} 
     84} 
     85 
     86function select_enter() 
     87{ 
     88/* _SKIPC_ 
     89document.terminal.cmdline.value=document.terminal.hist.options[document.terminal.hist.selectedIndex].value; 
     90document.terminal.hist.selectedIndex=0; 
     91document.terminal.cmdline.focus(); 
     92_SKIPC_ */ 
     93/* _SKIPT_ 
     94document.terminal.cmd.value+=document.terminal.hist.options[document.terminal.hist.selectedIndex].value; 
     95document.terminal.hist.selectedIndex=0; 
     96document.terminal.cmd.focus(); 
     97document.terminal.cmd.scrollTop =document.terminal.cmd.scrollHeight;  
     98_SKIPT_ */ 
     99} 
     100 
     101function select_enter_OFF(myfield,e) 
     102{ 
     103var keycode; 
     104if (window.event) keycode = window.event.keyCode; 
     105else if (e) keycode = e.which; 
     106else return true; 
     107if (keycode == 13) 
     108{ 
     109document.terminal.cmdline.value=document.terminal.hist.options[document.terminal.hist.selectedIndex].value; 
     110return false; 
     111} 
    21112else 
    22113return true; 
     
    27118<div id="mainwindow"> 
    28119<h1>Run Perl 6 now -- in your browser!</h1> 
    29  
    30 <form id="term" name="terminal" action="/cgi-bin/runpugs" method="POST">                   
    31 <input type="hidden" name="testing" value="_TESTING_"> 
     120<form id="term" name="terminal" action="/cgi-perl/runpugs" method="POST">                   
     121<input type="hidden" name="prompt" value="_PROMPTW_"> 
    32122<input type="hidden" name="sessionid" value=""> 
     123<input type="hidden"    name="ia" value="1"> 
    33124<input type="hidden"    name="action" value="runpugs"> 
    34 <h2>Interactive Pugs Session</h2> 
    35 <!-- _MOTD_ --> 
    36125<input type="radio" id="rel" value="0" name="reldev" _REL_ ><label 
    37126for="rel">Release version</label>&nbsp;&nbsp; 
     
    39128for="dev">Development version</label> 
    40129<div id="termwindow"> 
    41 <textarea id="cmd" name="cmd" rows="23" cols="80" wrap="virtual" onKeyPress="return submitenter(this,event)"> 
    42 pugs&gt;&nbsp; 
     130<select name="history" id="hist" onChange="select_enter()"> 
     131<option value="">--- Recent commands ---</option> 
     132_HIST_ 
     133</select> 
     134<br> 
     135<!-- _SKIPT_ 
     136<textarea id="cmd" name="cmd" rows="20" cols="80" wrap="virtual" onkeypress="return catchbackspace(this,event)" onkeydown="return catchbackspace(this,event)"> 
     137_ALL_ 
    43138</textarea> 
     139_SKIPT_ --> 
     140<!--_SKIPC_ 
     141<textarea readonly id="output" name="output" rows="_NROWS_" cols="80" wrap="virtual"> 
     142_REPLYW_ 
     143</textarea> 
     144<br> 
     145<label for="cmdline"><span class="prompt"> 
     146_NPROMPTW_ 
     147</span> 
     148<input type="text" size="74" id="cmdline" name="cmdline" value="" 
     149onKeyPress="return submitenter(this,event)"> 
     150</label> 
     151_SKIPC_ -->  
    44152</div> 
    45153<input id="enter" type="submit" value="Submit">&nbsp;&nbsp;&nbsp; 
     
    47155<script language="JavaScript"> 
    48156document.terminal.enter.style.display='none'; 
    49 document.terminal.cmd.focus(); 
    50 document.terminal.cmd.scrollTop =document.terminal.cmd.scrollHeight; 
     157document.terminal.cmdline.focus() // _SKIPT_ 
     158document.terminal.cmd.focus() // _SKIPC_ 
     159document.terminal.output.scrollTop =document.terminal.output.scrollHeight; // _SKIPT_ 
     160document.terminal.cmd.scrollTop =document.terminal.cmd.scrollHeight; // _SKIPC_ 
     161//if (document.terminal.output.rows==1) { 
     162//document.terminal.output.style.height="2ex"; 
     163//} 
     164nchars=document.terminal.cmd.value.length; 
    51165</script> 
    52 <p>This live web terminal runs the <a href="http://www.pugscode.org">Pugs</a> interpreter for <a 
    53 href="http://dev.perl.org/perl 6/">Perl 6</a>. Please <a 
     166<p>This live web terminal runs the <a href="http://www.pugscode.org">pugs</a> interpreter for <a 
     167href="http://dev.perl.org/perl 6/">Perl&nbsp;6</a>. Please <a 
    54168href="http://feather.perl6.nl/~andara/runpugs/">read the documentation</a>. 
    55169</p> 
  • misc/runpugs/data/runpugs2.html

    r14743 r14885  
    125125</p> 
    126126   -->                             
    127 <form id="term" name="terminal" action="/cgi-bin/runpugs2" method="POST">                   
     127   <!-- _MOTD_ --> 
     128<form id="term" name="terminal" action="/cgi-bin/runpugs" method="POST">                   
    128129<input type="hidden" name="prompt" value="_PROMPTW_"> 
    129130<input type="hidden" name="sessionid" value=""> 
     
    134135<input type="radio" id="dev" value="1" name="reldev" _DEV_ ><label 
    135136for="dev">Development version</label> 
    136 <!-- 
    137 <br><br> 
    138 <span class="tabon">Interactive Pugs Session</span> 
    139 &nbsp;&nbsp;<a class="taboff" href="/cgi-bin/runpugs2?ia=0">Run a Perl 6 Script</a> 
    140 --> 
    141137<div id="termwindow"> 
    142138<select name="history" id="hist" onChange="select_enter()">