Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old Yesterday, 02:06 PM   #1
phillipgessert
Addict
phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.
 
phillipgessert's Avatar
 
Posts: 320
Karma: 3200000
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
Order of linked Javascripts

As a part of my workflow, I import and link two Javascript files early in a given project. I need em in a certain order, but I haven't yet been able to figure out how to get them to come in that way. It doesn't seem to insert them into the <head> alphabetically, and the order I click em in the import dialogue doesn't seem to affect it either.

It's just two files, so I usually just reorder them manually before splitting files per-chapter. But I was curious if there might be something I can do to get them to come in in the desired order in the first place. Is there?

Last edited by phillipgessert; Yesterday at 02:09 PM.
phillipgessert is offline   Reply With Quote
Old Yesterday, 02:28 PM   #2
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,047
Karma: 6361556
Join Date: Nov 2009
Device: many
I think those links are placed immediately before the head end tag. So inserting them in order should work.

I will take a look at the code and get back to you.
KevinH is online now   Reply With Quote
Old Yesterday, 03:02 PM   #3
slm
Fool
slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.
 
Posts: 492
Karma: 4660650
Join Date: Feb 2003
Device: Kindle: Voyage,PW1,KOA, Kobo: Clara Colour, Nook GLP, Pocketbook verse
JavaScript links load asynchronously, so the second one may complete its fetch before the first one does even though the first link makes its fetch request earlier.. The fetched content (the "src" attributed) will be loaded into the open document in the order received from the relevant server(s).
slm is online now   Reply With Quote
Old Yesterday, 03:31 PM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,047
Karma: 6361556
Join Date: Nov 2009
Device: many
I think he was talking about the order the link statements are inserted into the head tag or each xhtml file. I think, without any "async" or "defer" their order in head determines their order of execution once the body has been fully loaded.

Okay, I just got to my desktop and fired it up and created an epub with 4 xhtnml files and two javascript files named "Script0001.js" and Script0002.js".

I then selected the 4 html files in BookBrowser and right clicked and included them.

They were inserted in that order in every xhtml file.

Are you seeing something different?

If I wanted the order to be reversed, I simply select the xhtml files I want to add the links too, and then right clicked and selected Link Javascripts... and when the javascript selection window opened I used the up down caret keys on the right side of dialog to swap the order of the javascript files making Script0002.js come first (and made sure they were all checked).

See the attached image.

Sigil then used that order of linking.

So I can not recreate what you are seeing about linkage order?
Attached Thumbnails
Click image for larger version

Name:	Screenshot 2025-10-15 at 3.33.11 PM.png
Views:	7
Size:	69.5 KB
ID:	218648  

Last edited by KevinH; Yesterday at 03:46 PM.
KevinH is online now   Reply With Quote
Old Yesterday, 04:44 PM   #5
phillipgessert
Addict
phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.
 
phillipgessert's Avatar
 
Posts: 320
Karma: 3200000
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
Quote:
Originally Posted by KevinH View Post
I think he was talking about the order the link statements are inserted into the head tag or each xhtml file. I think, without any "async" or "defer" their order in head determines their order of execution once the body has been fully loaded.

Okay, I just got to my desktop and fired it up and created an epub with 4 xhtnml files and two javascript files named "Script0001.js" and Script0002.js".

I then selected the 4 html files in BookBrowser and right clicked and included them.

They were inserted in that order in every xhtml file.

Are you seeing something different?

If I wanted the order to be reversed, I simply select the xhtml files I want to add the links too, and then right clicked and selected Link Javascripts... and when the javascript selection window opened I used the up down caret keys on the right side of dialog to swap the order of the javascript files making Script0002.js come first (and made sure they were all checked).

See the attached image.

Sigil then used that order of linking.

So I can not recreate what you are seeing about linkage order?
Thanks a ton. It doesn't happen for me consistently, so (naturally) I can't duplicate it right now either. I just tried a few sample runs, and they came in as intended no matter what I did. They come in in reverse occasionally, so the next few times I do it, I'll try to make a mental note of exactly what I did, and report it back here when that happens.

Sorry for raising the issue when I don't have an example in hand, it's something I've worked with off an on for a few months and, Murphy's Law, naturally right now it's working precisely like it's supposed to.
phillipgessert is offline   Reply With Quote
Old Yesterday, 05:02 PM   #6
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,047
Karma: 6361556
Join Date: Nov 2009
Device: many
Figures! If you can ever figure out how to reproduce it, please do let me know. There could be a dictionary or map that does not keep order someplace in the execution but I could not see one.

This code was copied almost 100% from the link css files code as stylesheet order is important as the last sheet wins in case both are present. So it should be order consistent and preserving for the order generated by the dialog that selects the javascripts.
KevinH is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Order multi-series storyline in reading order plaid Kobo Reader 2 02-23-2023 04:30 PM
Default to allow javascripts to open windows KevinH Sigil 5 08-01-2021 07:14 AM
Linked Resource Does Not Exist dbird Editor 18 10-10-2017 02:22 PM
Collections created in cloud don't order themselves by alphabetical order septentrion Amazon Kindle 4 12-25-2016 12:21 AM
PRS-950 Order a 950 delivered now (not pre-order) for $239.99 sun surfer Sony Reader 2 12-16-2010 11:06 AM


All times are GMT -4. The time now is 04:50 PM.


MobileRead.com is a privately owned, operated and funded community.