diff -u /home/dto/Downloads/index.org /home/dto/orginfo/index.org --- /home/dto/Downloads/index.org 2022-12-13 11:41:43.022078142 -0500 +++ /home/dto/orginfo/index.org 2022-12-13 12:17:18.460761688 -0500 @@ -192,8 +192,8 @@ version 0.0.7.3a (fixed in current Org-mode versions). If you export with =skip:nil=, you may add this to your stylesheet: : #text-before-first-headline {color:red;font-weight:bold;} -+ Hooks :: The OrgHtmlManager object provides hooks (two currently) to add - custom actions. ++ Hooks :: There are several hooks to add custom actions. See the + section "Hooks" for more information. * Shortcuts :PROPERTIES: @@ -703,8 +703,15 @@ :CUSTOM_ID: hooks :END: -Currently two hooks are provided. Each hook function is called with one or -more parameters the first of which is the OrgHtmlManager object. +Two styles of hooks are supported: Standard hooks (which use +OrgHtmlManager and require a bit of bookkeeping) and simple hooks, +which are JavaScript variables that hold a function. + +** Standard hooks + +Currently two standard hooks are provided. Each hook function is +called with one or more parameters the first of which is the +OrgHtmlManager object. - '~onReady~' :: This hook is run once the document is loaded, the view is setup and the startup section is shown. The second parameter @@ -714,7 +721,6 @@ first section. The second parameter is an object with to OrgNodes: the previously shown section and the current section. - To add functions to the hooks, fill a global object ~orgInfoHooks~ with the function objects you need. This is necessary, because code added via the ~#+STYLE:~ option lines is executed before org-info.js is loaded. @@ -748,6 +754,50 @@ could happen otherwise (the hook loop will overlook a member. While the hook loop runs in first hook first, the remove loop removes the last hook first). +** Simple hooks + +Simple hooks are just JavaScript variables that point to particular +functions that OrgInfo will call. There are two simple hooks thus far: +=OrgInfoPageInsertFunction= and =OrgInfoAfterNavigateFunction=. + +If you assign your own functions to these variables, be sure to do so +after OrgInfo has loaded, or they will not work. You can do so from an +org file like this: + +#+begin_src org + #+begin_export HTML + + #+end_export +#+end_src + +*** OrgInfoPageInsertFunction + +The variable =OrgInfoPageInsertFunction= should hold a JavaScript +function that accepts an integer identifying which OrgInfo section +header to insert HTML into. The function should return a string +consisting of HTML to insert into the dynamic page header that OrgInfo +builds for each section. + +*** OrgInfoAfterNavigateFunction + +The variable =OrgInfoAfterNavigateFunction= should hold a JavaScript +function that accepts an integer identifying which OrgInfo section has +been switched to. The function should do whatever user-defined action +is desired. Any return value is ignored. + * How it works First of all the script is included in the header as described in [[#setup][Setup]]. The Diff finished. Tue Dec 13 12:17:37 2022