diff -u /home/dto/Downloads/org-info-src.js /home/dto/notebook/org-info-src.js --- /home/dto/Downloads/org-info-src.js 2022-12-10 11:47:20.086746072 -0500 +++ /home/dto/notebook/org-info-src.js 2022-12-12 11:48:20.471441625 -0500 @@ -28,30 +28,57 @@ * * * - * The script is now roughly devided in sections by form-feeds. Editors can - * move section wise using the common emacs commands for this purpos ('C-x ]' - * and 'C-x ]'). + * The script is now roughly divided into sections by + * form-feeds. Editors can move section-wise using the common emacs + * commands for this purpose ('C-x ]' and 'C-x ]'). * * The sections are: * 1. This comment block. - * 2. Everything around =OrgNodes=. - * 3. =org_html_manager= constructor and setup. - * 4. =org_html_manager= folding and view related stuff. - * 5. =org_html_manager= history related methods. - * 6. =org_html_manager= minibuffer handling. - * 7. =org_html_manager= user input. - * 8. =org_html_manager= search functonality. - * 9. =org_html_manager= misc. - * 10. Global functions. + * 2. Content hooks + * 3. Everything around =OrgNodes=. + * 4. =org_html_manager= constructor and setup. + * 5. =org_html_manager= folding and view related stuff. + * 6. =org_html_manager= history related methods. + * 7. =org_html_manager= minibuffer handling. + * 8. =org_html_manager= user input. + * 9. =org_html_manager= search functonality. + * 10. =org_html_manager= misc. + * 11. Global functions. */ +/** + * This program has been modified from its original version to add + * hooks for per-page HTML injection and per-click navigation event + * response. A patch is being submitted to upstream. + * - David T. O'Toole + */ + + + + +/** + * The following variable should hold a function which accepts an + * integer pageNumber and should return HTML to be inserted in the + * OrgInfo header of each page. + */ +var OrgInfoPageInsertFunction = function(pageNumber) {return '';}; + + +/** + * The following variable should hold a function which accepts an + * integer pageNumber and performs a user-defined action after the + * page has flipped. + * + */ +var OrgInfoAfterNavigateFunction = function(pageNumber) {}; + /** * Creates a new OrgNode. - * An OrgOutline stores some refs to its assoziated node in the document tree + * An OrgOutline stores some refs to its associated node in the document tree * along with some additional properties. */ function OrgNode ( _div, _heading, _link, _depth, _parent, _base_id, _toc_anchor) @@ -904,14 +931,16 @@ for(var i = 0; i < this.SECS.length; ++i) { this.SECS[i].IDX = i; - var html = '' - +'
' - +'' - +'Top: '+index_name+'' - +'' - + this.LINKS - +'toggle view' - +'
'; + var html = + OrgInfoPageInsertFunction(i) + + '' + +'
' + + '' + + 'Top: '+index_name+'' + + '' + + this.LINKS + + 'toggle view' + + '
'; if(i>0) html += '' - +'' + +'' +this.SECS[i].PARENT.HEADING.innerHTML+''; else - html += ''+this.SECS[i].HEADING.innerHTML+''; + html += ''+this.SECS[i].HEADING.innerHTML+''; // Right: html += ''; @@ -1321,7 +1350,7 @@ var T = this; var i = T.NODE.IDX + 1; if(i0) t.navigateTo(i-1); - else t.warn("Already first section."); + else t.warn("This is already the first section."); }, @@ -1345,6 +1374,8 @@ if(t.VIEW == t.SLIDE_VIEW) t.adjustSlide(sec); t.pushHistory(sec, t.NODE.IDX); t.showSection(sec); + + OrgInfoAfterNavigateFunction(); }, @@ -1386,7 +1417,7 @@ else if(t.HFO && history.length) history.forward(); else { t.HFO=1; - t.warn("History: No where to foreward go from here. Any key and `B' to move to next file in history."); + t.warn("History: There is nowhere to go forward to from here. Press `B' to move to the next page in your browser history."); } } else { if(t.HISTORY[t.HIST_INDEX - 1]) { @@ -1406,7 +1437,7 @@ else if(t.HBO && history.length) history.back(); else { t.HBO=1; - t.warn("History: No where to back go from here. Any key and `b' to move to previous file in history."); + t.warn("History: Nowhere to go back to from here. Press `b' to move to the previous page in your browser history."); } } }, @@ -1584,7 +1615,7 @@ else if(t.NODE.IDX < t.SECS.length - 1) { t.navigateTo(t.NODE.IDX + 1); } else { - t.warn("Already last section."); + t.warn("This is already the last section."); return; // rely on what happends if messaging } } @@ -1600,14 +1631,14 @@ ++idx; } } - t.warn("No next sibling."); + t.warn("There is no next sibling."); return; // rely on what happends if messaging } else if ('p' == s) { if(t.NODE.IDX > 0) { t.navigateTo(t.NODE.IDX - 1); } else { - t.warn("Already first section."); + t.warn("This is already the first section."); return; // rely on what happends if messaging } } @@ -1623,7 +1654,7 @@ --idx; } } - t.warn("No previous sibling."); + t.warn("There is no previous sibling."); } else if ('q' == s) { if(window.confirm("Really close this file?")) { @@ -2291,3 +2322,4 @@ { org_html_manager.init(); } + Diff finished. Mon Dec 12 11:51:26 2022