Better Nav Laravel Docs

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

  1. // ==UserScript==
  2. // @name Better Nav Laravel Docs
  3. // @namespace Violentmonkey Scripts
  4. // @match https://laravel.com/docs/*
  5. // @grant none
  6. // @version 1.0
  7. // @author Karom
  8. // @license MIT
  9. // @description 8/15/2024, 2:54:00 PM
  10. // ==/UserScript==
  11.  
  12.  
  13. toc = document.querySelector("#main-content > ul:nth-child(2)")
  14.  
  15. var newtoc = document.createElement('div');
  16. newtoc.className = "parent-newtoc docs_main"
  17. newtoc.style.position = 'sticky';
  18. newtoc.style.top = '5rem';
  19. newtoc.style.right = '2rem';
  20. newtoc.style.zIndex = '2';
  21. newtoc.style.height = 'calc(100vh - 7rem)';
  22. newtoc.style.overflowY = 'auto';
  23.  
  24. newtoc.appendChild(document.createElement('h1'))
  25.  
  26. // Add content to the element if needed
  27. // newtoc.textContent = 'TOC';
  28.  
  29. document.querySelector('.relative .relative').appendChild(newtoc)
  30.  
  31.  
  32. document.querySelector('.parent-newtoc').appendChild(toc)