PageSourceSearch

https://paxinla.github.io/theme/js/index_toc.js

js paxinla.github.io collected 2026-10-03 09:44:46 UTC 1,165 bytes, 33 lines download raw bytes

1window.onload = function () {
2    // 左侧导航栏的最近文章列表
3    var toc = '<ul class="fa-ul">';
4    var postsShowOnIndexPage = document.getElementById("content_of_post").children;
5    var latest3Posts = '';
6
7    for (let i=0; i<3; i++){
8        latest3Posts += postsShowOnIndexPage[i].innerHTML ;
9    }
10
11    latest3Posts.replace(
12        /<span id="(section[\d]+)">([^<]+)<\/span>/gi,
13        function (str, sec_id, titleText) {
14            toc += '<li class="nav-item"><a class="nav-link" href="#' + sec_id + "\">"
15                + '<i class="fa-li fa fa-arrow-circle-right"></i> '
16                + titleText
17                + "</a></li>";
18
19            return "<span id=\"" + sec_id + "\">" + titleText + "</span>";
20        }
21    );
22
23    toc += "</ul>";
24    document.getElementById("nav-sidebar").innerHTML += toc;
25
26    // 去除首页的注解元素
27    var divClassToRemove = ['.sidenote', '.marginnote'];
28    for (let c in divClassToRemove){
29        let divClassName = divClassToRemove[c];
30        let allDivsToRemove = document.querySelectorAll(divClassName);
31        allDivsToRemove.forEach(function(e){e.parentNode.removeChild(e)});
32    }
33};

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.