PDA

View Full Version : parsing Javascript for links to follow


tichkiir
07-22-2004, 05:57 PM
I pull a lot of docs from fanfiction.net, and I'd like to just specify the first chapter of a story and have it automatically pull all chapters by following links. However, iSiloX isn't quite building the links correctly from the javascript based menu fanfiction.net uses.

The code is:
<TD ALIGN=RIGHT><SELECT Name=chapter onChange="self.location =

'/s/1334280/'+ this.options[this.selectedIndex].value + '/';"><option

value=1 selected>1. The Mission<option value=2 >2. Missing

Photo's<option value=3 >3. Revelations<option value=4 >4.

Package's<option value=5 >5. Discussions<option value=6 >6. Black and

White<option value=7 >7. Strange Happenings<option value=8 >8.

What?<option value=9 >9. An Avatar?<option value=10 >10. Denial<option

value=11 >11. Discoveries<option value=12 >12. A Morning Talk<option

value=13 >13. Surprise!<option value=14 >14. Start Again<option

value=15 >15. A Swim, Anyone?<option value=16 >16. The Breaking

Point<option value=17 >17. A Second Chance<option value=18 >18. The

Final Form<option value=19 >19. A Joke?<option value=20 >20.

Reactions<option value=21 >21. The Falling Out<option value=22 >22. Old

Habits Die Hard<option value=23 >23. Something Unexpected<option

value=24 >24. Acceptance at Last<option value=25 >25. A Step

Backwards<option value=26 >26. An Honest Mistake<option value=27 >27.

An Unwelcome Guest<option value=28 >28. A Confrontation<option value=29

>29. A Strange Comfort<option value=30 >30. A Weight Relieved<option

value=31 >31. Shopping, and a Meeting<option value=32 >32.

Consequences<option value=33 >33. Interesting Things<option value=34

>34. Return to Ye Old<option value=35 >35. The Past Repeats<option

value=36 >36. A Parents Heartache<option value=37 >37. The

Transition<option value=38 >38. A Goodbye and A Greeting<option

value=39 >39. Hogwarts<option value=40 >40. The Sorting and School

Starts<option value=41 >41. Explosions for Sale<option value=42 >42.

Altercations<option value=43 >43. Make Ups and Falling Outs<option

value=44 >44. Reflecting<option value=45 >45. We Have a Problem<option

value=46 >46. Growing Pains<option value=47 >47. A Confession and

Discovery<option value=48 >48. A Web Unravelling</select><INPUT

TYPE=BUTTON Value='&nbsp;&nbsp;»&nbsp;&nbsp;'

onClick="self.location='/s/1334280/2/'"></TD>

and the link isilox is building is "/s/1334280/1/X" where X is the chapter number. That "/1/" part shouldn't be there.
If this isn't a bug, or is just something that's going to remain - can you sugges any way to work around it besides manually entering all chapters as seperate pages of the doc manually?

Tich

iSilo
07-22-2004, 07:10 PM
It's not a bug. iSiloX just does not have JavaScript support. It only supports specific cases of menus created with the select/option tags. First, the onchange attribute of the select tag must satisfy one of the following two conditions:

1. It starts with the text "GoURLValue".
2. Or it has the text "location" followed by "value", with any number of characters between them.

If either of the above holds, then for each enclosed option tag, iSiloX takes the value attribute of the option tag to be the URL to jump to.

So in the HTML that you have included, those numbers are interpreted as a relative URL to the current URL. If the current URL is "/s/1334280/1/", then for the first option, the first URL resolves to "/s/1334280/1/1", the second resolves to "/s/1334280/1/2", and so on.

So you would need to add each of the chapters to the source list.