// This file is only loaded in tridacyl's help pages import * as config from "./config" /** Created the element that should contain keybinding information */ function initTridactylSettingElem( elem: HTMLElement, kind: string, ): HTMLElement { let bindingNode = elem.getElementsByClassName(`Tridactyl${kind}`)[0] if (bindingNode) { Array.from(bindingNode.children) .filter(e => e.tagName == "LI") .forEach(e => e.parentNode.removeChild(e)) } else { // Otherwise, create it bindingNode = document.createElement("ul") bindingNode.className = `TridactylSetting Tridactyl${kind}` bindingNode.textContent = kind + ": " elem.insertBefore(bindingNode, elem.children[2]) } return bindingNode as HTMLElement } /** Returns an object that maps excmd names to excmd documentation element */ function getCommandElements() { return Array.from( document.querySelectorAll("section.tsd-panel-group:nth-child(3) h3"), ).reduce((all, elem) => { all[elem.textContent] = elem.parentElement return all }, {}) } /** Updates the doc with aliases fetched from the config */ async function addSetting(settingName: string) { let commandElems = getCommandElements() // We're ignoring composite because it combines multiple excmds delete commandElems["composite"] // Initialize or reset the