Fossil SCM
pikchr js: hide/show the SVG's parent element instead of the SVG, so that output from pikchr print commands is hidden when the source is shown.
Commit
43116c73fdae36d34856178a2d2e1d8351a1e1ee8504e8eb36a54c8c963d1780
Parent
6854244949f3347…
1 file changed
+2
-3
+2
-3
| --- src/fossil.pikchr.js | ||
| +++ src/fossil.pikchr.js | ||
| @@ -53,11 +53,11 @@ | ||
| 53 | 53 | intercepted by most Linux window managers to control |
| 54 | 54 | window movement! So... we just listen for *any* of them |
| 55 | 55 | (except Shift) and the user will need to find one which |
| 56 | 56 | works on on their environment. */ |
| 57 | 57 | || this.classList.contains('toggle')){ |
| 58 | - this._childs.forEach((e)=>e.classList.toggle('hidden')); | |
| 58 | + this._toHide.forEach((e)=>e.classList.toggle('hidden')); | |
| 59 | 59 | } |
| 60 | 60 | }; |
| 61 | 61 | }; |
| 62 | 62 | if(!svg) svg = 'svg.pikchr'; |
| 63 | 63 | if('string' === typeof svg){ |
| @@ -75,12 +75,11 @@ | ||
| 75 | 75 | const srcView = parent.nextElementSibling; |
| 76 | 76 | if(!srcView || !srcView.classList.contains('pikchr-src')){ |
| 77 | 77 | /* Without this element, there's nothing for us to do here. */ |
| 78 | 78 | return this; |
| 79 | 79 | } |
| 80 | - parent.dataset.origMaxWidth = parent.style.maxWidth; | |
| 81 | - parent._childs = [svg, srcView]; | |
| 80 | + parent._toHide = [parent, srcView]; | |
| 82 | 81 | D.addClass(srcView, 'hidden'); |
| 83 | 82 | D.removeClass(svg, 'hidden'); |
| 84 | 83 | parent.addEventListener('click', f.parentClick, false); |
| 85 | 84 | /* When the parent is hidden, it has 0 height so cannot be clicked, so... */ |
| 86 | 85 | srcView.addEventListener('click', (ev)=>f.parentClick.call(parent, ev), false); |
| 87 | 86 |
| --- src/fossil.pikchr.js | |
| +++ src/fossil.pikchr.js | |
| @@ -53,11 +53,11 @@ | |
| 53 | intercepted by most Linux window managers to control |
| 54 | window movement! So... we just listen for *any* of them |
| 55 | (except Shift) and the user will need to find one which |
| 56 | works on on their environment. */ |
| 57 | || this.classList.contains('toggle')){ |
| 58 | this._childs.forEach((e)=>e.classList.toggle('hidden')); |
| 59 | } |
| 60 | }; |
| 61 | }; |
| 62 | if(!svg) svg = 'svg.pikchr'; |
| 63 | if('string' === typeof svg){ |
| @@ -75,12 +75,11 @@ | |
| 75 | const srcView = parent.nextElementSibling; |
| 76 | if(!srcView || !srcView.classList.contains('pikchr-src')){ |
| 77 | /* Without this element, there's nothing for us to do here. */ |
| 78 | return this; |
| 79 | } |
| 80 | parent.dataset.origMaxWidth = parent.style.maxWidth; |
| 81 | parent._childs = [svg, srcView]; |
| 82 | D.addClass(srcView, 'hidden'); |
| 83 | D.removeClass(svg, 'hidden'); |
| 84 | parent.addEventListener('click', f.parentClick, false); |
| 85 | /* When the parent is hidden, it has 0 height so cannot be clicked, so... */ |
| 86 | srcView.addEventListener('click', (ev)=>f.parentClick.call(parent, ev), false); |
| 87 |
| --- src/fossil.pikchr.js | |
| +++ src/fossil.pikchr.js | |
| @@ -53,11 +53,11 @@ | |
| 53 | intercepted by most Linux window managers to control |
| 54 | window movement! So... we just listen for *any* of them |
| 55 | (except Shift) and the user will need to find one which |
| 56 | works on on their environment. */ |
| 57 | || this.classList.contains('toggle')){ |
| 58 | this._toHide.forEach((e)=>e.classList.toggle('hidden')); |
| 59 | } |
| 60 | }; |
| 61 | }; |
| 62 | if(!svg) svg = 'svg.pikchr'; |
| 63 | if('string' === typeof svg){ |
| @@ -75,12 +75,11 @@ | |
| 75 | const srcView = parent.nextElementSibling; |
| 76 | if(!srcView || !srcView.classList.contains('pikchr-src')){ |
| 77 | /* Without this element, there's nothing for us to do here. */ |
| 78 | return this; |
| 79 | } |
| 80 | parent._toHide = [parent, srcView]; |
| 81 | D.addClass(srcView, 'hidden'); |
| 82 | D.removeClass(svg, 'hidden'); |
| 83 | parent.addEventListener('click', f.parentClick, false); |
| 84 | /* When the parent is hidden, it has 0 height so cannot be clicked, so... */ |
| 85 | srcView.addEventListener('click', (ev)=>f.parentClick.call(parent, ev), false); |
| 86 |