Greasy Fork is available in English.

Kanka Automatic Table of Contents

Automatically adds a table of contents to Kanka entity pages under the Pins sidebar.

Dessa är versionerna av skriptet där koden uppdaterades. Visa alla versioner.

  • v11 2023-11-04

    Kanka 2.0 compatibility update:

    • Updated targeting rules to properly activate the script and locate headings.
    • Added an ID to the entry block, which no longer has a heading, to keep it in the ToC manually.
    • Updated the ToC box expand/collapse function and the auto-expand function for links pointing to headings inside collapsed posts.
    • Updated the ToC box’s markup and styling to match other entity sidebar boxes.
  • v10 2023-04-25

    Quick update to make the ToC text visible again following changes in Kanka’s CSS.

    Remember to set your addTopLink preference as desired after updating.

  • v9 2022-08-15
    • Fixed the opening of closed posts when clicking a ToC link (they would toggle open/closed indiscriminately on every click).
    • Greatly improved handling of special characters in heading titles for better legibility of URLs and correct scrolling behaviour.
    • Ensured that the ToC does not appear when printing entities with parameters in the URL.

    Remember to set your addTopLink preference as desired after updating.

  • v8 2022-01-10
    • Headings that already have an ID no longer get a new one assigned by this script. This allows compatibility with Kanka 1.20 tables of contents, among other things.
    • IDs assigned by this script now include a unique number to differentiate headings with identical titles. You may still encounter issues if you use a Kanka 1.20 ToC with identical titles across different heading levels, as those are not differentiated by the library Kanka uses.
    • You can now set custom "back to top" link text instead of only true/false. If you currently have addTopLink set to true, you will need to change it to a text string instead (see description for instructions).
  • v7.2 2021-12-05
    • Updated the markup and CSS of the TOC box to match the new sidebar design. Also adapts seamlessly to my Sidebar Box Backgrounds plugin for non-Default themes.
  • v7.1 2021-11-22

    This is a temporary fix for the last Kanka update that changed how the sidebars are structured. More work needs to be done for styling when I have the time, but this at least restores functionality.

  • v7 2021-11-09
    • On Timeline elements that refer to private entities, the new screenreader description for the lock icon was being picked up by the table of contents. It is now properly yeeted.
  • v6 2021-11-08
    • Links back to the ToC have had their text changed from TOP to TOC to clarify, and a tooltip has been added for accessibility.
    • When clicking a heading that belongs to a post that is currently collapsed, the post is automatically expanded first so the page can scroll to the correct location (thanks to Ho’nehe for pointing that out).
  • v5 2021-11-06
    • Added the addTopLink setting to toggle the addition of "^top" links to headings.
    • Link color now matches whichever color is set for standard links by the theme.
  • v4 2021-08-23
    • Print pages are excluded.
    • Inline tags in headings are now checked to exclude the dates in Timeline elements from the TOC. You can have them display by commenting out #tableofcontent .text-muted { display: none; } in your copy of the script, or setting it to inline in your campaign CSS.
    • Line breaks at the end of headings (often left behind undesirably by Summernote) are now removed to avoid the TOP link falling on a new line. This does not affect eventual line breaks separating the contents of the heading.
  • v2 2021-07-16

    Added handling for Calendars, which use a single sidebar and where every date in the grid would get picked up by the TOC.

    Adding a filter to avoid modals that are hidden among some entity content, such as the "Year Switcher" in Calendars.

    Calendars are rude.

  • v1 2021-07-15