Patiencer / thtmlviewer

Automatically exported from code.google.com/p/thtmlviewer
0 stars 0 forks source link

add javascript support #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
 TScriptEvent = procedure(Sender: TObject; Const Name, Language, Script, Src: String);

procedure DoScript(Ascript: TScriptEvent);

    if Attributes.Find(LanguageSy, T) then
      Lang := T.Name
    else if Attributes.Find(TypeSy, T) then
      Lang := T.Name
    else Lang := '';
    if Attributes.Find(NameSy, T) then 
      AName := T.Name
    else AName := '';
    if Attributes.Find(SrcSy, T) then
      Src := T.Name
    else AName := '';

Original issue reported on code.google.com by gg-...@hotmail.com on 9 Jul 2010 at 1:34

GoogleCodeExporter commented 9 years ago
if javascript execute a document.write function, 
How can It be output to THTMLViewer?

Original comment by gg-...@hotmail.com on 9 Jul 2010 at 1:37

GoogleCodeExporter commented 9 years ago
Yes, scripting implementation in HtmlViewer is a bit sparesly.

Did you find or implement a scripting engine, that works with HtmlViewer? 
Would you contribute it to HtmlViewer? 

Unfortunately the HtmlViewer's reader is not well prepared to accept 
insertions. 

By now I will extend the TScriptEvent as you suggested, as it is outdated, but 
a script engine interface (which e.g. would allow the code insertion) is not on 
the agenda as long as there is no script engine.

Original comment by OrphanCat on 20 Sep 2010 at 5:29

GoogleCodeExporter commented 9 years ago
Is fairly easy to add scripting support, since, IActiveScript comes with 
windows and support on-the-box JavaScript and VBScript.
The hard part is that everything must be exposed as IDispatch, and also, 
htmlview don't have a DOM structure, so, will be very limited.
I have a complete IActiveScript solution, but is for delphi 2010 only, it's 
totally dependend on the new RTTI.

Original comment by harrypit...@gmail.com on 22 Mar 2012 at 1:42

GoogleCodeExporter commented 9 years ago
People like HtmlViewer because it does not depend on any external ActiveX 
resources. Thus a scripting engine for HtmlViewer has to be independend as 
well. 

I'm watching Besen at http://sourceforge.net/projects/besen, which is pure 
pascal code. I played with it a little bit and it worked fine. 

But I haven't got the time to integrate it :(

Original comment by OrphanCat on 22 Mar 2012 at 6:46

GoogleCodeExporter commented 9 years ago
Ofcourse there is a Javascript engine for Delphi! I don't know why is this not 
being implemented.

https://code.google.com/p/delphi-javascript/
http://synopse.info/fossil/artifact/5486ab7ea2d8585a8ac45d610f1e8a8478e6a8af
http://synopse.info/fossil/artifact/35ab342cf511c42496e73bb84e7c03f0bc6381ab
http://synopse.info/fossil/artifact/c0f040d9d7b4d9aa316a07279528b245eacc215a

Original comment by david.lo...@gmail.com on 29 Sep 2013 at 1:23

GoogleCodeExporter commented 9 years ago
Issue 304 has been merged into this issue.

Original comment by OrphanCat on 2 Oct 2013 at 7:51

GoogleCodeExporter commented 9 years ago
David,

Spidermonkey requires additional resources and thus we will not support it. 
See comment #4.

OrphanCat

Original comment by OrphanCat on 2 Oct 2013 at 7:58

GoogleCodeExporter commented 9 years ago
So no luck for JS support? That sucks.

Original comment by david.lo...@gmail.com on 2 Oct 2013 at 8:09

GoogleCodeExporter commented 9 years ago
BESEN has moved to http://code.google.com/p/besen/

Original comment by OrphanCat on 2 Oct 2013 at 8:19

GoogleCodeExporter commented 9 years ago
So you it can be implemented? What about the DOM?

Original comment by david.lo...@gmail.com on 2 Oct 2013 at 8:22

GoogleCodeExporter commented 9 years ago
Remmeber that currently scripting is not on the agenda. 
HtmlViewer 12 will be closer to the HTML DOM.

Original comment by OrphanCat on 2 Oct 2013 at 8:35

GoogleCodeExporter commented 9 years ago
Thats fantastic news. Full support for HTML 4 also?

Original comment by david.lo...@gmail.com on 2 Oct 2013 at 8:36

GoogleCodeExporter commented 9 years ago
Mostly. What are you missing?

Original comment by OrphanCat on 2 Oct 2013 at 8:44

GoogleCodeExporter commented 9 years ago
We just need a light replacement for TWebbrowser. :)

Original comment by david.lo...@gmail.com on 2 Oct 2013 at 8:50

GoogleCodeExporter commented 9 years ago
Why SpiderMonkey
I look at many engine before chose SpiderMonkey. 
- pure Delphi Besen http://code.google.com/p/besen/  ( bad performance 
speed/memory compared to V8 & SM)
- V8 (C++ hard to integrate with Delphi)
- Microsoft scripting host ( COM / poor API / bad performance / only for 
Windows)
I choose SpiderMonkey because:
- Stability. It is the oldest, most heavily tuned engine available. 
- Open source  with HUGE community. 
- C API – easy to integrate with Delphi
- ECMA-262 Edition 5 (and Harmony soon)
- It is very fast. Really VERY fast.

http://synopse.info/forum/viewtopic.php?pid=6298#p6298

Original comment by david.lo...@gmail.com on 3 Oct 2013 at 4:18

GoogleCodeExporter commented 9 years ago
Thanks for this quick overview. 

If you tried them, did you try them with HtmlViewer? If so, do you think that 
your integration or test code is worth to be a base or rich source for the 
HtmlViewer project?

Original comment by OrphanCat on 4 Oct 2013 at 9:55

GoogleCodeExporter commented 9 years ago
Absolutely. You cannot beat the stability and performance of SpiderMonkey. 
BESEN comes nowhere close.

Original comment by david.lo...@gmail.com on 4 Oct 2013 at 9:57