Skip to content

Commit

Permalink
Update GmeekTOC.js
Browse files Browse the repository at this point in the history
  • Loading branch information
cao-gift authored Jul 20, 2024
1 parent 5fa942d commit 7161c61
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions static/assets/GmeekTOC.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ document.addEventListener("DOMContentLoaded", function() {
var css = '.toc {position:fixed;top:130px;left:50%;transform: translateX(50%) translateX(300px);width:200px;padding-left:30px;}@media (max-width: 1249px) {.toc{position:static;top:auto;left:auto;transform:none;padding:10px;margin-bottom:20px;background-color:var(--color-open-muted);}}';
loadResource('style', {css: css});

loadResource('script', { src: 'https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.27.4/tocbot.min.js' }, function() {
loadResource('script', { src: 'https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/tocbot/4.27.4/tocbot.min.js' }, function() {
tocbot.init({
tocSelector: '.toc',
contentSelector: '.markdown-body',
Expand All @@ -43,7 +43,7 @@ document.addEventListener("DOMContentLoaded", function() {
});
});

loadResource('link', { rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.27.4/tocbot.css' });
loadResource('link', { rel: 'stylesheet', href: 'https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/tocbot/4.27.4/tocbot.css' });

const headings = document.querySelectorAll('.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6');
headings.forEach((heading) => {
Expand Down

0 comments on commit 7161c61

Please sign in to comment.