## to protect against loss of information whilst constructing patterns ${{ var workIsDone = false; window.onbeforeunload = confirmBrowseAway; function confirmBrowseAway() { if (!workIsDone) { return "Are you sure? If you leave this page now, your work will NOT be saved."; } }; }}$; ## from Tim Monks - procedure for manipulating REs in the search box: proc showObservables { ${{ $('#symbol-search > .side-bar-topic-title').click(); $('#observable-search').val(arguments[0]); }}$; } proc showFunctions { ${{ $('#functions > .side-bar-topic-title').click(); $('#functions-search').val(arguments[0]); }}$; } include("jspe.js-e"); ixpara = 1; paratext is paragraphs[ixpara]; ## make a JS-EDEN function which is written in JScript: ## useful resource: http://www.regular-expressions.info/javascriptexample.html ## providing for sentences ending in ? or ! func splitintosentences { ${{ var paragraph = arguments[0]; var result = []; while (/[.?!]\ .*[.?!]/.exec(paragraph)) { result = result.concat(paragraph.replace(/[.?!]\ (.*)/.exec(paragraph)[1], "")); paragraph = /[.?!]\ (.*)/.exec(paragraph)[1]; }; ## console.log(paragraph); return result.concat(paragraph); }}$; } /* OLD VERSION func splitintosentences { ${{ var paragraph = arguments[0]; var result = []; while (/[.?!].*[.?!]/.exec(paragraph)) { result = result.concat(paragraph.replace(/[.?!]\ (.*)/.exec(paragraph)[1], "")); paragraph = /[.?!]\ (.*)/.exec(paragraph)[1]; }; ## console.log(paragraph); return result.concat(paragraph); }}$; } */ allsentences is splitintosentences(paratext); ixsentence = 1; sentencessofar is ixsentence % (allsentences# + 1); ## required to compensate for a flaw in the JS-EDEN parser: func getlscomp { return $1[$2]; } func firstksentences { para sentencelist, k; auto i, result; result = "
";
for (i=1; i ";
}
result = result // sentencelist[k] // " ";
for (i=1; i ";
}
result = result // sentencelist[sentencelist#] // " " // parasofarread // "Realising Software Development as a Lived Experience
");
header is Div("header", leftmargin, 42, rightmargin, 50, "" // currsection // "
");
picture is [textdisp, nextsentence, nextparagraph, backbutt, header, title];
paraSlides = [];
## setting the initial value of paragraphs
allparasplusslides is allparas // paraSlides;
showObservables("paragraphs|sec|notes|abst|ixpara");
#############################################################
## adapting original textpresenter to work with the JSPE - using as template:
buttonPrev is SlideButton("buttonPrev","Previous Slide", jspeleft, ${{ $('#jspe').height()+15 }}$, buttonPrevEnabled);
nextsentence is Button("nextsent", nextsentencelab, jspeleft-280, ${{ $('#jspe').height()+15 }}$, nextsentenceenabled);
nextparagraph is Button("nextpara", nextparalab, jspeleft-500, ${{ $('#jspe').height()+15 }}$, nextparaenabled);
backbutt is Button("lastpara", "Previous paragraph", jspeleft-680, ${{ $('#jspe').height()+15 }}$, ixpara>1);
## made several attempts at adding a project button - probably a useful addition
## issues seem to be: definition will not be triggered for update as a result of
## update of the height of the slide canvas, which is here specified in JScript via JQuery
## still not quite sure about why button remains on top wherever listed in the picture spec
## but above definition makes sure the button appears whenever the width of the canvas is tweaked
projectionMode = 0;
buttonProjLab is ( projectionMode == 1) ? "Withdraw Slide" : "Project Slide";
## buttonProj is SlideButton("buttonProj", buttonProjLab, leftmargin, ${{ $('#jspe').height()+15 }}$, true);
## buttonProj is Button("buttonProj", buttonProjLab, max(jspeleft-1000, leftmargin), ${{ $('#d1canvas').height()+15 }}$, true);
buttonProj is SlideButton("buttonProj", buttonProjLab, max(jspeleft-1000, leftmargin), ${{ $('#jspe').height()+15 }}$, true);
proc projSlide : buttonProj_clicked {
if (buttonProj_clicked) {
projectionMode = 1 - projectionMode;
if (projectionMode) {
${{
$('#d1canvas').css("border-style", "")
$('#jspe').css("background-color", "lightblue")
$('#jspe_slide').css({"background-color":"lightblue", "font-size":"200%"});
}}$;
}
else {
${{
$('#d1canvas').css("border-style", "solid")
$('#jspe').css("background-color", "")
$('#jspe_slide').css({"background-color":"", "font-size":"100%"});
}}$;
}
buttonProj_clicked = 0;
}
}
picture is [textdisp, nextsentence, nextparagraph, backbutt, header, title, buttonProj];
## picture is [buttonProj, textdisp, nextsentence, nextparagraph, backbutt, header, title];
########################################################
## making paragraphs dynamic - e.g. based on selection by containing a key word
func findwordix {
${{
var target = arguments[0];
var paras = root.lookup("allparasplusslides").cached_value;
var result = [];
for (var ix = 0; ix