Online javascript help needed.

Pranav Kant pranavk at collabora.co.uk
Fri Mar 17 11:10:56 UTC 2017


Hi,

On 17/03/17 16:03, Jan Iversen wrote:
> Hi.
>
> I am trying to reuse the online javascript in a webkit frame, the setup
> works in general, but I have a couple of questions, which seems
> unanswered in the available doc.
>
> I want to start online as we use it for ESC. I have a file URL so I am
> ready to start LO with a document:
>
> 1) looking in loleaflet main.js seems like the natural, but how exactly
> should the call be:
>    Assuming host = myHost, directory=loleaflet, I would have assumed the
> call should be something like:
>    https://myHost/loleaflet/main.js?url=//http:myHost/myDocs/myDocument.odt
>    but that does not work…I would really appreciate to read the url to call

main.js is not the js file that is supposed to be used by the browsers 
directly. It is used by the js build system to generate the final 
bundle.js file which resides in loleaflet/dist/bundle.js (and generated 
when you do 'make' in loleaflet directory)

You load the appropriate html file normally, which then loads all the js 
files, so something like

myHost/loleaflet/dist/loleaflet.html?file_path=your_url

and this <your_url> needs to be a file url, so something like 
file:///home/janiv/doc.odt, not a http url to some other location on the 
web, because in that case you need to implement your own WOPI host, like 
owncloud/nextcloud etc.

>
> 2) The current main builds a topline menu, similar (but limited) to the
> desktop version. I would like to take advantage of the “natural” menus,
> so is it posible  to start the javascript and eliminate the menus
> (basically only have the iframe and the content).

Not without any tweaks in the js/css/html. One would need to introduce 
some flags that removes/hides the toolbar and the menubar from the top 
and extend the content area to maximum (using CSS).

>     It seems the iframe (when loaded) does not contain all the
> javascript needed to run it.

Why so ?

>
> 3) the file Kit/Kit.cpp contains a long cascade of if else statements,
> because commands are communicated as strings.

I think you mean kit/ChildSession.cpp ?

>     is this on purpose ? why not have an Kit_enum.hpp that is converted
> to Kit_enum.js and then have the commands be numbers. The advantage
> would be we can use simple switch statements which are a lot faster (and
> looking at the performance during the esc-meeting, we could do with
> better performance).
>    in case this is a wanted feature, I can make a gerrit patch, so it
> can be properly reviewed.
>
> Thanks in advance for a prompt answer.
> rgds
> jan I.
>
>
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/libreoffice
>

-- 
Regards,
Pranav


More information about the LibreOffice mailing list