ctfshow 小侧边栏

ctfshow 小侧边栏 用来迅速跳转

当前为 2021-11-07 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         ctfshow 小侧边栏
// @namespace    https://coutcin.com/
// @version      0.1
// @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).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);
}