newLISP in a browser

Started by Lutz, January 02, 2014, 01:43:18 PM

Previous topic - Next topic

HPW

#30
Hello,



When I eval this code nothing appear in the Output pane

(silent(print "Hello World"))


When I add a n then all pevious print Outputs appear including the last eval:

(silent(print "Hello Worldn"))


Regards
Hans-Peter

Lutz

#31
This happens on all browsers. They - the Emscripten folks - seem not to flush the output buffer until they find a line feed. Nothing we can do about it, adding a line feed to silent would undo it's purpose.



I added your keyword manual search, great that it also works on selections!



Also added replacing trailing "?" with "p" e.g.: protectedp instead of protected? in search keywords to make it work for the manual when searching property functions. Made the text box a bit smaller to not overflow to the next line when working on the iPad.



Also added more mobile specific stuff to get max possible rows on iPad, the browse button will stay disabled on most mobile devices.



http://www.newlisp.org/downloads/development/inprogress/newlisp-js-10.5.7.zip">http://www.newlisp.org/downloads/develo ... 10.5.7.zip">http://www.newlisp.org/downloads/development/inprogress/newlisp-js-10.5.7.zip



ps: to your licensing question: yes, it's the same as for the DLL



ps: enter key now also works for the keyword search



ps: keyboard shortcuts for buttons: Ctrl-L for <clear>, Ctrl-X for <eval>, Ctrl-J for <JS>



ps: Ctrl-O to open the file browser

HPW

#32
Quote
ps: keyboard shortcuts for buttons: Ctrl-L for <clear>, Ctrl-X for <eval>, Ctrl-J for <JS>

ps: Ctrl-O to open the file browser


In IE 11 (win 7) the hotkeys Ctrl-X and Ctrl-J and Ctrl-O appear as letters in the textarea after executing.

Chrome works fine.



Regards
Hans-Peter

HPW

#33
Hello,



CTRL-X is not so good since it is yet the cut to clipboard command for the textarea.

So whne I hit CTRL-X in chrome when a word is selected, it starts first the eval and then cutout the word.



Regards
Hans-Peter

Lutz

#34
Meanwhile I could test on a Windows 8 machine. The result is, all but two keyboard shortcuts have been thrown  out. But the most important ones stayed with a different key for eval:



Ctrl-enter - eval button - evaluate newLISP source

Ctrl-L - clear button - clear editor box



These two keyboard shortcuts seem to work on Windows and Mac OSX platforms and browsers including IE-11 on Windows 8. Have not tested any older IE's.



http://www.newlisp.org/downloads/development/inprogress/newlisp-js-10.5.7.zip">http://www.newlisp.org/downloads/develo ... 10.5.7.zip">http://www.newlisp.org/downloads/development/inprogress/newlisp-js-10.5.7.zip



Also added +,- buttons to make the editor box bigger or smaller. The console box will then change accordingly.

Lutz

#35
More tweaking to accomodate an additional button and still make everything fit into 1024x768 pixels on a standard iPad or iPad mini.



A new button to replace the current page with an HTML page, contents of the editbox. All three components of a an app: newLISP, JavaScript and HTML or any mix of it can now be developed in this IDE clientside.



A second function - specific to newLISP compiled to a JavaScript lib - has been added display-html. This function does a similar thing as the HTML button. It replaces the current page with a new page from the HTML string parameter in  display-html.



As an example of how to make an application for 'newLISP in a web browser' the file app.html has been added to the package. There is also a link to it on README.html page.



http://www.newlisp.org/downloads/development/inprogress/">http://www.newlisp.org/downloads/develo ... nprogress/">http://www.newlisp.org/downloads/development/inprogress/



There are still minor issues when using single ' in JavaScript in some situation. Use double quotes instead. The file app.html has some comments about it.

HPW

#36
Quotedisplay-html


Cool, interesting and powerfull.
Hans-Peter

Lutz

#37
Just solved the single quote ' problem. It is now safe to use single quotes with strings in JavaScript also with JavaScript inside HTML. It was already safe when using JavaScript with eval-string-js



http://www.newlisp.org/downloads/development/inprogress/newlisp-js-10.5.7.zip">http://www.newlisp.org/downloads/develo ... 10.5.7.zip">http://www.newlisp.org/downloads/development/inprogress/newlisp-js-10.5.7.zip



both functions eval-string-js and display-html are also documented in the reference.

HPW

