Skip to content

Commit

Permalink
fix toc (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
sopisoft authored Sep 17, 2024
1 parent f12b7c5 commit bff5bec
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/content_scripts/components/canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
*/

import { type config_keys, getConfig } from "@/config";
import { find_element } from "@/lib/dom";
import NiconiComments from "@xpadev-net/niconicomments";
import type { Options, V1Thread } from "@xpadev-net/niconicomments";
import browser from "webextension-polyfill";
import { find_element } from "../danime/dom";
import {
threads as getThreads,
on_partId_change,
Expand Down
2 changes: 1 addition & 1 deletion src/content_scripts/components/scroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

import { ThemeProvider } from "@/components/theme-provider";
import { type config_keys, getConfig } from "@/config";
import { find_element } from "@/lib/dom";
import { useEffect, useRef, useState } from "react";
import { Virtuoso, type VirtuosoHandle } from "react-virtuoso";
import browser from "webextension-polyfill";
import { sortComments } from "../comments";
import { find_element } from "../danime/dom";
import {
threads as getThreads,
on_partId_change,
Expand Down
2 changes: 1 addition & 1 deletion src/content_scripts/components/wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
along with d-comments. If not, see <https://www.gnu.org/licenses/>.
*/

import { find_element } from "@/lib/dom";
import { createRoot } from "react-dom/client";
import { find_element } from "../danime/dom";
import Scroll from "./scroll";

/**
Expand Down
2 changes: 1 addition & 1 deletion src/content_scripts/danime/mypage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { getConfig } from "@/config";
import { find_elements } from "./dom";
import { find_elements } from "@/lib/dom";

/**
* 作品ページの各パートに新しいタブで開くボタンを追加する
Expand Down
2 changes: 1 addition & 1 deletion src/content_scripts/danime/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
along with d-comments. If not, see <https://www.gnu.org/licenses/>.
*/

import { find_element, find_elements } from "@/lib/dom";
import { push_message } from "../state";
import { get_work_info } from "./api";
import { find_element, find_elements } from "./dom";

/**
* 視聴ページで title と description をパートタイトルと説明に書き換える
Expand Down
2 changes: 1 addition & 1 deletion src/content_scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
import { getConfig } from "@/config";
import { openHowToUseIfNotRead } from "@/how_to_use/how_to_use";
import api from "@/lib/api";
import { find_element } from "@/lib/dom";
import browser from "webextension-polyfill";
import get_threads from "./api/thread_data";
import get_video_data from "./api/video_data";
import { ngFilter } from "./comments";
import initRenderer from "./components/canvas";
import overlay from "./components/overlay";
import wrap from "./components/wrapper";
import { find_element } from "./danime/dom";
import { addMenu } from "./danime/mypage";
import { setWorkInfo, smooth_player } from "./danime/watch";
import exportJson from "./export";
Expand Down
7 changes: 4 additions & 3 deletions src/how_to_use/how_to_use.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import "./how_to_use.css";
import "github-markdown-css";
import { ArrowUp, CircleX } from "lucide-react";
import { createRoot } from "react-dom/client";
import { find_elements } from "../lib/dom";
// @ts-ignore
import { html, toc } from "./how_to_use.md";

Expand Down Expand Up @@ -133,13 +134,13 @@ document.body.appendChild(root);

createRoot(root).render(<HowToUse />);

window.addEventListener("load", () => {
const headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
window.addEventListener("load", async () => {
const headers = await find_elements("h1, h2, h3, h4, h5, h6");
for (const header of headers) {
header.id = header.textContent || "";
}

const anchors = document.querySelectorAll("a");
const anchors = await find_elements("a");
for (const anchor of anchors) {
const href = anchor.getAttribute("href");
if (href === "#top") {
Expand Down
File renamed without changes.

0 comments on commit bff5bec

Please sign in to comment.