您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically adds a table of contents to Kanka entity pages under the Pins sidebar.
Automatically adds a Table of Contents block under the right-hand History sidebar of all entities on Kanka. You can customize its appearance using campaign CSS, but keep in mind that it is only visible on browsers where this script is installed. It should match the appearance of other sidebar blocks out of the box.
When clicking a link to a collapsed post (or a heading within), the post will automatically expand so you are scrolled to the correct position and can start reading right away. This also applies to Timeline events and their parent era.
You can control the settings below by editing the /* Preferences */
section near the top of the script. Note that you will need to reimplement these changes each time you update the script.
By default, the table of contents block is "sticky", meaning it will stay on-screen when you scroll down a long page. You can turn this off by changing the following property:
const stickyTOC = true;
→ const stickyTOC = false;
The script can also add links to scroll back to the table of contents after every heading (excluding entry/post box headings), but this is turned off by default since it isn’t useful with a sticky ToC. To activate this feature, locate the following line and add the desired text inside the quotation marks:
const addTopLink = "";
→ e.g. const addTopLink = "toc";
You can add any custom HTML classes to the script’s ignore list if you have content that you would rather not include, for example an infobox template that contains several headings not useful for content navigation. Simply add each one, within quotes, to the list that starts with const classExclusions = ["calendar", "modal", "box-entity-attributes", ...
.
Note: This script will not conflict with Kanka’s own tables of contents ({table-of-contents}
). You can use it to supplement the "native" tables of contents, and create back-to-top links if enabled.