Shuffle <ol> list in JCloze, and display a maximum of 10 <li> items

17 views
Skip to first unread message

Robin Reeves

unread,
Mar 2, 2026, 4:07:37 PM (11 days ago) Mar 2
to hotpotatoesusers
Hi Sean,

I often want to do what you are asking. The Shuffle routine Agnès has recommended works really well and although I often have 20 or more lines with gaps, I ask my students to just do the first 10 lines and ignore the rest. I can always reload the page to get another random order.

I guess this is my low tech/code solution.
Regards,
Robin


Agnès S.

unread,
Mar 5, 2026, 1:43:05 AM (9 days ago) Mar 5
to hotpotat...@googlegroups.com
Hi Sean and Robin,

I wrote the JCloze JavaScript code to respond to your request.

Here's the result:
https://hpaddons.pages-perso.free.fr/provisoire/JCloze_JMix_Sean/capitales.htm

You need to create your exercise with this pattern:
<ol id="list">
<li id="li1"> your text with only one gap </li>
<li id="li2"> your text with only one gap </li>
etc.
</ol>
and specify the number of lines required in Options>Configure
Output>Custom>User-define String #1 [strUserDefined1]
See capitales.jcl
https://hpaddons.pages-perso.free.fr/provisoire/JCloze_JMix_Sean/capitales.jcl

Here's the new javascript:
https://hpaddons.pages-perso.free.fr/provisoire/JCloze_JMix_Sean/source/jcloze7.js_

Please test it and son't be afraid to report any problems.

Cheers,
Agnès S.
> --
> You received this message because you are subscribed to the Google
> Groups "hotpotatoesusers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to hotpotatoesuse...@googlegroups.com
> <mailto:hotpotatoesuse...@googlegroups.com>.
> To view this discussion, visit https://groups.google.com/d/msgid/
> hotpotatoesusers/724532d9-
> ef69-4eb6-865d-5ff1a2280408n%40googlegroups.com <https://
> groups.google.com/d/msgid/hotpotatoesusers/724532d9-
> ef69-4eb6-865d-5ff1a2280408n%40googlegroups.com?
> utm_medium=email&utm_source=footer>.

Agnès S.

unread,
Mar 6, 2026, 2:54:14 AM (8 days ago) Mar 6
to Robin Reeves, hotpotat...@googlegroups.com
Hi Robin,

Thank you for the detailed account of your procedure.

A possible explanation for the error:

> I saved the file in this folder and called it 'jcloz7.js'

It must be jcloze7.js_. (with an 'e' after jcloz and an underscore at
the end)
Perhaps it's just a typo in your email... but

> Looking at the code in your HTM file for capitales.htm I was missing the lines in Screenshot6 which I copied and pasted into my HTM file

I suppose other lines were missing.
that leads me to believe that you don't use the correct jcloze7.js_,
certainly because of the alleged error mentioned above.

For your information the repairs you have made to your HTM file are
perfect but incomplete. All the modified parts in the begin with
'modified by AS' or 'addition by AS'


Screenshot2 leads me to assume that you usually use HP7+.
If the test result with the version of the file I provided (derived
from the original JCloze) is positive, I will transpose the
modifications to JCloze for HP7+.


I hope it helps.

Agnès S.
https://hpaddons.pages-perso.free.fr/



