ctfshow 小侧边栏

ctfshow 小侧边栏 用来迅速跳转

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         ctfshow 小侧边栏
// @namespace    https://coutcin-xw.github.io/
// @version      0.1.2
// @description  ctfshow 小侧边栏 用来迅速跳转
// @author       CoutCin
// @match        https://ctf.show/challenges
// @require      https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js
// @icon         https://www.google.com/s2/favicons?domain=ctf.show
// @grant        unsafeWindow
// @run-at document-idle
// ==/UserScript==
var $ = unsafeWindow.jQuery;
var nav=[];
(function () {
    'use strict';
    $(window).load(function () {
        var btn = `<div class="sides-nav" style="background-color: #fff;display:inline-block; position:fixed;right:3rem;top:5rem;overflow-y: scroll;max-height: 80vh;min-width: 5rem;" >
        <button id="btn-click">刷新</button>
        <ul style=" margin: none;margin: 0; padding: 0; ">
        <a style="display:block;text-decoration: none;color: #000;padding: 0.25rem 1rem 0.25rem 1rem;" href="">请刷新</a>
        </ul>
    </div>`;
        $('body').append(btn);
        console.log("test");
        $("#btn-click").click(function () { test(); });
    });
})();
function test() {
    nav=[];
    $(".category-header").each(function (i) {
        // console.log($(this).children("h3").text()+i);
        nav[i]={
            name :$(this).children("h3").text()
        }
        $(this).children("h3").attr("id","nav-t-"+i);
    })
    $(".sides-nav").children("ul").html("");
    for(var i=0;i<nav.length;i++){
        var tempstr=`
            <a style="display:block;text-decoration: none;color: #000;padding: 0.25rem 1rem 0.25rem 1rem;" href="#nav-t-${i}">${nav[i].name}</a>
        `;
        $(".sides-nav").children("ul").append(tempstr);
        
    }
    //  console.log(nav);
}