jcryptool / crypto

JCrypTool Crypto Plug-ins
https://www.cryptool.org
Eclipse Public License 1.0
68 stars 39 forks source link

Add the possibility to load javascript files in the online help #319

Closed simlei closed 4 years ago

simlei commented 4 years ago

For improving the online help further it seems unavoidable to introduce our own javascript based code. The goal of this issue / feature request is to have a directory "javascript" in org.jcryptool.core.help, where .js files are stored that can be loaded in the body of online help .html files as follows:

in org.jcryptool.core.help:

├── javascript
│   ├── jct-misc.js
│   └── jct-styling.js

and in the head of a .html file that contains an online help page:

<!-- ... -->
<script>loadJCTScript("javascript/jct-misc.js")</script>
<script>loadJCTScript("javascript/jct-styling.js")</script>
<!-- ... -->

Of course there has to be some kind of bootstrapping JS code which makes the loadJCTScript functionality available. However, the authors of .html code should not have to worry about it. The reason why this has to be dynamical is, that at the time of writing the .html code, the author can't know on which local port the help system is served (static addresses that reference html look like this: http://localhost:32772/index.html, where the part 32772 changes with each JCT startup).

I have already a proof-of-concept implementation of a local jetty webserver which serves .js files to the help system; what remains is bootstrapping it and a neat demonstration project so that others can copy how this is done.

The mechnism used to inject javascript code into existing help pages (webapp/contentFilter extension point)

simlei commented 4 years ago

Implemented.

How it works:

TODO: detail this in a wiki page more in-depth + command line parameter

Goodies

For convenience of Javascript developers, JCT can now start up to open the help system, even at a specific location. To achieve this. the command line parameter -StartupHelp has been introduced. For now, It has to be the last argument on the command line (TODO: change this / parse better). After that command line parameter, another argument may follow that specifies the help location to be opened.

image

The syntax for the help content location is <plugin-name>/<path-to.html>. An example of this for the RSA plug-in can be seen in the above screenshot. Note, that path elements that denote language-specific branches of the file system, like nl/en, have to be replaced with $nl$.