From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: Re: collapsing some headings on html export? Date: Fri, 26 Aug 2011 12:08:22 -0400 Message-ID: References: <4E56AE6B.1030903@christianmoe.com> <87mxewlfc3.wl%n142857@gmail.com> <87ippkkvlr.wl%n142857@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf3005da262fdd4e04ab6ac138 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:49049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qwz2w-0006p7-8c for emacs-orgmode@gnu.org; Fri, 26 Aug 2011 12:14:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qwz2u-0008VC-UH for emacs-orgmode@gnu.org; Fri, 26 Aug 2011 12:14:18 -0400 Received: from mail-gw0-f41.google.com ([74.125.83.41]:49926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qwz2u-0008V6-QZ for emacs-orgmode@gnu.org; Fri, 26 Aug 2011 12:14:16 -0400 Received: by gwaa20 with SMTP id a20so3217428gwa.0 for ; Fri, 26 Aug 2011 09:14:16 -0700 (PDT) In-Reply-To: <87ippkkvlr.wl%n142857@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Daniel Clemente Cc: org-mode Mailinglist --20cf3005da262fdd4e04ab6ac138 Content-Type: text/plain; charset=ISO-8859-1 On Fri, Aug 26, 2011 at 12:04 PM, Daniel Clemente wrote: > El Fri, 26 Aug 2011 09:41:38 -0400 Matt Price va escriure: > > > > On Fri, Aug 26, 2011 at 4:58 AM, Daniel Clemente > wrote: > > > I did it with this code: > > > http://www.danielclemente.com/pagina/esquemadorg.js > > > http://www.danielclemente.com/pagina/esquemadorg.css > > > > > > Demo: http://www.danielclemente.com/hacer/emacs.html > > > > ah, that's pretty cool,daniel. any suggestions for how I might > > implement this selectively, only for certain headings or heading > > levels? My javascript is I think even worse than my elisp... > > You should start by adding jQuery to your page. Then take this code > fragment: > > // handle the click event for each header > for(var i=2;i<=7;++i) { > $("h"+i).each( > function(){ > $(this).css({cursor: "pointer"}); > $(this).bind('click', function(){ > toggleForOrg_whenclicked( $(this).parent().children("div").eq(0) ); }); > }); > } > > It searches all h2, h3, h4, h5, h6, h7 elements. You can remove the loop > and use another jQuery selector which finds the headers you want. They are > like CSS selectors. For instance this should work: $("h2.myclass") or $("h2, > h4") > > For that code to work, you should copy at least these functions from > esquemadorg.js: toggleForOrg_whenclicked, hideForOrg_whenclicked, > showForOrg_whenclicked. Then add some CSS and custom behaviours. > > > fantastic, daniel. thanks so much for this. matt --20cf3005da262fdd4e04ab6ac138 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Fri, Aug 26, 2011 at 12:04 PM, Daniel= Clemente <n14285= 7@gmail.com> wrote:
El Fri, 26 Aug 2011 09:41:38 -0400 Matt Price va escriure:
>
> On Fri, Aug 26, 2011 at 4:58 AM, Daniel Clemente <n142857@gmail.com> wrote:
> ah, that's pretty cool,daniel. =A0any sugg= estions for how I might
> implement this selectively, only for certain headings or heading
> levels? =A0My javascript is I think even worse than my elisp...

You should start by adding jQuery to your page. Then take this code f= ragment:

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// handle the click event for each header =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for(var i=3D2;i<=3D7;++i) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$("h"+i).each( =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0function(){=
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0$(this).css({cursor: "pointer"});
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0$(this).bind('click', function(){ toggleForOrg_whenclicked( = $(this).parent().children("div").eq(0) ); });
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0});
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}

It searches all h2, h3, h4, h5, h6, h7 elements. You can remove the loop an= d use another jQuery selector which finds the headers you want. They are li= ke CSS selectors. For instance this should work: $("h2.myclass") = or $("h2, h4")

For that code to work, you should copy at least these functions from esquem= adorg.js: toggleForOrg_whenclicked, hideForOrg_whenclicked, showForOrg_when= clicked. Then add some CSS and custom behaviours.


fantastic, daniel.=A0 thanks so much for this.=
matt

--20cf3005da262fdd4e04ab6ac138--