Online javascript help needed.

classic Classic list List threaded Threaded
4 messages Options
Jan Iversen-4 Jan Iversen-4
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Online javascript help needed.

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:
   but that does not work…I would really appreciate to read the url to call 

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). 
    It seems the iframe (when loaded) does not contain all the javascript needed to run it.

3) the file Kit/Kit.cpp contains a long cascade of if else statements, because commands are communicated as strings.
    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
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Pranav Kant-3 Pranav Kant-3
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Online javascript help needed.

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
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/libreoffice
>

--
Regards,
Pranav
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Jan Iversen-4 Jan Iversen-4
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Online javascript help needed.


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
OK this explains my problem.

I will see if I can get make running, or see if I can grab a bundle.js somewhere.


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.
Sorry my mistake, of course I meant file:


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

Why so ?
I am debugging the javascript in the client and saw calls the seems to leave the iframe, but maybe wrongly.


I think you mean kit/ChildSession.cpp ?
no I meant  Kit.cpp e.g line 1779.

ChildSession.cpp is only the receiver from the queue, not the executer (connection to LOkit) unless I am mistaken.

Thanks for a prompt answer.

rgds
jan I.

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Michael Meeks-5 Michael Meeks-5
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Online javascript help needed.

In reply to this post by Jan Iversen-4
Hi Jan,

        First - great to have you working on this =)

On 17/03/17 10:33, Jan Iversen wrote:
> 3) the file Kit/Kit.cpp contains a long cascade of if else statements,
> because commands are communicated as strings.
>     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.

        It is one possible optimization; but of course - it is quite nice to
have general code where we can add commands without touching all the
intermediate message multiplexers =)

> 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).

        I -think- performance issues are related to multiplexing, message
prioritizing, managing buffering, and a host of other exciting issues;
(until recently perhaps lock contention too) - at least CPU time doesn't
dominate the profiles I've seen either for the Kit prisoner or WSD.

        So in general, while I love optimization, we should profile heavily
before optimizing I think - and follow the profiles =) Of course with a
different form-factor and set of profiling tools we'll perhaps get some
new use-cases to optimize for your use-case; but even so - I'd like to
see a profile first personally.

        Thanks !

                Michael.

--
[hidden email] <><, Pseudo Engineer, itinerant idiot
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Loading...