William Stein wrote: > On Tue, May 26, 2009 at 3:21 PM, gerhard <[email protected]> wrote: >> Still trying to formulate this... >> >> Looking at the html source of a notebook, >> it looks like the output from a cell is in its own <div>, >> so folding and unfolding the output should be straight forward >> (e.g., using code from >> http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm >> ) >> >> So a next step would be to get sections of a notebook >> into a <div>? If this can be made recursive, >> I believe I would want to be able to fold based on <hi>, i=1,2,... >> since headings using MCE have become easy to add! > > Oh, that would be really nice. Just make each <hi> section have a > folding button. That's great and very simple. > I tried that http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm > which feels cool. Does it use jQuery? Are there any folding examples > that just use jQuery?
Relevant links: http://docs.jquery.com/Effects specifically: http://docs.jquery.com/Effects/slideToggle The structure of a notebook document looks something like: <div id="cell_text_2" class="text_cell" title=""> <h1>h1 heading</h1> </div> <script></script> <div id="cell_outer_1" class="cell_visible"></div> <div id="cell_outer_3" class="cell_visible"></div> <div id="cell_text_5" class="text_cell" title=""> <h1>another h1 heading</h1> </div> So (without restructuring the notebook html), you could use jquery to select the parent of the hi with class text_cell, then select all sibling divs until you got to the next div that had an h1 heading as a child. Then just toggle all of those divs. It's probably one line of jquery. Somehow, you'd have to tag each hi with the appropriate javascript code. This is probably doable from the text cell creation code (see the code that creates the <script> tag above; it is generated on the fly when a text cell is rendered from cell.py). It's also probably doable from both the html insertion code in the main javascript code, or also from tinymce. Jason -- Jason Grout --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
