js10gl
[0]: 

Documentation for js.html

This is a self-contained Javascript Notebook (inspired by Jupyter Notebooks).

Appearance of an example notebook ...


jsX    
[0]: 

        





Description of elements

Top elements
jsX - name of the html file (with ".html" removed)
buttons:
add - add a new interaction unit (these consist of a javascript/html input and possibly a resultant output)
RO>RW / RW>RO - make read-write(RW) / read-only(RO), this is a toggle; Helps clicking links in html text
clear - clears out all content
store - saves copy of content (within the page's data, not in a file)
restore - restores saved copy of content
save - Save to file (functions like downloading a file); For Chrome browser, want "Ask where to save each file before downloading" turned on (exact behavior varies with OS and browser)

Interaction units - there may be many of these
[n] - numbered id of unit
input text box - place to enter javascript code or html input; Below this may be an output value in a box or unboxed html rendering;
output appears below input and is boxed if it is the result of evaluation; only appears after "go" or "txt" is clicked; html output will be read-only in RO mode
buttons:
go - eval input and put result (string version of) in output box below the input box
txt - show input text via html rendering below input box
clr - clear the output box (switch to eval output); will create output box if it doesn't exist
- / + - toggle visibility of input box and go/txt/clr buttons; with html rendering hides the html markup

Bottom elements
buttons:
go last - eval last input and show result
add - add another interaction unit
go-add - Same as "go last" followed by "add"
go all - go through all interaction units evaluating and showing the results; if first non-blank character of the input is "<", then input is considered html
delete - delete the last interaction unit

Special functions available in javascript code
str(n) - nth output as string
res(n) - nth output value (not stringified)
expr(n) - nth input value as string
last() - previous output value or string (not stringified)
final() - very last output value (not stringified)
put(str) - appends value of str to output area for current executing javascript code; like printing to output box

A few additional notes:
Outputs are produced by the default rules for converting values to strings ("toString").
Evaluation is done with global context. Function definitions will be global.
Browser save ("Save page as ...") loses changes and functionality. Make sure to use the Save button.
HTML output/rendering only updated when the txt button is clicked.
When RW, the html outputs can be edited (but the "source" will not be updated). Changes will be preserved by saving.
(The CSS/JS content of this page can be moved to separate files to make very small working pages.)
You can paste text data into an input box and refer to it elsewhere using expr().


[1]: 

You can use the clear button to eliminate the documentation and create an empty notebook.