File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 11// ==UserScript==
22// @name GitHub Table of Contents
3- // @version 1.3.1
3+ // @version 1.3.2
44// @description A userscript that adds a table of contents to readme & wiki pages
55// @license MIT
66// @author Rob Garrison
3838 }
3939 .ghus-toc.collapsed > h3 { cursor:pointer; padding-top:5px; border:none; background:#222; color:#ddd; }
4040 .ghus-toc.collapsed .ghus-toc-docs { display:none; }
41- .ghus-toc.collapsed ~ .Header,
42- .ghus-toc.collapsed ~ .js-header-wrapper { padding-right: 30px !important; }
41+ .ghus-toc:not(.ghus-toc-hidden).collapsed ~ .js-header-wrapper .Header { padding-right: 48px !important; }
4342 /* move header text out-of-view when collapsed */
4443 .ghus-toc.collapsed > h3 svg { margin-bottom: 10px; }
4544 .ghus-toc-hidden, .ghus-toc.collapsed .boxed-group-inner,
176175 }
177176 }
178177 // hide TOC entirely, if no rendered markdown detected
179- function tocView ( mode ) {
178+ function tocView ( isVisible ) {
180179 const toc = $ ( ".ghus-toc" ) ;
181180 if ( toc ) {
182- toc . style . display = mode || "none" ;
181+ toc . classList . toggle ( "ghus-toc-hidden" , ! isVisible ) ;
183182 }
184183 }
185184
208207 }
209208 }
210209 $ ( ".boxed-group-inner" , container ) . innerHTML = content + "</ul>" ;
211- tocView ( "block" ) ;
210+ tocView ( true ) ;
212211 listCollapsible ( ) ;
213212 } else {
214213 tocView ( ) ;
You can’t perform that action at this time.
0 commit comments