emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sebastian Rose <sebastian_rose@gmx.de>
To: Benny Simonsen <benny@slbs.dk>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: Highlight current page in TOC
Date: Wed, 24 Nov 2010 18:13:40 +0100	[thread overview]
Message-ID: <87vd3mpruj.fsf@gmx.de> (raw)
In-Reply-To: <AANLkTinf5Kpk59=xWdpuhRXBA1p_wV5qPOJ9pMq4fe6t@mail.gmail.com> (Benny Simonsen's message of "Mon, 22 Nov 2010 21:06:40 +0100")

Benny Simonsen <benny@slbs.dk> writes:

> 2010/11/14 Benny Simonsen <benny@slbs.dk>
>>
>> Hi
>>
>> With the org-info-js mode enabled each section is shown as a seperate
>> page, but then I would like to get current page marked in the TOC in
>> some way (e.g. class=current and then some CSS to make the markup)
>> ... but is it possible?
>>
>> /Benny
>
> Hi
>
> I have made it.
>
> The result can be seen on a example page I have made (in danish -
> (translated org-info-src.js [1] it into danish)) -
> http://slbs.dk/org/oensker.html
>
> I have modified org-info-src.js [1] to include an extra function
> setLinkClass + using this function at the end of showSection.
> I have also added a small css script [2] with the extra content, which
> could be included in the normal worg.css [3] without side effects, I
> think.
> I include one css - main.css [4] that includes the two css files
> mentioed here + an extra file with my own site style.'
>
> Except the changes in my site slbs.css, the only style changes I have made are:
> - Current page/section are marked black and bold
> - Visited pages are marked in different color
>
> Anyone interested in a patch for the highlighting of the links?
> Anyone interested in a patch for the danish org-info-src.js?
>
> [1] http://slbs.dk/org/scripts/org-info-src.marklinks.js
>      ... in danish: http://slbs.dk/org/scripts/org-info-src.da.marklinks.js
>      ... in danish without modifications:
> http://slbs.dk/org/scripts/org-info-src.da.js
> [2] http://slbs.dk/org/style/marklink.css
> [3] Copy from http://orgmode.org/worg/worg.css
> [4] http://slbs.dk/org/style/main.css - Which includes the other css files
>
> I have also included lightbox-2.04, and changed it so that a group is
> limited to one visible page(one section)
>
>
> Best regards
> Benny Simonsen


Hi Benny!


That's very beautiful with fixed T.O.C!


I have added a modified version of your patch (just the "className" part
of it).

The sections now reference their anchor HTML-Element in the TOC passed
as an additional parameter in the constructor OrgNode (in the function
`mkNodeFromHref()').  This might lead to problems in old Internet
Explorers when leaving the page - but in old ones.



I guess the cleanest way to add actions to org-info.js is to add hooks
and use them this way (e.g. in the HTML <head> section):


#+STYLE: <script type="text/javascript">
#+STYLE:   org_html_manager.onReady(
#+STYLE:      function(){alert("Page is loaded, setup finished.");});
#+STYLE:   org_html_manager.onShowSection(
#+STYLE:      function(sec){alert(sec.H);});
#+STYLE: </script>


That's what I'm working at currently:

Just gimme an hour.  You can then hook in your LightBox function.

Note: currently the names in sources and compressed scripts are
different (see `sed.txt').   We should change that in the future for
some widely used variables (like OrgNode.H <=> OrgNode.HEADING).


Best wishes

   Sebastian

  reply	other threads:[~2010-11-24 17:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-14 16:51 Benny Simonsen
2010-11-22 20:06 ` Benny Simonsen
2010-11-24 17:13   ` Sebastian Rose [this message]
2010-11-24 19:00     ` Sebastian Rose
2010-11-30 20:27       ` Sebastian Rose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vd3mpruj.fsf@gmx.de \
    --to=sebastian_rose@gmx.de \
    --cc=benny@slbs.dk \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: Re: Highlight current page in TOC' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).