PageSourceSearch

https://www.ridgelinez.com/core/wp-content/themes/ridgelinez/_assets/js/module/detailIndex.js

js ridgelinez.com collected 2026-10-02 02:18:18 UTC 1,168 bytes, 29 lines download raw bytes

1export const detailIndex = () => {
2  // 既存の ul 要素を取得
3  const navList = document.querySelector(".detailIndex-list");
4  if (navList) {
5    // .detailArticle-body 内の h2 要素を取得
6    const contents = document.querySelectorAll(".detailArticle-body h2");
7    contents.forEach((content, index) => {
8      // カウンタを使って一意の ID を生成
9      const id = "anc" + (index + 1);
10      // h2 要素に ID 属性を設定
11      content.setAttribute("id", id);
12      // h2 要素のテキストを取得
13      const text = content.textContent;
14      // 新しい li 要素を作成
15      const listItem = document.createElement("li");
16      listItem.className = "detailIndex-list-item";
17      // 新しい a 要素(アンカーリンク)を作成
18      const link = document.createElement("a");
19      link.href = "#" + id; // アンカーリンクのリンク先を設定
20      link.className = "detailIndex-list-item-link";
21      link.textContent = text;
22      // a 要素を li 要素に追加
23      listItem.appendChild(link);
24      // li 要素を既存の ul 要素に追加
25      navList.appendChild(listItem);
26    });
27  }
28};
29

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.