Changeset 17838 for misc/runpugs
- Timestamp:
- 09/14/07 15:28:27 (15 months ago)
- Location:
- misc/runpugs
- Files:
-
- 4 modified
-
bin/termserv.pl (modified) (1 diff)
-
data/runpugs.html (modified) (1 diff)
-
htdocs/runpugs/index.html (modified) (2 diffs)
-
htdocs/runpugs/runpugs.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
misc/runpugs/bin/termserv.pl
r16624 r17838 13 13 use Web::Terminal::Server; 14 14 use Web::Terminal::Settings; 15 $Web::Terminal::Settings::port=2059;16 15 $ENV{PUGS_SAFEMODE}=1; 17 16 my $v=1-$Web::Terminal::Settings::daemon; -
misc/runpugs/data/runpugs.html
r15408 r17838 12 12 <input type="radio" id="rel" value="0" name="reldev" _REL_ > 13 13 <input type="radio" id="dev" value="1" name="reldev" _DEV_ > 14 <select name="history" id="hist" >15 <option value="">--- Recent commands ---</option>16 _HIST_17 </select>18 14 <textarea id="cmd" name="cmd" rows="20" cols="80"> 19 15 _ALL_ -
misc/runpugs/htdocs/runpugs/index.html
r17830 r17838 6 6 <script language="JavaScript" src="runpugs.js"></script> 7 7 </head> 8 <body onunload="HandleOnUnload(event)">8 <body> 9 9 <iframe src="/perl/runpugs.pl" id="scratch" name="scratch" 10 style="visibility:hidden" width="700px" height="1px" onLoad="getreply()"></iframe> 10 style="visibility:hidden" width="700px" height="1px" 11 onLoad="getreply()"></iframe> 11 12 <div id="mainwindow"> 12 13 <h1>Run Perl 6 now -- in your browser!</h1> … … 20 21 <input id="dev" value="1" name="reldev" checked="checked" type="radio" onClick="set_version()"><label for="dev">Development version</label> 21 22 <div id="termwindow"> 22 <textarea id="cmd" name="cmd" rows="20" cols="80" wrap="virtual" 23 onkeydown="return catch_events(this,event)">Please wait while Pugs starts up...</textarea> 23 <textarea id="cmd" name="cmd" rows="20" cols="80" wrap="virtual">Please wait while Pugs starts up...</textarea> 24 24 </div> 25 25 </form> -
misc/runpugs/htdocs/runpugs/runpugs.js
r17830 r17838 5 5 var sessionid=0; 6 6 var reldev=1; 7 8 $(window).unload(function() { 9 //send :q to pugs on onload 10 $.ajax({ 11 url: '/perl/runpugs.pl?sessionid='+sessionid+'&reldev=1&ia=1&cmd=%3Aq', 12 async: false 13 }); 14 }); 15 $(document).ready( function() { 16 //document is ready now... 17 $('#cmd').keydown(function(event) { 18 return process_events(event.keyCode); 19 }); 20 }); 21 22 23 24 7 25 function getnchars() { 8 26 return document.terminal.cmd.value.length … … 41 59 } 42 60 } 43 44 function catch_events(myfield,e) {45 var keycode;46 if (e) {47 keycode = e.which;48 if(keycode) {49 return process_events(keycode);50 } else {51 if (window.event) {52 keycode = window.event.keyCode;53 if(keycode) {54 return process_events(keycode);55 } else {56 return true;57 }58 }59 }60 }61 }62 63 61 64 62 function process_events (keycode) { … … 137 135 } 138 136 139 /*140 <textarea id="cmd" name="cmd" rows="20" cols="80" wrap="virtual" onkeydown="return catch_events(this,event)" >141 Please wait while Pugs starts up...142 </textarea>143 */144 145 /* Courtesy of diakopter */146 //WV01012007: But it does not send a ':q' on close.147 //in fact, it looks like the handler is completely ignored.148 function HandleOnUnload(evt)149 {150 if ( (navigator.userAgent.toUpperCase().indexOf( "SAFARI" ) == -1) && // Exclude Safari.151 ( (document.all && window.screenLeft >= 10004) // IE moves the window 10000 pixels to the right while closing it152 || (!document.all && evt.target==null) ) ) // Firefox sets the target of the passed event to null.153 { // The window has been closed. Submit a logout request to the server.154 var expireSessionUrl='/perl/runpugs.pl?sessionid='+sessionid+'&reldev=1&ia=1&cmd=%3Aq';155 var objXMLCloser = null;156 if ( !document.all && !XMLHttpRequest ) return;157 if ( document.all ) { objXMLCloser = new ActiveXObject( "Microsoft.XMLHTTP" ) }158 else if ( XMLHttpRequest ) { objXMLCloser = new XMLHttpRequest(); }159 if (objXMLCloser) { objXMLCloser.open( 'GET', expireSessionUrl, false ); objXMLCloser.send( null ); }160 }161 }162 163 /* usage:164 165 This will work in any server-language environment that maintains session state on the server with timeouts. This will help prevent large accumulation of sessions in memory on the servers.166 167 You need to include the javascript file above.168 169 Usage: on the page where you want to trap the window close event, add the following to the body tag as follows:170 <body onunload="HandleOnUnload(event)">171 172 */
