Confluence: Simple Floating ToC

Makes widget from macro "Table of Contents" float on the right hand side of content.

目前为 2023-03-01 提交的版本。查看 最新版本

  1. /* ==UserStyle==
  2. @name Confluence: Simple Floating ToC
  3. @description Makes widget from macro "Table of Contents" float on the right hand side of content.
  4. @version 3
  5. @author Andrei Rybak
  6. @homepageURL https://github.com/rybak/atlassian-tweaks
  7. @license MIT
  8. @namespace https://github.com/rybak/atlassian-tweaks
  9. @preprocessor uso
  10. @var text yourDomain "Custom Confluence domain" "confluence.example.com"
  11. @var text yourDomain2 "Second Custom Confluence domain" "confluence.example.net"
  12. @var number SFTRightMargin "Margin on the right side of ToC, em" [2, 1, 20, 1, "em"]
  13. @var number SFTTocTopMargin "Margin on top of table of contents, em" [12, 1, 20, 1, "em"]
  14. @var number SFTContentWidth "Width of main content, percent" [75, 1, 100, 1, "%"]
  15. @var number SFTTocWidth "Width of table of contents, percent" [20, 1, 100, 1, "%"]
  16. ==/UserStyle== */
  17.  
  18. /*
  19. * Copyright (c) 2023 Andrei Rybak
  20. *
  21. * Permission is hereby granted, free of charge, to any person obtaining a copy
  22. * of this software and associated documentation files (the "Software"), to deal
  23. * in the Software without restriction, including without limitation the rights
  24. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  25. * copies of the Software, and to permit persons to whom the Software is
  26. * furnished to do so, subject to the following conditions:
  27. *
  28. * The above copyright notice and this permission notice shall be included in all
  29. * copies or substantial portions of the Software.
  30. *
  31. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  32. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  33. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  35. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  36. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  37. * SOFTWARE.
  38. */
  39.  
  40. @-moz-document url-prefix("https://confluence"), domain(/*[[yourDomain]]*/), domain(/*[[yourDomain2]]*/) {
  41. #main-content, #comments-section {
  42. width: /*[[SFTContentWidth]]*/;
  43. }
  44.  
  45. .toc-macro > ul {
  46. position: fixed;
  47. top: /*[[SFTTocTopMargin]]*/;
  48. right: /*[[SFTRightMargin]]*/;
  49. width: /*[[SFTTocWidth]]*/;
  50. }
  51. }