|
28 | 28 | /* z-index > 1000 to be above the */
|
29 | 29 | .ghus-toc { position:fixed; z-index:1001; min-width:200px; top:60px; right:10px; }
|
30 | 30 | .ghus-toc h3 { cursor:move; }
|
| 31 | + .ghus-toc-title { padding-left:20px; } |
31 | 32 | /* icon toggles TOC container & subgroups */
|
32 |
| - .ghus-toc h3 svg, .ghus-toc li.collapsible .ghus-toc-icon { cursor:pointer; vertical-align:baseline; } |
| 33 | + .ghus-toc .ghus-toc-icon { vertical-align:baseline; } |
| 34 | + .ghus-toc h3 .ghus-toc-icon, .ghus-toc li.collapsible .ghus-toc-icon { cursor:pointer; } |
| 35 | + .ghus-toc .ghus-toc-toggle { position:absolute; width:28px; height:38px; top:0px; left:0px; } |
| 36 | + .ghus-toc .ghus-toc-toggle svg { margin-top:10px; margin-left:9px; } |
33 | 37 | .ghus-toc .ghus-toc-docs { float:right; }
|
34 | 38 | /* move collapsed TOC to top right corner */
|
35 | 39 | .ghus-toc.collapsed {
|
|
40 | 44 | .ghus-toc.collapsed .ghus-toc-docs { display:none; }
|
41 | 45 | .ghus-toc:not(.ghus-toc-hidden).collapsed ~ .js-header-wrapper .Header { padding-right: 48px !important; }
|
42 | 46 | /* move header text out-of-view when collapsed */
|
43 |
| - .ghus-toc.collapsed > h3 svg { margin-bottom: 10px; } |
| 47 | + .ghus-toc.collapsed > h3 svg { margin-top:6px; } |
44 | 48 | .ghus-toc-hidden, .ghus-toc.collapsed .boxed-group-inner,
|
45 | 49 | .ghus-toc li:not(.collapsible) .ghus-toc-icon { display:none; }
|
46 | 50 | .ghus-toc .boxed-group-inner { max-width:250px; max-height:400px; overflow-y:auto; overflow-x:hidden; }
|
|
253 | 257 | group = [];
|
254 | 258 | on(container, "click", event => {
|
255 | 259 | // Allow doc link to work
|
256 |
| - if (event.target.nodeName.toLowerCase() !== "a") { |
257 |
| - stopPropag(event); |
| 260 | + if (event.target.nodeName.toLowerCase() === "a") { |
| 261 | + return; |
258 | 262 | }
|
| 263 | + stopPropag(event); |
259 | 264 | // click on icon, then target LI parent
|
260 | 265 | let els, name, indx;
|
261 | 266 | const el = event.target.parentNode;
|
|
350 | 355 | container.setAttribute("unselectable", "on");
|
351 | 356 | container.innerHTML = `
|
352 | 357 | <h3 class="js-wiki-toggle-collapse wiki-auxiliary-content" data-hotkey="g t">
|
353 |
| - <svg class="octicon ghus-toc-icon" height="14" width="14" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 16 12"> |
354 |
| - <path d="M2 13c0 .6 0 1-.6 1H.6c-.6 0-.6-.4-.6-1s0-1 .6-1h.8c.6 0 .6.4.6 1zm2.6-9h6.8c.6 0 .6-.4.6-1s0-1-.6-1H4.6C4 2 4 2.4 4 3s0 1 .6 1zM1.4 7H.6C0 7 0 7.4 0 8s0 1 .6 1h.8C2 9 2 8.6 2 8s0-1-.6-1zm0-5H.6C0 2 0 2.4 0 3s0 1 .6 1h.8C2 4 2 3.6 2 3s0-1-.6-1zm10 5H4.6C4 7 4 7.4 4 8s0 1 .6 1h6.8c.6 0 .6-.4.6-1s0-1-.6-1zm0 5H4.6c-.6 0-.6.4-.6 1s0 1 .6 1h6.8c.6 0 .6-.4.6-1s0-1-.6-1z"/> |
355 |
| - </svg> |
356 |
| - <span>${title}</span> |
| 358 | + <span class="ghus-toc-toggle ghus-toc-icon"> |
| 359 | + <svg class="octicon" height="14" width="14" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 16 12"> |
| 360 | + <path d="M2 13c0 .6 0 1-.6 1H.6c-.6 0-.6-.4-.6-1s0-1 .6-1h.8c.6 0 .6.4.6 1zm2.6-9h6.8c.6 0 .6-.4.6-1s0-1-.6-1H4.6C4 2 4 2.4 4 3s0 1 .6 1zM1.4 7H.6C0 7 0 7.4 0 8s0 1 .6 1h.8C2 9 2 8.6 2 8s0-1-.6-1zm0-5H.6C0 2 0 2.4 0 3s0 1 .6 1h.8C2 4 2 3.6 2 3s0-1-.6-1zm10 5H4.6C4 7 4 7.4 4 8s0 1 .6 1h6.8c.6 0 .6-.4.6-1s0-1-.6-1zm0 5H4.6c-.6 0-.6.4-.6 1s0 1 .6 1h6.8c.6 0 .6-.4.6-1s0-1-.6-1z"/> |
| 361 | + </svg> |
| 362 | + </span> |
| 363 | + <span class="ghus-toc-title">${title}</span> |
357 | 364 | <a class="ghus-toc-docs tooltipped tooltipped-w" aria-label="Go to documentation" href="https://github.com/Mottie/GitHub-userscripts/wiki/GitHub-table-of-contents">
|
358 | 365 | <svg class="octicon" xmlns="http://www.w3.org/2000/svg" height="16" width="14" viewBox="0 0 16 14">
|
359 | 366 | <path d="M6 10h2v2H6V10z m4-3.5c0 2.14-2 2.5-2 2.5H6c0-0.55 0.45-1 1-1h0.5c0.28 0 0.5-0.22 0.5-0.5v-1c0-0.28-0.22-0.5-0.5-0.5h-1c-0.28 0-0.5 0.22-0.5 0.5v0.5H4c0-1.5 1.5-3 3-3s3 1 3 2.5zM7 2.3c3.14 0 5.7 2.56 5.7 5.7S10.14 13.7 7 13.7 1.3 11.14 1.3 8s2.56-5.7 5.7-5.7m0-1.3C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7S10.86 1 7 1z" />
|
|
0 commit comments