Better Nav Laravel Docs

8/15/2024, 2:54:00 PM

目前為 2024-08-15 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Better Nav Laravel Docs
// @namespace   Violentmonkey Scripts
// @match       https://laravel.com/docs/*
// @grant       none
// @version     1.0
// @author      Karom
// @license MIT
// @description 8/15/2024, 2:54:00 PM
// ==/UserScript==


toc = document.querySelector("#main-content > ul:nth-child(2)")

var newtoc = document.createElement('div');
newtoc.className = "parent-newtoc docs_main"
newtoc.style.position = 'sticky';
newtoc.style.top = '5rem';
newtoc.style.right = '2rem';
newtoc.style.zIndex = '2';
newtoc.style.height = 'calc(100vh - 7rem)';
newtoc.style.overflowY = 'auto';

newtoc.appendChild(document.createElement('h1'))

// Add content to the element if needed
// newtoc.textContent = 'TOC';

document.querySelector('.relative .relative').appendChild(newtoc)


document.querySelector('.parent-newtoc').appendChild(toc)