Le 05/03/2026 à 18:06, Robin Reeves a écrit :
> Hi Agnès
>
> Thank you very much for taking the time and trouble to do this for Sean
> and me.
>
> I haven't quite got it working yet, probably because I have missed
> something out on my computer.
>
> I have tried your example file capitales.htm by following the link:
> https://hpaddons.pages-perso.free.fr/provisoire/JCloze_JMix_Sean/
> capitales.htm <https://hpaddons.pages-perso.free.fr/provisoire/
> JCloze_JMix_Sean/capitales.htm>
> and it worked fine.
>
> I went to
> https://hpaddons.pages-perso.free.fr/provisoire/JCloze_JMix_Sean/source/
> jcloze7.js_ <https://hpaddons.pages-perso.free.fr/provisoire/
> JCloze_JMix_Sean/source/jcloze7.js_>
> and saw the new javascript.
> I selected it all and copied it into a new tab in Notepad.
> I created a new folder 'JSean' in my HP7_Add_ons folder, then another
> folder inside it called 'source'. I saved the file in this folder and
> called it 'jcloz7.js'.
>
> I then went to your link:
> https://hpaddons.pages-perso.free.fr/provisoire/JCloze_JMix_Sean/
> capitales.jcl <https://hpaddons.pages-perso.free.fr/provisoire/
> JCloze_JMix_Sean/capitales.jcl>
> and saw the code. I selected all the code and copied it into a new file
> in Notepad.
>
> Inside the 'JSean' folder I created a new folder called 'demo' and then
> saved the Notepad file as 'capitales.jcl'
>
> I then double-clicked on 'capitales.jcl' and it opened in my copy of JCloze.
> I then changed the lines slightly so that they appear as in my attached
> Screenshot1.
> When I looked at Custom>User-defined String #1 the line was empty. I
> decided to put in a 4 to see if I got 4 lines of questions.
>
> I then used Options>Set Source location and chose what I thought was the
> correct source file - see Screenshot3
>
> When I generated the HTM file it gave me all 7 rows - see Screenshot4.
>
> When I looked at my HTM file in Visual Studio I could see the questions
> and answers - see Screenshot5.
>
> Looking at the code in your HTM file for capitales.htm I was missing the
> lines in Screenshot6 which I copied and pasted into my HTM file
>
> I also found that your additional code in lines 1053 to 1089, just after
> function StartUp(){
> ...
> }
>
> were missing, so I copied and pasted those into my HTM file. I saved my
> HTM file as capitales_v2.htm and then double-clicked it.
>
> It worked but with 3 lines, not 4 as I expected. - see Screenshot7.
>
> It seems like I'm nearly there but not quite. Have you any suggestions
> please?
>
> Thanks again,
> Robin
>
>
> ------------------------------------------------------------------------
> *From:* hotpotat...@googlegroups.com
> <hotpotat...@googlegroups.com> on behalf of Agnès S.
> <agnes...@gmail.com>
> *Sent:* 05 March 2026 06:42
> *To:* hotpotat...@googlegroups.com <hotpotat...@googlegroups.com>
> *Subject:* Re: [hotpotatoesusers] Shuffle <ol> list in JCloze, and
> display a maximum of 10 <li> items
> Hi Sean and Robin,
>
> I wrote the JCloze JavaScript code to respond to your request.
>
> Here's the result:
> https://hpaddons.pages-perso.free.fr/provisoire/JCloze_JMix_Sean/
> capitales.htm <https://hpaddons.pages-perso.free.fr/provisoire/
> JCloze_JMix_Sean/capitales.htm>
>
> You need to create your exercise with this pattern:
> <ol id="list">
> <li id="li1"> your text with only one gap </li>
> <li id="li2"> your text with only one gap </li>
> etc.
> </ol>
> and specify the number of lines required in Options>Configure
> Output>Custom>User-define String #1 [strUserDefined1]
> See capitales.jcl
> https://hpaddons.pages-perso.free.fr/provisoire/JCloze_JMix_Sean/
> capitales.jcl <https://hpaddons.pages-perso.free.fr/provisoire/
> JCloze_JMix_Sean/capitales.jcl>
> jcloze7.js_ <https://hpaddons.pages-perso.free.fr/provisoire/
> JCloze_JMix_Sean/source/jcloze7.js_>
>
> Please test it and son't be afraid to report any problems.
>
> Cheers,
> Agnès S.
>
> Le 02/03/2026 à 22:07, Robin Reeves a écrit :
>> Hi Sean,
>>
>> I often want to do what you are asking. The Shuffle routine Agnès has
>> recommended works really well and although I often have 20 or more lines
>> with gaps, I ask my students to just do the first 10 lines and ignore
>> the rest. I can always reload the page to get another random order.
>>
>> I guess this is my low tech/code solution.
>> Regards,
>> Robin
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "hotpotatoesusers" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to hotpotatoesuse...@googlegroups.com
>> <mailto:hotpotatoesuse...@googlegroups.com
> <mailto:hotpotatoesuse...@googlegroups.com>>.
>> To view this discussion, visit https://groups.google.com/d/msgid/ <https://groups.google.com/d/msgid/>
>> hotpotatoesusers/724532d9-
>> ef69-4eb6-865d-5ff1a2280408n%40googlegroups.com <https://
>> groups.google.com/d/msgid/hotpotatoesusers/724532d9-
>> ef69-4eb6-865d-5ff1a2280408n%40googlegroups.com?
>> utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "hotpotatoesusers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to hotpotatoesuse...@googlegroups.com.
> To view this discussion, visit https://groups.google.com/d/msgid/
> hotpotatoesusers/621659c5-08a5-4d4d-84d9-9704d18f0493%40gmail.com
> <https://groups.google.com/d/msgid/
> hotpotatoesusers/621659c5-08a5-4d4d-84d9-9704d18f0493%40gmail.com>.

Reply all
Reply to author
Forward
0 new messages