Changeset 18095 for misc/runpugs

Show
Ignore:
Timestamp:
09/22/07 11:27:13 (14 months ago)
Author:
azawawi
Message:

[runpugs] :tutorial functionality added
[runpugs] :next, :back tutorial functionality added
[runpugs] Passed w3c xhtml 1.0 transitional validation
[runpugs] information text loads dynamically on $(document).ready

Location:
misc/runpugs/htdocs
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • misc/runpugs/htdocs/runpugs.css

    r18081 r18095  
    11body { 
    22        font:13px arial,helvetica,clean,sans-serif; 
    3         width:100%; 
    4         margin-left:10%;margin-right:0%; margin-top: 0px;  
     3        width:85%; 
     4        margin-left:10%;margin-right:0%; margin-top: 0px; 
    55        line-height: normal;  
    66} 
     
    1313    background-color: #204a87; 
    1414        margin: 0px; 
    15     padding: 0px; 
     15    padding: 2px; 
    1616        text-align: center; 
    1717} 
    18 H2 { font-weight: bold; font-size: 11pt} 
     18H2 { font-weight: bold; font-size: 11pt; margin: 0px; padding: 0px;} 
    1919EM { font-weight: bold; font-style: normal; text-decoration:none;} 
     20code { 
     21        font-family: 'Courier New', Monaco, Courier, monospace; 
     22        background-color: black; 
     23        color: white; 
     24} 
    2025TT {color: #204a87; font-weight: bold; } 
    2126LABEL {font-weight: normal; } 
     
    116121} 
    117122pre { 
     123        background-color: black; 
    118124        color: white; 
    119         background-color: transparent; 
    120125        margin: 0; 
    121         padding: 0; 
     126        padding: 5px; 
    122127        border: none; 
    123         display:inline; 
    124128} 
    125129pre.wb_theme  { 
     
    146150        border: none; 
    147151        display:inline; 
    148 } 
    149 .note {  
    150         font:13px arial,helvetica,clean,sans-serif; 
    151         border-style: solid;  
    152         border-width: 1px;  
    153         border-color: #F0C000;  
    154         background-color: #FFFFCE;  
    155152} 
    156153span.cursorOn { 
  • misc/runpugs/htdocs/runpugs/index.html

    r18081 r18095  
    2626                    <input name="ia" value="1" type="hidden"/> 
    2727                    <input name="action" value="runpugs" type="hidden"/> 
    28                     <input id="rel" value="1" name="reldev" type="radio" checked="checked" onClick="set_version()"/> 
     28                    <input id="rel" value="1" name="reldev" type="radio" checked="checked" onclick="set_version()"/> 
    2929                    <label for="rel"><strong>Release version</strong></label>&nbsp;&nbsp; 
    30                     <input id="dev" value="1" name="reldev" type="radio" onClick="set_version()"/> 
     30                    <input id="dev" value="1" name="reldev" type="radio" onclick="set_version()"/> 
    3131                    <label for="dev"><strong>Development version</strong></label> 
    3232                </div> 
     
    4141                </div> 
    4242                <div id='status'></div> 
    43                 <div class='note' style='padding: 5px;'> 
    44                     This live web terminal runs the <a href="http://www.pugscode.org/">Pugs</a> 
    45                     interpreter for <a href="http://dev.perl.org/perl6/">Perl&nbsp;6</a>. 
    46                     This is the development version, featuring asynchronous jQuery AJAX, 
    47                     mod_perl and preloaded pugs sessions. 
    48                     <h2>Instructions</h2> 
    49                     <code>runpugs</code> presents the pugs interactive shell. <code>runpugs</code>-specific commands: 
    50                     <dl> 
    51                     <dt><code>help</code></dt><dd> displays the Pugs shell help (same as 
    52                     <code>:h</code>)</dd> 
    53                     <dt><code>clear</code></dt><dd>clears the web terminal (this command is not sent to the 
    54                     pugs shell).</dd> 
    55                     <dt><code>quit</code>, <code>bye</code></dt><dd>quit the Pugs session (same as 
    56                     <code>:q</code>)</dd> 
    57                     </dl> 
    58                     <p>Please be considerate and do <em>quit</em> your 
    59                     pugs session  before you close the browser window. 
    60                     </p> 
    61                     <h2>Restrictions</h2> 
    62                     Because this is a web terminal, a number of restrictions apply.  
    63                     Please <a href="http://feather.perl6.nl/%7Eandara/runpugs/">read the documentation</a> for more information. 
    64                     <br/><br/> 
    65                     <div class="copyright">&copy; Copyright 2006 by Wim.Vanderbauwhede. Contact me @ gmail.com<br/> 
    66                         &nbsp;&nbsp;&nbsp;&nbsp;Enhanced web terminal by Ahmad.Zawawi. Contact me @ gmail.com 
    67                     </div> 
    68                 </div> 
     43                <!-- info text will get loaded in $.onReady() --> 
     44                <div id='info' style='padding: 3px;'></div> 
    6945            </form> 
    7046        </div> 
    71         <br/> 
     47        <div class="copyright">&copy; Copyright 2006 by Wim.Vanderbauwhede. Contact me @ gmail.com<br/> 
     48            &nbsp;&nbsp;&nbsp;&nbsp;Enhanced web terminal by Ahmad.Zawawi. Contact me @ gmail.com 
     49        </div> 
    7250        <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10"  
    7351                alt="Valid XHTML 1.0!" height="31" width="88" border="0" /></a> 
    7452        <a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="http://jigsaw.w3.org/css-validator/images/vcss"  
    7553               alt="Valid CSS!" height="31" width="88" border="0"/></a> 
     54        <!-- hidden iframe is now inserted $(document).ready() --> 
    7655        <div id="hidden_iframe"></div> 
    77         <!-- 
    78         //This is now inserted automatically by jQuery to start loading things after $(document).ready() 
    79         <iframe src="/perl/runpugs.pl" id="scratch" name="scratch" style="visibility:hidden"  
    80         width="700px" height="1px" onLoad="getreply()"></iframe> 
    81         --> 
    8256    </body> 
    8357</html> 
  • misc/runpugs/htdocs/runpugs/runpugs.js

    r18081 r18095  
    1313var fixedCharWidth; 
    1414 
     15//for tutorials & school ;-) 
     16var tutorialMode = 0; 
     17var slide = 0; 
     18var slides = new Array( 
     19    'default_info.html', 
     20    'tutorial/01_helloworld.html', 
     21    'tutorial/02_vars.html', 
     22    'tutorial/03_iteration_array.html', 
     23    'tutorial/04_iteration_hash.html', 
     24    'tutorial/05_iteration_many.html', 
     25    'tutorial/06_conditionals.html', 
     26    'tutorial/07_junctions.html', 
     27    'tutorial/08_junctions_array.html', 
     28    'tutorial/09_chained_comparison.html', 
     29    'tutorial/10_io.html', 
     30    'tutorial/11_io_iteration.html', 
     31    'tutorial/12_io_reading.html', 
     32    'tutorial/13_lists_reduction.html', 
     33    'tutorial/14_lists_hyper.html', 
     34    'tutorial/15_lists_cross.html', 
     35    'tutorial/16_grammar.html', 
     36    'tutorial/17_final.html' 
     37); 
     38 
     39  
    1540//show the cursor 
    1641function showCursor() { 
     
    95120    }); 
    96121 
     122    //load default text into element id 'info' 
     123    loadSlide(); 
     124 
    97125    //start loading pugs session after page has loaded... 
    98126    $("#hidden_iframe").append( 
     
    102130}); 
    103131 
     132//load a slide into #info with an slideup/slidedown effect 
     133function loadSlide() { 
     134    if(debug) { 
     135        alert("slide url to be loaded = '" + slides[slide] + "'"); 
     136    } 
     137    $("#info").slideUp("fast"); 
     138    $.ajax({ 
     139        url: slides[slide], 
     140        async: true, 
     141        success: function(data) { 
     142            if(debug) { 
     143                alert("slide data received: " + data); 
     144            } 
     145            $("#info").html(data); 
     146            $("#info").slideDown("slow"); 
     147        } 
     148    }); 
     149} 
     150 
    104151//insert character 'ch' at index 'pos' in string str  
    105152//and return the result 
     
    133180        var tmpCmds=sessCmds.split(prompt); 
    134181        var tmpCmd=tmpCmds[tmpCmds.length-1]; 
    135         if($.trim(tmpCmd) != "") { 
     182        var trimTmpCmd = $.trim(tmpCmd); 
     183        if(trimTmpCmd != "") { 
    136184            histlist.push(tmpCmd); 
    137185        } 
    138          
     186 
     187        //for tutorial, back, next support 
     188        if(trimTmpCmd == ":tutorial") { 
     189            tutorialMode = !tutorialMode; 
     190            slide = (tutorialMode) ? 1 : 0; 
     191            loadSlide(); 
     192        } 
     193        if(trimTmpCmd == ":back" || trimTmpCmd == ":next") { 
     194            if(tutorialMode) { 
     195                if(trimTmpCmd == ":back") { 
     196                    slide--; 
     197                    if(slide < 1) { 
     198                        slide = 1; 
     199                    } 
     200                    loadSlide(slide); 
     201                } else { 
     202                    //next command 
     203                    slide++; 
     204                    if(slide >= slides.length) { 
     205                        slide--; 
     206                    } 
     207                    loadSlide(slide); 
     208                } 
     209            } 
     210        } 
    139211        if(debug) { 
    140212            alert("data to be sent: " + sessCmds);