#38
Just downloaded the latest zip from development.



The output-area gets placed below the open-file button outside the screen (Chrome 31 on WIN XP)

Colors are a matter of taste, but I do not like the dark background.

The colors before did better fit to the doc.



Regards
Hans-Peter

Lutz

#39
I cannot test on Windows until next week. When the log window snaps below the edit window, widen the browser window a little bit and it will snap back. Or make the font size smaller with Ctrl- , then click the layout button twice.

Lutz

#40
More tweaks and a new button c to switch the colors between a light and a dark theme.



Tested on:

Windows 8.0 with IE, Firefox, Chrome

Mac OSX with Safari, Firefox, Chrome

iOS iPad mini (1024x768) Safari



http://www.newlisp.org/downloads/development/inprogress/newlisp-js-10.5.7.zip">http://www.newlisp.org/downloads/develo ... 10.5.7.zip">http://www.newlisp.org/downloads/development/inprogress/newlisp-js-10.5.7.zip



ps: the HTML button now will open a new browser tab

HPW

#41
Hello,



Looks good now and works perfectly.



Tested on:

Windows 7.0 with IE, Chrome

Windows XP with Chrome (IE 8 does not work)

Android Handy Samsung Galaxy S3 mini



One little problem on the Android: When select code in the input area the selected text gets not placed into the keyword-input. (texted with native browser and chrome)



Edit: Here is a link with some code for the Android select problem. Maybe usable.

http://stackoverflow.com/questions/11427403/how-to-get-touchend-to-behave-just-like-mouseup">http://stackoverflow.com/questions/1142 ... ke-mouseup">http://stackoverflow.com/questions/11427403/how-to-get-touchend-to-behave-just-like-mouseup



Does it work on IOS?



Regards
Hans-Peter

Lutz

#42
Thanks for doing all the testing on different devices and browsers.



What you are seeing on Android is the same on iOS. But the fact that you have to copy-paste the keyword selection for the doc search into the text input, instead of it happening on mouse-up, is not a problem. On a touch device it may be even faster to input the keyword with the keyboard.



The JavaScript newlispEvalStr(...) function now returns a string, just like the original newlisp.dylib/so/dll would do.



Now you can write applications where client-side newLISP code, HTML and JavaScript are all integrated into one HTML page. This is the new demo app demonstrating this (1):



http://www.newlisp.org/newlisp-js/app.html">http://www.newlisp.org/newlisp-js/app.html



and the whole package:



http://www.newlisp.org/downloads/development/inprogress/newlisp-js-10.5.7.zip">http://www.newlisp.org/downloads/develo ... 10.5.7.zip">http://www.newlisp.org/downloads/development/inprogress/newlisp-js-10.5.7.zip



(1) do 'view source' on your browser to see how it is done in a small page plus newlisp-js-lib.js



ps: there are no length restrictions of JavaScript anymore in eval-string-js

Lutz

#43
Some UI changes to accommodate the new save button. It does save the current editor content to the browser local storage. This is a storage area on your local device offered by all mayor browsers. After save, you can shut down the browser. When you load the editor again it automatically retrieves the last editor content.



The size of newlisp-js-lib.js and it's compressed version have also been reduced and there are some changes to the README page accessible with info button and app.html accessible from the README page.



http://www.newlisp.org/downloads/development/inprogress/newlisp-js-10.5.7.zip">http://www.newlisp.org/downloads/develo ... 10.5.7.zip">http://www.newlisp.org/downloads/development/inprogress/newlisp-js-10.5.7.zip



You can now develop in all three languages: newLISP, JavaScript and HTML and any mixture of the three on the desktop/laptop or a mobile device (currently optimized for iOS with 1024x768 pixels). Have not tried on an retina iPad which has more pixels but the same screen proportions.

Lutz

#44
Eliminated errant behavior when using cleaned out browser or using a browser for the first time with the editor/IDE.

 

The eval button now only prints the return values of the last expression, more working like the newLISP 'load' function or the JS button when evaluating JavaScript.



The TAB key now works inside the  editor area inserting 4 spaces. Before, it would leave the editor text box jumping to the next HTML control on the page.



A better visible cursor when the editor area has a dark background.



http://www.newlisp.org/downloads/development/inprogress/newlisp-js-10.5.7.zip">http://www.newlisp.org/downloads/develo ... 10.5.7.zip">http://www.newlisp.org/downloads/development/inprogress/newlisp-js-10.5.7.zip