MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   Guidance on using Sigil (https://www.mobileread.com/forums/showthread.php?t=336022)

koq 12-29-2020 12:50 AM

Guidance on using Sigil
 
Hi,

Really interested to get a depth information regarding on using Sigil especially on how to integrate Javascript...

Thank you.

Sirtel 12-29-2020 12:15 PM

Hello and welcome to MobileRead!

Please use the report button under your username (on the right side of the karma button) and ask the moderators to move your post to the Sigil subforum:
https://www.mobileread.com/forums/fo...play.php?f=203

pdurrant 12-29-2020 12:18 PM

Moved.

Doitsu 12-29-2020 12:56 PM

Quote:

Originally Posted by koq (Post 4074855)
Really interested to get a depth information regarding on using Sigil especially on how to integrate Javascript...

Sigil supports JavaScript, including local storage, but doesn't come with any special JavaScript tools, except for the Preview window, which allows you to run JavaScript.

What do you want to use JavaScript for?

koq 12-30-2020 12:57 AM

Quote:

Originally Posted by Doitsu (Post 4075002)
Sigil supports JavaScript, including local storage, but doesn't come with any special JavaScript tools, except for the Preview window, which allows you to run JavaScript.

What do you want to use JavaScript for?

Actually, I tried to use the Javascript coding from codepen.io example as my learning process to explore Sigil. However, the script did not work as in codepen. I also would like to know whether React.js can be incorporating in Sigil?

I did Javascript in external file (Misc folder) and put the name of the script file in the src (source) attribute of a <script> tag:

<script src="/Misc/myScript.js"></script>

However, it did not work..

Thank you.

Doitsu 12-30-2020 08:43 AM

Quote:

Originally Posted by koq (Post 4075290)
I also would like to know whether React.js can be incorporating in Sigil?

I haven't tested this, but in theory, all JavaScript frameworks without external dependencies should work.

Quote:

Originally Posted by koq (Post 4075290)
I did Javascript in external file (Misc folder) and put the name of the script file in the src (source) attribute of a <script> tag:

Depending on the code, you might have to explicitly reference JavaScript code with onload. For example:

Code:

<body onload="myFunction()">
Here are two very simple sample epubs with JavaScript created with Sigil:

Epub1
Epub2

However, before you spend more time on this, you might want to consider the fact that only a handful of epub3 apps actually support JavaScript.

DiapDealer 12-30-2020 10:01 AM

Quote:

Originally Posted by koq (Post 4075290)
I did Javascript in external file (Misc folder) and put the name of the script file in the src (source) attribute of a <script> tag:

<script src="/Misc/myScript.js"></script>

However, it did not work. Thank you.

Unless you've modified the structure of your epub to have the Misc folder at the root of the archive, I wouldn't expect the src path you specified to work.

I would think you'd need to provide a src path that is relative to the location of the html file the script tag is a part of.


All times are GMT -4. The time now is 10:18 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.