Fossil SCM
Cherry-pick the show-in-pikchrview feature that was added to the omit-cr branch.
Commit
521da5cd31fa47d66d020784fb0435233a6f3f8fd6330f708eca16cafc1ad998
Parent
753bf7d57a679e8…
16 files changed
+29
-6
+29
-6
+29
-6
+29
-6
+15
-3
+54
-6
+54
-6
+54
-6
+54
-6
+54
-6
+12
-2
+12
-2
+12
-2
+12
-2
+12
-2
+12
-2
~
src/default.css
~
src/default.css
~
src/default.css
~
src/default.css
~
src/fossil.page.pikchrshowasm.js
~
src/fossil.pikchr.js
~
src/fossil.pikchr.js
~
src/fossil.pikchr.js
~
src/fossil.pikchr.js
~
src/fossil.pikchr.js
~
src/pikchrshow.c
~
src/pikchrshow.c
~
src/pikchrshow.c
~
src/pikchrshow.c
~
src/pikchrshow.c
~
src/pikchrshow.c
+29
-6
| --- src/default.css | ||
| +++ src/default.css | ||
| @@ -1681,22 +1681,45 @@ | ||
| 1681 | 1681 | DOM structure: |
| 1682 | 1682 | <DIV.pikchr-wrapper> |
| 1683 | 1683 | <DIV.pikchr-svg> |
| 1684 | 1684 | <SVG.pikchr>...</SVG> |
| 1685 | 1685 | </DIV.pikchr-svg> |
| 1686 | - <PRE.pikchr-src>...</PRE> | |
| 1686 | + <DIV.pikchr-src> | |
| 1687 | + <PRE>pikchr source code</PRE> | |
| 1688 | + <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> | |
| 1689 | + <!-- ^^^ is unhidden and activated by JS code --> | |
| 1690 | + </DIV.pikchr-src> | |
| 1687 | 1691 | </DIV.pikchr-wrapper> |
| 1688 | 1692 | |
| 1689 | 1693 | ************************************************************/ |
| 1690 | 1694 | div.pikchr-wrapper {/*outer wrapper elem for a pikchr construct*/} |
| 1691 | 1695 | div.pikchr-svg {/*wrapper for SVG.pikchr element*/} |
| 1692 | 1696 | svg.pikchr {/*pikchr SVG*/ |
| 1693 | 1697 | width: 100%/*necessary for SOME SVGs for Chrome!*/; |
| 1694 | 1698 | } |
| 1695 | -pre.pikchr-src {/*source code view for a pikchr (see fossil.pikchr.js)*/ | |
| 1699 | + | |
| 1700 | +div.pikchr-src { | |
| 1701 | + /*Wrapper for source code view of a pikchr (see fossil.pikchr.js)*/ | |
| 1702 | + display: flex; | |
| 1703 | + flex-direction: column; | |
| 1704 | +} | |
| 1705 | +div.pikchr-src > pre { | |
| 1706 | + /*Source code for a pikchr*/ | |
| 1696 | 1707 | box-sizing: border-box; |
| 1697 | 1708 | text-align: left; |
| 1709 | +} | |
| 1710 | +div.pikchr-src > span { | |
| 1711 | + /*Wrapper for a link to open a pikchr in /pikchrshow*/ | |
| 1712 | + margin-top: 0.5em; | |
| 1713 | + margin-bottom: 0.5em; | |
| 1714 | + font-size: 85%; | |
| 1715 | +} | |
| 1716 | +div.pikchr-src > span::before { | |
| 1717 | + content: "["; | |
| 1718 | +} | |
| 1719 | +div.pikchr-src > span::after { | |
| 1720 | + content: "]"; | |
| 1698 | 1721 | } |
| 1699 | 1722 | /* The .source-inline class tells the .source class that the |
| 1700 | 1723 | source view, when enabled, should be "inline" (same position |
| 1701 | 1724 | as the graphic), else the sources are shifted to the left as |
| 1702 | 1725 | if they were "plain text". */ |
| @@ -1712,14 +1735,14 @@ | ||
| 1712 | 1735 | still-seemingly-legitimate browsers don't support grid mode. */ |
| 1713 | 1736 | } |
| 1714 | 1737 | div.pikchr-wrapper.center > div.pikchr-svg { |
| 1715 | 1738 | width: 100%/*necessary for Chrome!*/; |
| 1716 | 1739 | } |
| 1717 | -div.pikchr-wrapper.center:not(.source) > pre.pikchr-src, | |
| 1740 | +div.pikchr-wrapper.center:not(.source) > div.pikchr-src, | |
| 1718 | 1741 | div.pikchr-wrapper.center:not(.source) > div.pikchr-svg, |
| 1719 | 1742 | /* ^^^ Centered non-source-view elements */ |
| 1720 | -div.pikchr-wrapper.center.source.source-inline > pre.pikchr-src, | |
| 1743 | +div.pikchr-wrapper.center.source.source-inline div.pikchr-src, | |
| 1721 | 1744 | div.pikchr-wrapper.center.source.source-inline > div.pikchr-svg |
| 1722 | 1745 | /* ^^^ Centered inline-source-view elements */{ |
| 1723 | 1746 | display:inline-block/*allows parent text-align to do the alignment*/; |
| 1724 | 1747 | /* ^^^^ Browser incompatibility: inline-block causes the centered |
| 1725 | 1748 | pikchr to shrink to the point of illegiblity in Chrome. The |
| @@ -1743,14 +1766,14 @@ | ||
| 1743 | 1766 | padding: 4em; |
| 1744 | 1767 | } |
| 1745 | 1768 | |
| 1746 | 1769 | /* For pikchr-wrapper.source mode, toggle pre.pikchr-src and |
| 1747 | 1770 | svg.pikchr visibility... */ |
| 1748 | -div.pikchr-wrapper.source > pre.pikchr-src { | |
| 1771 | +div.pikchr-wrapper.source > div.pikchr-src { | |
| 1749 | 1772 | /* Source code ^^^^^^^ is visible, else it is hidden */ |
| 1750 | 1773 | } |
| 1751 | -div.pikchr-wrapper:not(.source) > pre.pikchr-src { | |
| 1774 | +div.pikchr-wrapper:not(.source) > div.pikchr-src { | |
| 1752 | 1775 | /* Hide sources when image is being shown. */ |
| 1753 | 1776 | position: absolute !important; |
| 1754 | 1777 | opacity: 0 !important; |
| 1755 | 1778 | pointer-events: none !important; |
| 1756 | 1779 | display: none !important; |
| 1757 | 1780 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -1681,22 +1681,45 @@ | |
| 1681 | DOM structure: |
| 1682 | <DIV.pikchr-wrapper> |
| 1683 | <DIV.pikchr-svg> |
| 1684 | <SVG.pikchr>...</SVG> |
| 1685 | </DIV.pikchr-svg> |
| 1686 | <PRE.pikchr-src>...</PRE> |
| 1687 | </DIV.pikchr-wrapper> |
| 1688 | |
| 1689 | ************************************************************/ |
| 1690 | div.pikchr-wrapper {/*outer wrapper elem for a pikchr construct*/} |
| 1691 | div.pikchr-svg {/*wrapper for SVG.pikchr element*/} |
| 1692 | svg.pikchr {/*pikchr SVG*/ |
| 1693 | width: 100%/*necessary for SOME SVGs for Chrome!*/; |
| 1694 | } |
| 1695 | pre.pikchr-src {/*source code view for a pikchr (see fossil.pikchr.js)*/ |
| 1696 | box-sizing: border-box; |
| 1697 | text-align: left; |
| 1698 | } |
| 1699 | /* The .source-inline class tells the .source class that the |
| 1700 | source view, when enabled, should be "inline" (same position |
| 1701 | as the graphic), else the sources are shifted to the left as |
| 1702 | if they were "plain text". */ |
| @@ -1712,14 +1735,14 @@ | |
| 1712 | still-seemingly-legitimate browsers don't support grid mode. */ |
| 1713 | } |
| 1714 | div.pikchr-wrapper.center > div.pikchr-svg { |
| 1715 | width: 100%/*necessary for Chrome!*/; |
| 1716 | } |
| 1717 | div.pikchr-wrapper.center:not(.source) > pre.pikchr-src, |
| 1718 | div.pikchr-wrapper.center:not(.source) > div.pikchr-svg, |
| 1719 | /* ^^^ Centered non-source-view elements */ |
| 1720 | div.pikchr-wrapper.center.source.source-inline > pre.pikchr-src, |
| 1721 | div.pikchr-wrapper.center.source.source-inline > div.pikchr-svg |
| 1722 | /* ^^^ Centered inline-source-view elements */{ |
| 1723 | display:inline-block/*allows parent text-align to do the alignment*/; |
| 1724 | /* ^^^^ Browser incompatibility: inline-block causes the centered |
| 1725 | pikchr to shrink to the point of illegiblity in Chrome. The |
| @@ -1743,14 +1766,14 @@ | |
| 1743 | padding: 4em; |
| 1744 | } |
| 1745 | |
| 1746 | /* For pikchr-wrapper.source mode, toggle pre.pikchr-src and |
| 1747 | svg.pikchr visibility... */ |
| 1748 | div.pikchr-wrapper.source > pre.pikchr-src { |
| 1749 | /* Source code ^^^^^^^ is visible, else it is hidden */ |
| 1750 | } |
| 1751 | div.pikchr-wrapper:not(.source) > pre.pikchr-src { |
| 1752 | /* Hide sources when image is being shown. */ |
| 1753 | position: absolute !important; |
| 1754 | opacity: 0 !important; |
| 1755 | pointer-events: none !important; |
| 1756 | display: none !important; |
| 1757 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -1681,22 +1681,45 @@ | |
| 1681 | DOM structure: |
| 1682 | <DIV.pikchr-wrapper> |
| 1683 | <DIV.pikchr-svg> |
| 1684 | <SVG.pikchr>...</SVG> |
| 1685 | </DIV.pikchr-svg> |
| 1686 | <DIV.pikchr-src> |
| 1687 | <PRE>pikchr source code</PRE> |
| 1688 | <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> |
| 1689 | <!-- ^^^ is unhidden and activated by JS code --> |
| 1690 | </DIV.pikchr-src> |
| 1691 | </DIV.pikchr-wrapper> |
| 1692 | |
| 1693 | ************************************************************/ |
| 1694 | div.pikchr-wrapper {/*outer wrapper elem for a pikchr construct*/} |
| 1695 | div.pikchr-svg {/*wrapper for SVG.pikchr element*/} |
| 1696 | svg.pikchr {/*pikchr SVG*/ |
| 1697 | width: 100%/*necessary for SOME SVGs for Chrome!*/; |
| 1698 | } |
| 1699 | |
| 1700 | div.pikchr-src { |
| 1701 | /*Wrapper for source code view of a pikchr (see fossil.pikchr.js)*/ |
| 1702 | display: flex; |
| 1703 | flex-direction: column; |
| 1704 | } |
| 1705 | div.pikchr-src > pre { |
| 1706 | /*Source code for a pikchr*/ |
| 1707 | box-sizing: border-box; |
| 1708 | text-align: left; |
| 1709 | } |
| 1710 | div.pikchr-src > span { |
| 1711 | /*Wrapper for a link to open a pikchr in /pikchrshow*/ |
| 1712 | margin-top: 0.5em; |
| 1713 | margin-bottom: 0.5em; |
| 1714 | font-size: 85%; |
| 1715 | } |
| 1716 | div.pikchr-src > span::before { |
| 1717 | content: "["; |
| 1718 | } |
| 1719 | div.pikchr-src > span::after { |
| 1720 | content: "]"; |
| 1721 | } |
| 1722 | /* The .source-inline class tells the .source class that the |
| 1723 | source view, when enabled, should be "inline" (same position |
| 1724 | as the graphic), else the sources are shifted to the left as |
| 1725 | if they were "plain text". */ |
| @@ -1712,14 +1735,14 @@ | |
| 1735 | still-seemingly-legitimate browsers don't support grid mode. */ |
| 1736 | } |
| 1737 | div.pikchr-wrapper.center > div.pikchr-svg { |
| 1738 | width: 100%/*necessary for Chrome!*/; |
| 1739 | } |
| 1740 | div.pikchr-wrapper.center:not(.source) > div.pikchr-src, |
| 1741 | div.pikchr-wrapper.center:not(.source) > div.pikchr-svg, |
| 1742 | /* ^^^ Centered non-source-view elements */ |
| 1743 | div.pikchr-wrapper.center.source.source-inline div.pikchr-src, |
| 1744 | div.pikchr-wrapper.center.source.source-inline > div.pikchr-svg |
| 1745 | /* ^^^ Centered inline-source-view elements */{ |
| 1746 | display:inline-block/*allows parent text-align to do the alignment*/; |
| 1747 | /* ^^^^ Browser incompatibility: inline-block causes the centered |
| 1748 | pikchr to shrink to the point of illegiblity in Chrome. The |
| @@ -1743,14 +1766,14 @@ | |
| 1766 | padding: 4em; |
| 1767 | } |
| 1768 | |
| 1769 | /* For pikchr-wrapper.source mode, toggle pre.pikchr-src and |
| 1770 | svg.pikchr visibility... */ |
| 1771 | div.pikchr-wrapper.source > div.pikchr-src { |
| 1772 | /* Source code ^^^^^^^ is visible, else it is hidden */ |
| 1773 | } |
| 1774 | div.pikchr-wrapper:not(.source) > div.pikchr-src { |
| 1775 | /* Hide sources when image is being shown. */ |
| 1776 | position: absolute !important; |
| 1777 | opacity: 0 !important; |
| 1778 | pointer-events: none !important; |
| 1779 | display: none !important; |
| 1780 |
+29
-6
| --- src/default.css | ||
| +++ src/default.css | ||
| @@ -1681,22 +1681,45 @@ | ||
| 1681 | 1681 | DOM structure: |
| 1682 | 1682 | <DIV.pikchr-wrapper> |
| 1683 | 1683 | <DIV.pikchr-svg> |
| 1684 | 1684 | <SVG.pikchr>...</SVG> |
| 1685 | 1685 | </DIV.pikchr-svg> |
| 1686 | - <PRE.pikchr-src>...</PRE> | |
| 1686 | + <DIV.pikchr-src> | |
| 1687 | + <PRE>pikchr source code</PRE> | |
| 1688 | + <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> | |
| 1689 | + <!-- ^^^ is unhidden and activated by JS code --> | |
| 1690 | + </DIV.pikchr-src> | |
| 1687 | 1691 | </DIV.pikchr-wrapper> |
| 1688 | 1692 | |
| 1689 | 1693 | ************************************************************/ |
| 1690 | 1694 | div.pikchr-wrapper {/*outer wrapper elem for a pikchr construct*/} |
| 1691 | 1695 | div.pikchr-svg {/*wrapper for SVG.pikchr element*/} |
| 1692 | 1696 | svg.pikchr {/*pikchr SVG*/ |
| 1693 | 1697 | width: 100%/*necessary for SOME SVGs for Chrome!*/; |
| 1694 | 1698 | } |
| 1695 | -pre.pikchr-src {/*source code view for a pikchr (see fossil.pikchr.js)*/ | |
| 1699 | + | |
| 1700 | +div.pikchr-src { | |
| 1701 | + /*Wrapper for source code view of a pikchr (see fossil.pikchr.js)*/ | |
| 1702 | + display: flex; | |
| 1703 | + flex-direction: column; | |
| 1704 | +} | |
| 1705 | +div.pikchr-src > pre { | |
| 1706 | + /*Source code for a pikchr*/ | |
| 1696 | 1707 | box-sizing: border-box; |
| 1697 | 1708 | text-align: left; |
| 1709 | +} | |
| 1710 | +div.pikchr-src > span { | |
| 1711 | + /*Wrapper for a link to open a pikchr in /pikchrshow*/ | |
| 1712 | + margin-top: 0.5em; | |
| 1713 | + margin-bottom: 0.5em; | |
| 1714 | + font-size: 85%; | |
| 1715 | +} | |
| 1716 | +div.pikchr-src > span::before { | |
| 1717 | + content: "["; | |
| 1718 | +} | |
| 1719 | +div.pikchr-src > span::after { | |
| 1720 | + content: "]"; | |
| 1698 | 1721 | } |
| 1699 | 1722 | /* The .source-inline class tells the .source class that the |
| 1700 | 1723 | source view, when enabled, should be "inline" (same position |
| 1701 | 1724 | as the graphic), else the sources are shifted to the left as |
| 1702 | 1725 | if they were "plain text". */ |
| @@ -1712,14 +1735,14 @@ | ||
| 1712 | 1735 | still-seemingly-legitimate browsers don't support grid mode. */ |
| 1713 | 1736 | } |
| 1714 | 1737 | div.pikchr-wrapper.center > div.pikchr-svg { |
| 1715 | 1738 | width: 100%/*necessary for Chrome!*/; |
| 1716 | 1739 | } |
| 1717 | -div.pikchr-wrapper.center:not(.source) > pre.pikchr-src, | |
| 1740 | +div.pikchr-wrapper.center:not(.source) > div.pikchr-src, | |
| 1718 | 1741 | div.pikchr-wrapper.center:not(.source) > div.pikchr-svg, |
| 1719 | 1742 | /* ^^^ Centered non-source-view elements */ |
| 1720 | -div.pikchr-wrapper.center.source.source-inline > pre.pikchr-src, | |
| 1743 | +div.pikchr-wrapper.center.source.source-inline div.pikchr-src, | |
| 1721 | 1744 | div.pikchr-wrapper.center.source.source-inline > div.pikchr-svg |
| 1722 | 1745 | /* ^^^ Centered inline-source-view elements */{ |
| 1723 | 1746 | display:inline-block/*allows parent text-align to do the alignment*/; |
| 1724 | 1747 | /* ^^^^ Browser incompatibility: inline-block causes the centered |
| 1725 | 1748 | pikchr to shrink to the point of illegiblity in Chrome. The |
| @@ -1743,14 +1766,14 @@ | ||
| 1743 | 1766 | padding: 4em; |
| 1744 | 1767 | } |
| 1745 | 1768 | |
| 1746 | 1769 | /* For pikchr-wrapper.source mode, toggle pre.pikchr-src and |
| 1747 | 1770 | svg.pikchr visibility... */ |
| 1748 | -div.pikchr-wrapper.source > pre.pikchr-src { | |
| 1771 | +div.pikchr-wrapper.source > div.pikchr-src { | |
| 1749 | 1772 | /* Source code ^^^^^^^ is visible, else it is hidden */ |
| 1750 | 1773 | } |
| 1751 | -div.pikchr-wrapper:not(.source) > pre.pikchr-src { | |
| 1774 | +div.pikchr-wrapper:not(.source) > div.pikchr-src { | |
| 1752 | 1775 | /* Hide sources when image is being shown. */ |
| 1753 | 1776 | position: absolute !important; |
| 1754 | 1777 | opacity: 0 !important; |
| 1755 | 1778 | pointer-events: none !important; |
| 1756 | 1779 | display: none !important; |
| 1757 | 1780 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -1681,22 +1681,45 @@ | |
| 1681 | DOM structure: |
| 1682 | <DIV.pikchr-wrapper> |
| 1683 | <DIV.pikchr-svg> |
| 1684 | <SVG.pikchr>...</SVG> |
| 1685 | </DIV.pikchr-svg> |
| 1686 | <PRE.pikchr-src>...</PRE> |
| 1687 | </DIV.pikchr-wrapper> |
| 1688 | |
| 1689 | ************************************************************/ |
| 1690 | div.pikchr-wrapper {/*outer wrapper elem for a pikchr construct*/} |
| 1691 | div.pikchr-svg {/*wrapper for SVG.pikchr element*/} |
| 1692 | svg.pikchr {/*pikchr SVG*/ |
| 1693 | width: 100%/*necessary for SOME SVGs for Chrome!*/; |
| 1694 | } |
| 1695 | pre.pikchr-src {/*source code view for a pikchr (see fossil.pikchr.js)*/ |
| 1696 | box-sizing: border-box; |
| 1697 | text-align: left; |
| 1698 | } |
| 1699 | /* The .source-inline class tells the .source class that the |
| 1700 | source view, when enabled, should be "inline" (same position |
| 1701 | as the graphic), else the sources are shifted to the left as |
| 1702 | if they were "plain text". */ |
| @@ -1712,14 +1735,14 @@ | |
| 1712 | still-seemingly-legitimate browsers don't support grid mode. */ |
| 1713 | } |
| 1714 | div.pikchr-wrapper.center > div.pikchr-svg { |
| 1715 | width: 100%/*necessary for Chrome!*/; |
| 1716 | } |
| 1717 | div.pikchr-wrapper.center:not(.source) > pre.pikchr-src, |
| 1718 | div.pikchr-wrapper.center:not(.source) > div.pikchr-svg, |
| 1719 | /* ^^^ Centered non-source-view elements */ |
| 1720 | div.pikchr-wrapper.center.source.source-inline > pre.pikchr-src, |
| 1721 | div.pikchr-wrapper.center.source.source-inline > div.pikchr-svg |
| 1722 | /* ^^^ Centered inline-source-view elements */{ |
| 1723 | display:inline-block/*allows parent text-align to do the alignment*/; |
| 1724 | /* ^^^^ Browser incompatibility: inline-block causes the centered |
| 1725 | pikchr to shrink to the point of illegiblity in Chrome. The |
| @@ -1743,14 +1766,14 @@ | |
| 1743 | padding: 4em; |
| 1744 | } |
| 1745 | |
| 1746 | /* For pikchr-wrapper.source mode, toggle pre.pikchr-src and |
| 1747 | svg.pikchr visibility... */ |
| 1748 | div.pikchr-wrapper.source > pre.pikchr-src { |
| 1749 | /* Source code ^^^^^^^ is visible, else it is hidden */ |
| 1750 | } |
| 1751 | div.pikchr-wrapper:not(.source) > pre.pikchr-src { |
| 1752 | /* Hide sources when image is being shown. */ |
| 1753 | position: absolute !important; |
| 1754 | opacity: 0 !important; |
| 1755 | pointer-events: none !important; |
| 1756 | display: none !important; |
| 1757 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -1681,22 +1681,45 @@ | |
| 1681 | DOM structure: |
| 1682 | <DIV.pikchr-wrapper> |
| 1683 | <DIV.pikchr-svg> |
| 1684 | <SVG.pikchr>...</SVG> |
| 1685 | </DIV.pikchr-svg> |
| 1686 | <DIV.pikchr-src> |
| 1687 | <PRE>pikchr source code</PRE> |
| 1688 | <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> |
| 1689 | <!-- ^^^ is unhidden and activated by JS code --> |
| 1690 | </DIV.pikchr-src> |
| 1691 | </DIV.pikchr-wrapper> |
| 1692 | |
| 1693 | ************************************************************/ |
| 1694 | div.pikchr-wrapper {/*outer wrapper elem for a pikchr construct*/} |
| 1695 | div.pikchr-svg {/*wrapper for SVG.pikchr element*/} |
| 1696 | svg.pikchr {/*pikchr SVG*/ |
| 1697 | width: 100%/*necessary for SOME SVGs for Chrome!*/; |
| 1698 | } |
| 1699 | |
| 1700 | div.pikchr-src { |
| 1701 | /*Wrapper for source code view of a pikchr (see fossil.pikchr.js)*/ |
| 1702 | display: flex; |
| 1703 | flex-direction: column; |
| 1704 | } |
| 1705 | div.pikchr-src > pre { |
| 1706 | /*Source code for a pikchr*/ |
| 1707 | box-sizing: border-box; |
| 1708 | text-align: left; |
| 1709 | } |
| 1710 | div.pikchr-src > span { |
| 1711 | /*Wrapper for a link to open a pikchr in /pikchrshow*/ |
| 1712 | margin-top: 0.5em; |
| 1713 | margin-bottom: 0.5em; |
| 1714 | font-size: 85%; |
| 1715 | } |
| 1716 | div.pikchr-src > span::before { |
| 1717 | content: "["; |
| 1718 | } |
| 1719 | div.pikchr-src > span::after { |
| 1720 | content: "]"; |
| 1721 | } |
| 1722 | /* The .source-inline class tells the .source class that the |
| 1723 | source view, when enabled, should be "inline" (same position |
| 1724 | as the graphic), else the sources are shifted to the left as |
| 1725 | if they were "plain text". */ |
| @@ -1712,14 +1735,14 @@ | |
| 1735 | still-seemingly-legitimate browsers don't support grid mode. */ |
| 1736 | } |
| 1737 | div.pikchr-wrapper.center > div.pikchr-svg { |
| 1738 | width: 100%/*necessary for Chrome!*/; |
| 1739 | } |
| 1740 | div.pikchr-wrapper.center:not(.source) > div.pikchr-src, |
| 1741 | div.pikchr-wrapper.center:not(.source) > div.pikchr-svg, |
| 1742 | /* ^^^ Centered non-source-view elements */ |
| 1743 | div.pikchr-wrapper.center.source.source-inline div.pikchr-src, |
| 1744 | div.pikchr-wrapper.center.source.source-inline > div.pikchr-svg |
| 1745 | /* ^^^ Centered inline-source-view elements */{ |
| 1746 | display:inline-block/*allows parent text-align to do the alignment*/; |
| 1747 | /* ^^^^ Browser incompatibility: inline-block causes the centered |
| 1748 | pikchr to shrink to the point of illegiblity in Chrome. The |
| @@ -1743,14 +1766,14 @@ | |
| 1766 | padding: 4em; |
| 1767 | } |
| 1768 | |
| 1769 | /* For pikchr-wrapper.source mode, toggle pre.pikchr-src and |
| 1770 | svg.pikchr visibility... */ |
| 1771 | div.pikchr-wrapper.source > div.pikchr-src { |
| 1772 | /* Source code ^^^^^^^ is visible, else it is hidden */ |
| 1773 | } |
| 1774 | div.pikchr-wrapper:not(.source) > div.pikchr-src { |
| 1775 | /* Hide sources when image is being shown. */ |
| 1776 | position: absolute !important; |
| 1777 | opacity: 0 !important; |
| 1778 | pointer-events: none !important; |
| 1779 | display: none !important; |
| 1780 |
+29
-6
| --- src/default.css | ||
| +++ src/default.css | ||
| @@ -1681,22 +1681,45 @@ | ||
| 1681 | 1681 | DOM structure: |
| 1682 | 1682 | <DIV.pikchr-wrapper> |
| 1683 | 1683 | <DIV.pikchr-svg> |
| 1684 | 1684 | <SVG.pikchr>...</SVG> |
| 1685 | 1685 | </DIV.pikchr-svg> |
| 1686 | - <PRE.pikchr-src>...</PRE> | |
| 1686 | + <DIV.pikchr-src> | |
| 1687 | + <PRE>pikchr source code</PRE> | |
| 1688 | + <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> | |
| 1689 | + <!-- ^^^ is unhidden and activated by JS code --> | |
| 1690 | + </DIV.pikchr-src> | |
| 1687 | 1691 | </DIV.pikchr-wrapper> |
| 1688 | 1692 | |
| 1689 | 1693 | ************************************************************/ |
| 1690 | 1694 | div.pikchr-wrapper {/*outer wrapper elem for a pikchr construct*/} |
| 1691 | 1695 | div.pikchr-svg {/*wrapper for SVG.pikchr element*/} |
| 1692 | 1696 | svg.pikchr {/*pikchr SVG*/ |
| 1693 | 1697 | width: 100%/*necessary for SOME SVGs for Chrome!*/; |
| 1694 | 1698 | } |
| 1695 | -pre.pikchr-src {/*source code view for a pikchr (see fossil.pikchr.js)*/ | |
| 1699 | + | |
| 1700 | +div.pikchr-src { | |
| 1701 | + /*Wrapper for source code view of a pikchr (see fossil.pikchr.js)*/ | |
| 1702 | + display: flex; | |
| 1703 | + flex-direction: column; | |
| 1704 | +} | |
| 1705 | +div.pikchr-src > pre { | |
| 1706 | + /*Source code for a pikchr*/ | |
| 1696 | 1707 | box-sizing: border-box; |
| 1697 | 1708 | text-align: left; |
| 1709 | +} | |
| 1710 | +div.pikchr-src > span { | |
| 1711 | + /*Wrapper for a link to open a pikchr in /pikchrshow*/ | |
| 1712 | + margin-top: 0.5em; | |
| 1713 | + margin-bottom: 0.5em; | |
| 1714 | + font-size: 85%; | |
| 1715 | +} | |
| 1716 | +div.pikchr-src > span::before { | |
| 1717 | + content: "["; | |
| 1718 | +} | |
| 1719 | +div.pikchr-src > span::after { | |
| 1720 | + content: "]"; | |
| 1698 | 1721 | } |
| 1699 | 1722 | /* The .source-inline class tells the .source class that the |
| 1700 | 1723 | source view, when enabled, should be "inline" (same position |
| 1701 | 1724 | as the graphic), else the sources are shifted to the left as |
| 1702 | 1725 | if they were "plain text". */ |
| @@ -1712,14 +1735,14 @@ | ||
| 1712 | 1735 | still-seemingly-legitimate browsers don't support grid mode. */ |
| 1713 | 1736 | } |
| 1714 | 1737 | div.pikchr-wrapper.center > div.pikchr-svg { |
| 1715 | 1738 | width: 100%/*necessary for Chrome!*/; |
| 1716 | 1739 | } |
| 1717 | -div.pikchr-wrapper.center:not(.source) > pre.pikchr-src, | |
| 1740 | +div.pikchr-wrapper.center:not(.source) > div.pikchr-src, | |
| 1718 | 1741 | div.pikchr-wrapper.center:not(.source) > div.pikchr-svg, |
| 1719 | 1742 | /* ^^^ Centered non-source-view elements */ |
| 1720 | -div.pikchr-wrapper.center.source.source-inline > pre.pikchr-src, | |
| 1743 | +div.pikchr-wrapper.center.source.source-inline div.pikchr-src, | |
| 1721 | 1744 | div.pikchr-wrapper.center.source.source-inline > div.pikchr-svg |
| 1722 | 1745 | /* ^^^ Centered inline-source-view elements */{ |
| 1723 | 1746 | display:inline-block/*allows parent text-align to do the alignment*/; |
| 1724 | 1747 | /* ^^^^ Browser incompatibility: inline-block causes the centered |
| 1725 | 1748 | pikchr to shrink to the point of illegiblity in Chrome. The |
| @@ -1743,14 +1766,14 @@ | ||
| 1743 | 1766 | padding: 4em; |
| 1744 | 1767 | } |
| 1745 | 1768 | |
| 1746 | 1769 | /* For pikchr-wrapper.source mode, toggle pre.pikchr-src and |
| 1747 | 1770 | svg.pikchr visibility... */ |
| 1748 | -div.pikchr-wrapper.source > pre.pikchr-src { | |
| 1771 | +div.pikchr-wrapper.source > div.pikchr-src { | |
| 1749 | 1772 | /* Source code ^^^^^^^ is visible, else it is hidden */ |
| 1750 | 1773 | } |
| 1751 | -div.pikchr-wrapper:not(.source) > pre.pikchr-src { | |
| 1774 | +div.pikchr-wrapper:not(.source) > div.pikchr-src { | |
| 1752 | 1775 | /* Hide sources when image is being shown. */ |
| 1753 | 1776 | position: absolute !important; |
| 1754 | 1777 | opacity: 0 !important; |
| 1755 | 1778 | pointer-events: none !important; |
| 1756 | 1779 | display: none !important; |
| 1757 | 1780 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -1681,22 +1681,45 @@ | |
| 1681 | DOM structure: |
| 1682 | <DIV.pikchr-wrapper> |
| 1683 | <DIV.pikchr-svg> |
| 1684 | <SVG.pikchr>...</SVG> |
| 1685 | </DIV.pikchr-svg> |
| 1686 | <PRE.pikchr-src>...</PRE> |
| 1687 | </DIV.pikchr-wrapper> |
| 1688 | |
| 1689 | ************************************************************/ |
| 1690 | div.pikchr-wrapper {/*outer wrapper elem for a pikchr construct*/} |
| 1691 | div.pikchr-svg {/*wrapper for SVG.pikchr element*/} |
| 1692 | svg.pikchr {/*pikchr SVG*/ |
| 1693 | width: 100%/*necessary for SOME SVGs for Chrome!*/; |
| 1694 | } |
| 1695 | pre.pikchr-src {/*source code view for a pikchr (see fossil.pikchr.js)*/ |
| 1696 | box-sizing: border-box; |
| 1697 | text-align: left; |
| 1698 | } |
| 1699 | /* The .source-inline class tells the .source class that the |
| 1700 | source view, when enabled, should be "inline" (same position |
| 1701 | as the graphic), else the sources are shifted to the left as |
| 1702 | if they were "plain text". */ |
| @@ -1712,14 +1735,14 @@ | |
| 1712 | still-seemingly-legitimate browsers don't support grid mode. */ |
| 1713 | } |
| 1714 | div.pikchr-wrapper.center > div.pikchr-svg { |
| 1715 | width: 100%/*necessary for Chrome!*/; |
| 1716 | } |
| 1717 | div.pikchr-wrapper.center:not(.source) > pre.pikchr-src, |
| 1718 | div.pikchr-wrapper.center:not(.source) > div.pikchr-svg, |
| 1719 | /* ^^^ Centered non-source-view elements */ |
| 1720 | div.pikchr-wrapper.center.source.source-inline > pre.pikchr-src, |
| 1721 | div.pikchr-wrapper.center.source.source-inline > div.pikchr-svg |
| 1722 | /* ^^^ Centered inline-source-view elements */{ |
| 1723 | display:inline-block/*allows parent text-align to do the alignment*/; |
| 1724 | /* ^^^^ Browser incompatibility: inline-block causes the centered |
| 1725 | pikchr to shrink to the point of illegiblity in Chrome. The |
| @@ -1743,14 +1766,14 @@ | |
| 1743 | padding: 4em; |
| 1744 | } |
| 1745 | |
| 1746 | /* For pikchr-wrapper.source mode, toggle pre.pikchr-src and |
| 1747 | svg.pikchr visibility... */ |
| 1748 | div.pikchr-wrapper.source > pre.pikchr-src { |
| 1749 | /* Source code ^^^^^^^ is visible, else it is hidden */ |
| 1750 | } |
| 1751 | div.pikchr-wrapper:not(.source) > pre.pikchr-src { |
| 1752 | /* Hide sources when image is being shown. */ |
| 1753 | position: absolute !important; |
| 1754 | opacity: 0 !important; |
| 1755 | pointer-events: none !important; |
| 1756 | display: none !important; |
| 1757 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -1681,22 +1681,45 @@ | |
| 1681 | DOM structure: |
| 1682 | <DIV.pikchr-wrapper> |
| 1683 | <DIV.pikchr-svg> |
| 1684 | <SVG.pikchr>...</SVG> |
| 1685 | </DIV.pikchr-svg> |
| 1686 | <DIV.pikchr-src> |
| 1687 | <PRE>pikchr source code</PRE> |
| 1688 | <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> |
| 1689 | <!-- ^^^ is unhidden and activated by JS code --> |
| 1690 | </DIV.pikchr-src> |
| 1691 | </DIV.pikchr-wrapper> |
| 1692 | |
| 1693 | ************************************************************/ |
| 1694 | div.pikchr-wrapper {/*outer wrapper elem for a pikchr construct*/} |
| 1695 | div.pikchr-svg {/*wrapper for SVG.pikchr element*/} |
| 1696 | svg.pikchr {/*pikchr SVG*/ |
| 1697 | width: 100%/*necessary for SOME SVGs for Chrome!*/; |
| 1698 | } |
| 1699 | |
| 1700 | div.pikchr-src { |
| 1701 | /*Wrapper for source code view of a pikchr (see fossil.pikchr.js)*/ |
| 1702 | display: flex; |
| 1703 | flex-direction: column; |
| 1704 | } |
| 1705 | div.pikchr-src > pre { |
| 1706 | /*Source code for a pikchr*/ |
| 1707 | box-sizing: border-box; |
| 1708 | text-align: left; |
| 1709 | } |
| 1710 | div.pikchr-src > span { |
| 1711 | /*Wrapper for a link to open a pikchr in /pikchrshow*/ |
| 1712 | margin-top: 0.5em; |
| 1713 | margin-bottom: 0.5em; |
| 1714 | font-size: 85%; |
| 1715 | } |
| 1716 | div.pikchr-src > span::before { |
| 1717 | content: "["; |
| 1718 | } |
| 1719 | div.pikchr-src > span::after { |
| 1720 | content: "]"; |
| 1721 | } |
| 1722 | /* The .source-inline class tells the .source class that the |
| 1723 | source view, when enabled, should be "inline" (same position |
| 1724 | as the graphic), else the sources are shifted to the left as |
| 1725 | if they were "plain text". */ |
| @@ -1712,14 +1735,14 @@ | |
| 1735 | still-seemingly-legitimate browsers don't support grid mode. */ |
| 1736 | } |
| 1737 | div.pikchr-wrapper.center > div.pikchr-svg { |
| 1738 | width: 100%/*necessary for Chrome!*/; |
| 1739 | } |
| 1740 | div.pikchr-wrapper.center:not(.source) > div.pikchr-src, |
| 1741 | div.pikchr-wrapper.center:not(.source) > div.pikchr-svg, |
| 1742 | /* ^^^ Centered non-source-view elements */ |
| 1743 | div.pikchr-wrapper.center.source.source-inline div.pikchr-src, |
| 1744 | div.pikchr-wrapper.center.source.source-inline > div.pikchr-svg |
| 1745 | /* ^^^ Centered inline-source-view elements */{ |
| 1746 | display:inline-block/*allows parent text-align to do the alignment*/; |
| 1747 | /* ^^^^ Browser incompatibility: inline-block causes the centered |
| 1748 | pikchr to shrink to the point of illegiblity in Chrome. The |
| @@ -1743,14 +1766,14 @@ | |
| 1766 | padding: 4em; |
| 1767 | } |
| 1768 | |
| 1769 | /* For pikchr-wrapper.source mode, toggle pre.pikchr-src and |
| 1770 | svg.pikchr visibility... */ |
| 1771 | div.pikchr-wrapper.source > div.pikchr-src { |
| 1772 | /* Source code ^^^^^^^ is visible, else it is hidden */ |
| 1773 | } |
| 1774 | div.pikchr-wrapper:not(.source) > div.pikchr-src { |
| 1775 | /* Hide sources when image is being shown. */ |
| 1776 | position: absolute !important; |
| 1777 | opacity: 0 !important; |
| 1778 | pointer-events: none !important; |
| 1779 | display: none !important; |
| 1780 |
+29
-6
| --- src/default.css | ||
| +++ src/default.css | ||
| @@ -1681,22 +1681,45 @@ | ||
| 1681 | 1681 | DOM structure: |
| 1682 | 1682 | <DIV.pikchr-wrapper> |
| 1683 | 1683 | <DIV.pikchr-svg> |
| 1684 | 1684 | <SVG.pikchr>...</SVG> |
| 1685 | 1685 | </DIV.pikchr-svg> |
| 1686 | - <PRE.pikchr-src>...</PRE> | |
| 1686 | + <DIV.pikchr-src> | |
| 1687 | + <PRE>pikchr source code</PRE> | |
| 1688 | + <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> | |
| 1689 | + <!-- ^^^ is unhidden and activated by JS code --> | |
| 1690 | + </DIV.pikchr-src> | |
| 1687 | 1691 | </DIV.pikchr-wrapper> |
| 1688 | 1692 | |
| 1689 | 1693 | ************************************************************/ |
| 1690 | 1694 | div.pikchr-wrapper {/*outer wrapper elem for a pikchr construct*/} |
| 1691 | 1695 | div.pikchr-svg {/*wrapper for SVG.pikchr element*/} |
| 1692 | 1696 | svg.pikchr {/*pikchr SVG*/ |
| 1693 | 1697 | width: 100%/*necessary for SOME SVGs for Chrome!*/; |
| 1694 | 1698 | } |
| 1695 | -pre.pikchr-src {/*source code view for a pikchr (see fossil.pikchr.js)*/ | |
| 1699 | + | |
| 1700 | +div.pikchr-src { | |
| 1701 | + /*Wrapper for source code view of a pikchr (see fossil.pikchr.js)*/ | |
| 1702 | + display: flex; | |
| 1703 | + flex-direction: column; | |
| 1704 | +} | |
| 1705 | +div.pikchr-src > pre { | |
| 1706 | + /*Source code for a pikchr*/ | |
| 1696 | 1707 | box-sizing: border-box; |
| 1697 | 1708 | text-align: left; |
| 1709 | +} | |
| 1710 | +div.pikchr-src > span { | |
| 1711 | + /*Wrapper for a link to open a pikchr in /pikchrshow*/ | |
| 1712 | + margin-top: 0.5em; | |
| 1713 | + margin-bottom: 0.5em; | |
| 1714 | + font-size: 85%; | |
| 1715 | +} | |
| 1716 | +div.pikchr-src > span::before { | |
| 1717 | + content: "["; | |
| 1718 | +} | |
| 1719 | +div.pikchr-src > span::after { | |
| 1720 | + content: "]"; | |
| 1698 | 1721 | } |
| 1699 | 1722 | /* The .source-inline class tells the .source class that the |
| 1700 | 1723 | source view, when enabled, should be "inline" (same position |
| 1701 | 1724 | as the graphic), else the sources are shifted to the left as |
| 1702 | 1725 | if they were "plain text". */ |
| @@ -1712,14 +1735,14 @@ | ||
| 1712 | 1735 | still-seemingly-legitimate browsers don't support grid mode. */ |
| 1713 | 1736 | } |
| 1714 | 1737 | div.pikchr-wrapper.center > div.pikchr-svg { |
| 1715 | 1738 | width: 100%/*necessary for Chrome!*/; |
| 1716 | 1739 | } |
| 1717 | -div.pikchr-wrapper.center:not(.source) > pre.pikchr-src, | |
| 1740 | +div.pikchr-wrapper.center:not(.source) > div.pikchr-src, | |
| 1718 | 1741 | div.pikchr-wrapper.center:not(.source) > div.pikchr-svg, |
| 1719 | 1742 | /* ^^^ Centered non-source-view elements */ |
| 1720 | -div.pikchr-wrapper.center.source.source-inline > pre.pikchr-src, | |
| 1743 | +div.pikchr-wrapper.center.source.source-inline div.pikchr-src, | |
| 1721 | 1744 | div.pikchr-wrapper.center.source.source-inline > div.pikchr-svg |
| 1722 | 1745 | /* ^^^ Centered inline-source-view elements */{ |
| 1723 | 1746 | display:inline-block/*allows parent text-align to do the alignment*/; |
| 1724 | 1747 | /* ^^^^ Browser incompatibility: inline-block causes the centered |
| 1725 | 1748 | pikchr to shrink to the point of illegiblity in Chrome. The |
| @@ -1743,14 +1766,14 @@ | ||
| 1743 | 1766 | padding: 4em; |
| 1744 | 1767 | } |
| 1745 | 1768 | |
| 1746 | 1769 | /* For pikchr-wrapper.source mode, toggle pre.pikchr-src and |
| 1747 | 1770 | svg.pikchr visibility... */ |
| 1748 | -div.pikchr-wrapper.source > pre.pikchr-src { | |
| 1771 | +div.pikchr-wrapper.source > div.pikchr-src { | |
| 1749 | 1772 | /* Source code ^^^^^^^ is visible, else it is hidden */ |
| 1750 | 1773 | } |
| 1751 | -div.pikchr-wrapper:not(.source) > pre.pikchr-src { | |
| 1774 | +div.pikchr-wrapper:not(.source) > div.pikchr-src { | |
| 1752 | 1775 | /* Hide sources when image is being shown. */ |
| 1753 | 1776 | position: absolute !important; |
| 1754 | 1777 | opacity: 0 !important; |
| 1755 | 1778 | pointer-events: none !important; |
| 1756 | 1779 | display: none !important; |
| 1757 | 1780 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -1681,22 +1681,45 @@ | |
| 1681 | DOM structure: |
| 1682 | <DIV.pikchr-wrapper> |
| 1683 | <DIV.pikchr-svg> |
| 1684 | <SVG.pikchr>...</SVG> |
| 1685 | </DIV.pikchr-svg> |
| 1686 | <PRE.pikchr-src>...</PRE> |
| 1687 | </DIV.pikchr-wrapper> |
| 1688 | |
| 1689 | ************************************************************/ |
| 1690 | div.pikchr-wrapper {/*outer wrapper elem for a pikchr construct*/} |
| 1691 | div.pikchr-svg {/*wrapper for SVG.pikchr element*/} |
| 1692 | svg.pikchr {/*pikchr SVG*/ |
| 1693 | width: 100%/*necessary for SOME SVGs for Chrome!*/; |
| 1694 | } |
| 1695 | pre.pikchr-src {/*source code view for a pikchr (see fossil.pikchr.js)*/ |
| 1696 | box-sizing: border-box; |
| 1697 | text-align: left; |
| 1698 | } |
| 1699 | /* The .source-inline class tells the .source class that the |
| 1700 | source view, when enabled, should be "inline" (same position |
| 1701 | as the graphic), else the sources are shifted to the left as |
| 1702 | if they were "plain text". */ |
| @@ -1712,14 +1735,14 @@ | |
| 1712 | still-seemingly-legitimate browsers don't support grid mode. */ |
| 1713 | } |
| 1714 | div.pikchr-wrapper.center > div.pikchr-svg { |
| 1715 | width: 100%/*necessary for Chrome!*/; |
| 1716 | } |
| 1717 | div.pikchr-wrapper.center:not(.source) > pre.pikchr-src, |
| 1718 | div.pikchr-wrapper.center:not(.source) > div.pikchr-svg, |
| 1719 | /* ^^^ Centered non-source-view elements */ |
| 1720 | div.pikchr-wrapper.center.source.source-inline > pre.pikchr-src, |
| 1721 | div.pikchr-wrapper.center.source.source-inline > div.pikchr-svg |
| 1722 | /* ^^^ Centered inline-source-view elements */{ |
| 1723 | display:inline-block/*allows parent text-align to do the alignment*/; |
| 1724 | /* ^^^^ Browser incompatibility: inline-block causes the centered |
| 1725 | pikchr to shrink to the point of illegiblity in Chrome. The |
| @@ -1743,14 +1766,14 @@ | |
| 1743 | padding: 4em; |
| 1744 | } |
| 1745 | |
| 1746 | /* For pikchr-wrapper.source mode, toggle pre.pikchr-src and |
| 1747 | svg.pikchr visibility... */ |
| 1748 | div.pikchr-wrapper.source > pre.pikchr-src { |
| 1749 | /* Source code ^^^^^^^ is visible, else it is hidden */ |
| 1750 | } |
| 1751 | div.pikchr-wrapper:not(.source) > pre.pikchr-src { |
| 1752 | /* Hide sources when image is being shown. */ |
| 1753 | position: absolute !important; |
| 1754 | opacity: 0 !important; |
| 1755 | pointer-events: none !important; |
| 1756 | display: none !important; |
| 1757 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -1681,22 +1681,45 @@ | |
| 1681 | DOM structure: |
| 1682 | <DIV.pikchr-wrapper> |
| 1683 | <DIV.pikchr-svg> |
| 1684 | <SVG.pikchr>...</SVG> |
| 1685 | </DIV.pikchr-svg> |
| 1686 | <DIV.pikchr-src> |
| 1687 | <PRE>pikchr source code</PRE> |
| 1688 | <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> |
| 1689 | <!-- ^^^ is unhidden and activated by JS code --> |
| 1690 | </DIV.pikchr-src> |
| 1691 | </DIV.pikchr-wrapper> |
| 1692 | |
| 1693 | ************************************************************/ |
| 1694 | div.pikchr-wrapper {/*outer wrapper elem for a pikchr construct*/} |
| 1695 | div.pikchr-svg {/*wrapper for SVG.pikchr element*/} |
| 1696 | svg.pikchr {/*pikchr SVG*/ |
| 1697 | width: 100%/*necessary for SOME SVGs for Chrome!*/; |
| 1698 | } |
| 1699 | |
| 1700 | div.pikchr-src { |
| 1701 | /*Wrapper for source code view of a pikchr (see fossil.pikchr.js)*/ |
| 1702 | display: flex; |
| 1703 | flex-direction: column; |
| 1704 | } |
| 1705 | div.pikchr-src > pre { |
| 1706 | /*Source code for a pikchr*/ |
| 1707 | box-sizing: border-box; |
| 1708 | text-align: left; |
| 1709 | } |
| 1710 | div.pikchr-src > span { |
| 1711 | /*Wrapper for a link to open a pikchr in /pikchrshow*/ |
| 1712 | margin-top: 0.5em; |
| 1713 | margin-bottom: 0.5em; |
| 1714 | font-size: 85%; |
| 1715 | } |
| 1716 | div.pikchr-src > span::before { |
| 1717 | content: "["; |
| 1718 | } |
| 1719 | div.pikchr-src > span::after { |
| 1720 | content: "]"; |
| 1721 | } |
| 1722 | /* The .source-inline class tells the .source class that the |
| 1723 | source view, when enabled, should be "inline" (same position |
| 1724 | as the graphic), else the sources are shifted to the left as |
| 1725 | if they were "plain text". */ |
| @@ -1712,14 +1735,14 @@ | |
| 1735 | still-seemingly-legitimate browsers don't support grid mode. */ |
| 1736 | } |
| 1737 | div.pikchr-wrapper.center > div.pikchr-svg { |
| 1738 | width: 100%/*necessary for Chrome!*/; |
| 1739 | } |
| 1740 | div.pikchr-wrapper.center:not(.source) > div.pikchr-src, |
| 1741 | div.pikchr-wrapper.center:not(.source) > div.pikchr-svg, |
| 1742 | /* ^^^ Centered non-source-view elements */ |
| 1743 | div.pikchr-wrapper.center.source.source-inline div.pikchr-src, |
| 1744 | div.pikchr-wrapper.center.source.source-inline > div.pikchr-svg |
| 1745 | /* ^^^ Centered inline-source-view elements */{ |
| 1746 | display:inline-block/*allows parent text-align to do the alignment*/; |
| 1747 | /* ^^^^ Browser incompatibility: inline-block causes the centered |
| 1748 | pikchr to shrink to the point of illegiblity in Chrome. The |
| @@ -1743,14 +1766,14 @@ | |
| 1766 | padding: 4em; |
| 1767 | } |
| 1768 | |
| 1769 | /* For pikchr-wrapper.source mode, toggle pre.pikchr-src and |
| 1770 | svg.pikchr visibility... */ |
| 1771 | div.pikchr-wrapper.source > div.pikchr-src { |
| 1772 | /* Source code ^^^^^^^ is visible, else it is hidden */ |
| 1773 | } |
| 1774 | div.pikchr-wrapper:not(.source) > div.pikchr-src { |
| 1775 | /* Hide sources when image is being shown. */ |
| 1776 | position: absolute !important; |
| 1777 | opacity: 0 !important; |
| 1778 | pointer-events: none !important; |
| 1779 | display: none !important; |
| 1780 |
+15
-3
| --- src/fossil.page.pikchrshowasm.js | ||
| +++ src/fossil.page.pikchrshowasm.js | ||
| @@ -206,11 +206,11 @@ | ||
| 206 | 206 | const text = getCurrentText(); |
| 207 | 207 | if(text) PS.render(text); |
| 208 | 208 | }; |
| 209 | 209 | const setCurrentText = function(txt){ |
| 210 | 210 | taInput.value = txt; |
| 211 | - renderCurrentText(); | |
| 211 | + renderCurrentText(); | |
| 212 | 212 | }; |
| 213 | 213 | PS.e.btnRender.addEventListener('click',function(ev){ |
| 214 | 214 | ev.preventDefault(); |
| 215 | 215 | renderCurrentText(); |
| 216 | 216 | },false); |
| @@ -427,13 +427,25 @@ | ||
| 427 | 427 | btnToggle.addEventListener('click', function(){ |
| 428 | 428 | fs.classList.toggle('collapsed'); |
| 429 | 429 | content.forEach((d)=>d.classList.toggle('hidden')); |
| 430 | 430 | }, false); |
| 431 | 431 | }); |
| 432 | + | |
| 433 | + if(window.sessionStorage){ | |
| 434 | + /* If sessionStorage['pikchr-xfer'] exists and the "fromSession" | |
| 435 | + URL argument was passed to this page, load the pikchr source | |
| 436 | + from the session. This is used by the "open in pikchrshow" | |
| 437 | + link in the forum. */ | |
| 438 | + const src = window.sessionStorage.getItem('pikchr-xfer'); | |
| 439 | + if( src && (new URL(self.location.href).searchParams).has('fromSession') ){ | |
| 440 | + taInput.value = src; | |
| 441 | + window.sessionStorage.removeItem('pikchr-xfer'); | |
| 442 | + } | |
| 443 | + } | |
| 432 | 444 | |
| 433 | 445 | PS.e.btnRender.click(); |
| 434 | - | |
| 446 | + | |
| 435 | 447 | /** Debounce handler for auto-rendering while typing. */ |
| 436 | 448 | const debounceAutoRender = F.debounce(function f(){ |
| 437 | 449 | if(!PS._isDirty) return; |
| 438 | 450 | const text = getCurrentText(); |
| 439 | 451 | if(f._ === text){ |
| @@ -618,11 +630,11 @@ | ||
| 618 | 630 | "Darlene" above aligned |
| 619 | 631 | |
| 620 | 632 | # fill in content for the Alice lane |
| 621 | 633 | right |
| 622 | 634 | A1: circle rad 0.1in at end of first line + (0.2,-0.2) \ |
| 623 | - fill white thickness 1.5px "1" | |
| 635 | + fill white thickness 1.5px "1" | |
| 624 | 636 | arrow right 50% |
| 625 | 637 | circle same "2" |
| 626 | 638 | arrow right until even with first box.e - (0.65,0.0) |
| 627 | 639 | ellipse "future" fit fill white height 0.2 width 0.5 thickness 1.5px |
| 628 | 640 | A3: circle same at A1+(0.8,-0.3) "3" fill 0xc0c0c0 |
| 629 | 641 |
| --- src/fossil.page.pikchrshowasm.js | |
| +++ src/fossil.page.pikchrshowasm.js | |
| @@ -206,11 +206,11 @@ | |
| 206 | const text = getCurrentText(); |
| 207 | if(text) PS.render(text); |
| 208 | }; |
| 209 | const setCurrentText = function(txt){ |
| 210 | taInput.value = txt; |
| 211 | renderCurrentText(); |
| 212 | }; |
| 213 | PS.e.btnRender.addEventListener('click',function(ev){ |
| 214 | ev.preventDefault(); |
| 215 | renderCurrentText(); |
| 216 | },false); |
| @@ -427,13 +427,25 @@ | |
| 427 | btnToggle.addEventListener('click', function(){ |
| 428 | fs.classList.toggle('collapsed'); |
| 429 | content.forEach((d)=>d.classList.toggle('hidden')); |
| 430 | }, false); |
| 431 | }); |
| 432 | |
| 433 | PS.e.btnRender.click(); |
| 434 | |
| 435 | /** Debounce handler for auto-rendering while typing. */ |
| 436 | const debounceAutoRender = F.debounce(function f(){ |
| 437 | if(!PS._isDirty) return; |
| 438 | const text = getCurrentText(); |
| 439 | if(f._ === text){ |
| @@ -618,11 +630,11 @@ | |
| 618 | "Darlene" above aligned |
| 619 | |
| 620 | # fill in content for the Alice lane |
| 621 | right |
| 622 | A1: circle rad 0.1in at end of first line + (0.2,-0.2) \ |
| 623 | fill white thickness 1.5px "1" |
| 624 | arrow right 50% |
| 625 | circle same "2" |
| 626 | arrow right until even with first box.e - (0.65,0.0) |
| 627 | ellipse "future" fit fill white height 0.2 width 0.5 thickness 1.5px |
| 628 | A3: circle same at A1+(0.8,-0.3) "3" fill 0xc0c0c0 |
| 629 |
| --- src/fossil.page.pikchrshowasm.js | |
| +++ src/fossil.page.pikchrshowasm.js | |
| @@ -206,11 +206,11 @@ | |
| 206 | const text = getCurrentText(); |
| 207 | if(text) PS.render(text); |
| 208 | }; |
| 209 | const setCurrentText = function(txt){ |
| 210 | taInput.value = txt; |
| 211 | renderCurrentText(); |
| 212 | }; |
| 213 | PS.e.btnRender.addEventListener('click',function(ev){ |
| 214 | ev.preventDefault(); |
| 215 | renderCurrentText(); |
| 216 | },false); |
| @@ -427,13 +427,25 @@ | |
| 427 | btnToggle.addEventListener('click', function(){ |
| 428 | fs.classList.toggle('collapsed'); |
| 429 | content.forEach((d)=>d.classList.toggle('hidden')); |
| 430 | }, false); |
| 431 | }); |
| 432 | |
| 433 | if(window.sessionStorage){ |
| 434 | /* If sessionStorage['pikchr-xfer'] exists and the "fromSession" |
| 435 | URL argument was passed to this page, load the pikchr source |
| 436 | from the session. This is used by the "open in pikchrshow" |
| 437 | link in the forum. */ |
| 438 | const src = window.sessionStorage.getItem('pikchr-xfer'); |
| 439 | if( src && (new URL(self.location.href).searchParams).has('fromSession') ){ |
| 440 | taInput.value = src; |
| 441 | window.sessionStorage.removeItem('pikchr-xfer'); |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | PS.e.btnRender.click(); |
| 446 | |
| 447 | /** Debounce handler for auto-rendering while typing. */ |
| 448 | const debounceAutoRender = F.debounce(function f(){ |
| 449 | if(!PS._isDirty) return; |
| 450 | const text = getCurrentText(); |
| 451 | if(f._ === text){ |
| @@ -618,11 +630,11 @@ | |
| 630 | "Darlene" above aligned |
| 631 | |
| 632 | # fill in content for the Alice lane |
| 633 | right |
| 634 | A1: circle rad 0.1in at end of first line + (0.2,-0.2) \ |
| 635 | fill white thickness 1.5px "1" |
| 636 | arrow right 50% |
| 637 | circle same "2" |
| 638 | arrow right until even with first box.e - (0.65,0.0) |
| 639 | ellipse "future" fit fill white height 0.2 width 0.5 thickness 1.5px |
| 640 | A3: circle same at A1+(0.8,-0.3) "3" fill 0xc0c0c0 |
| 641 |
+54
-6
| --- src/fossil.pikchr.js | ||
| +++ src/fossil.pikchr.js | ||
| @@ -38,11 +38,14 @@ | ||
| 38 | 38 | This code expects the following structure around the SVGs, and |
| 39 | 39 | will not process any which don't match this: |
| 40 | 40 | |
| 41 | 41 | <DIV.pikchr-wrapper> |
| 42 | 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | - <PRE.pikchr-src></PRE> | |
| 43 | + <DIV.pikchr-src> | |
| 44 | + <PRE>pikchr source code</PRE> | |
| 45 | + <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> | |
| 46 | + </DIV> | |
| 44 | 47 | </DIV> |
| 45 | 48 | */ |
| 46 | 49 | P.addSrcView = function f(svg){ |
| 47 | 50 | if(!f.hasOwnProperty('parentClick')){ |
| 48 | 51 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | ||
| 58 | 61 | this.classList.toggle('source'); |
| 59 | 62 | ev.stopPropagation(); |
| 60 | 63 | ev.preventDefault(); |
| 61 | 64 | } |
| 62 | 65 | }; |
| 66 | + /** | |
| 67 | + Event handler for the "open in pikchrshow" links: store the | |
| 68 | + source code for the link's pikchr in | |
| 69 | + window.sessionStorage['pikchr-xfer'] then open | |
| 70 | + /pikchrshow?fromSession to trigger loading of that pikchr. | |
| 71 | + */ | |
| 72 | + f.clickPikchrShow = function(ev){ | |
| 73 | + const pId = this.dataset['pikchrid'] /* ID of the associated pikchr source code element */; | |
| 74 | + if(!pId) return; | |
| 75 | + const ePikchr = this.parentNode.parentNode.querySelector('#'+pId); | |
| 76 | + if(!ePikchr) return; | |
| 77 | + ev.stopPropagation() /* keep pikchr source view from toggling */; | |
| 78 | + window.sessionStorage.setItem('pikchr-xfer', ePikchr.innerText); | |
| 79 | + /* | |
| 80 | + After returning from this function the link element will | |
| 81 | + open [/pikchrshow?fromSession], and pikchrshow will extract | |
| 82 | + the pikchr source code from sessionStorage['pikchr-xfer']. | |
| 83 | + | |
| 84 | + Quirks of this ^^^ design: | |
| 85 | + | |
| 86 | + We use only a single slot in sessionStorage. We could | |
| 87 | + alternately use a key like pikchr-$pId and pass that key on | |
| 88 | + to /pikchrshow via fromSession=pikchr-$pId, but that would | |
| 89 | + eventually lead to stale session entries if loading of | |
| 90 | + pikchrshow were interrupted at an untimely point. The | |
| 91 | + down-side of _not_ doing that is that some user (or | |
| 92 | + automation) options multiple "open in pikchrshow" links | |
| 93 | + rapidly enough, the will open the same pikchr (the one which | |
| 94 | + was stored in the session's slot most recently). The | |
| 95 | + current approach should be fine for normal human interaction | |
| 96 | + speeds, but if it proves to be a problem we can instead use | |
| 97 | + the above-described approach of storing each pikchr in its | |
| 98 | + own session slot and simply accept that there may be stale | |
| 99 | + entries at some point. | |
| 100 | + */ | |
| 101 | + }; | |
| 63 | 102 | }; |
| 64 | 103 | if(!svg) svg = 'svg.pikchr'; |
| 65 | 104 | if('string' === typeof svg){ |
| 66 | 105 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 67 | 106 | return this; |
| @@ -71,15 +110,24 @@ | ||
| 71 | 110 | } |
| 72 | 111 | if(svg.dataset.pikchrProcessed){ |
| 73 | 112 | return this; |
| 74 | 113 | } |
| 75 | 114 | svg.dataset.pikchrProcessed = 1; |
| 76 | - const parent = svg.parentNode.parentNode /* outermost div.pikchr-wrapper */; | |
| 77 | - const srcView = parent ? svg.parentNode.nextElementSibling : undefined; | |
| 78 | - if(!srcView || !srcView.classList.contains('pikchr-src')){ | |
| 115 | + const parent = svg.parentNode.parentNode /* outermost DIV.pikchr-wrapper */; | |
| 116 | + const srcView = parent ? svg.parentNode.nextElementSibling /* DIV.pikchr-src */ : undefined; | |
| 117 | + if(srcView && srcView.classList.contains('pikchr-src')){ | |
| 79 | 118 | /* Without this element, there's nothing for us to do here. */ |
| 80 | - return this; | |
| 119 | + parent.addEventListener('click', f.parentClick, false); | |
| 120 | + const eSpan = window.sessionStorage | |
| 121 | + ? srcView.querySelector('span') /* "open in..." link wrapper */ | |
| 122 | + : undefined; | |
| 123 | + if(eSpan){ | |
| 124 | + const openLink = eSpan.querySelector('a'); | |
| 125 | + if(openLink){ | |
| 126 | + openLink.addEventListener('click', f.clickPikchrShow, false); | |
| 127 | + eSpan.classList.remove('hidden'); | |
| 128 | + } | |
| 129 | + } | |
| 81 | 130 | } |
| 82 | - parent.addEventListener('click', f.parentClick, false); | |
| 83 | 131 | return this; |
| 84 | 132 | }; |
| 85 | 133 | })(window.fossil); |
| 86 | 134 |
| --- src/fossil.pikchr.js | |
| +++ src/fossil.pikchr.js | |
| @@ -38,11 +38,14 @@ | |
| 38 | This code expects the following structure around the SVGs, and |
| 39 | will not process any which don't match this: |
| 40 | |
| 41 | <DIV.pikchr-wrapper> |
| 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | <PRE.pikchr-src></PRE> |
| 44 | </DIV> |
| 45 | */ |
| 46 | P.addSrcView = function f(svg){ |
| 47 | if(!f.hasOwnProperty('parentClick')){ |
| 48 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | |
| 58 | this.classList.toggle('source'); |
| 59 | ev.stopPropagation(); |
| 60 | ev.preventDefault(); |
| 61 | } |
| 62 | }; |
| 63 | }; |
| 64 | if(!svg) svg = 'svg.pikchr'; |
| 65 | if('string' === typeof svg){ |
| 66 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 67 | return this; |
| @@ -71,15 +110,24 @@ | |
| 71 | } |
| 72 | if(svg.dataset.pikchrProcessed){ |
| 73 | return this; |
| 74 | } |
| 75 | svg.dataset.pikchrProcessed = 1; |
| 76 | const parent = svg.parentNode.parentNode /* outermost div.pikchr-wrapper */; |
| 77 | const srcView = parent ? svg.parentNode.nextElementSibling : undefined; |
| 78 | if(!srcView || !srcView.classList.contains('pikchr-src')){ |
| 79 | /* Without this element, there's nothing for us to do here. */ |
| 80 | return this; |
| 81 | } |
| 82 | parent.addEventListener('click', f.parentClick, false); |
| 83 | return this; |
| 84 | }; |
| 85 | })(window.fossil); |
| 86 |
| --- src/fossil.pikchr.js | |
| +++ src/fossil.pikchr.js | |
| @@ -38,11 +38,14 @@ | |
| 38 | This code expects the following structure around the SVGs, and |
| 39 | will not process any which don't match this: |
| 40 | |
| 41 | <DIV.pikchr-wrapper> |
| 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | <DIV.pikchr-src> |
| 44 | <PRE>pikchr source code</PRE> |
| 45 | <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> |
| 46 | </DIV> |
| 47 | </DIV> |
| 48 | */ |
| 49 | P.addSrcView = function f(svg){ |
| 50 | if(!f.hasOwnProperty('parentClick')){ |
| 51 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | |
| 61 | this.classList.toggle('source'); |
| 62 | ev.stopPropagation(); |
| 63 | ev.preventDefault(); |
| 64 | } |
| 65 | }; |
| 66 | /** |
| 67 | Event handler for the "open in pikchrshow" links: store the |
| 68 | source code for the link's pikchr in |
| 69 | window.sessionStorage['pikchr-xfer'] then open |
| 70 | /pikchrshow?fromSession to trigger loading of that pikchr. |
| 71 | */ |
| 72 | f.clickPikchrShow = function(ev){ |
| 73 | const pId = this.dataset['pikchrid'] /* ID of the associated pikchr source code element */; |
| 74 | if(!pId) return; |
| 75 | const ePikchr = this.parentNode.parentNode.querySelector('#'+pId); |
| 76 | if(!ePikchr) return; |
| 77 | ev.stopPropagation() /* keep pikchr source view from toggling */; |
| 78 | window.sessionStorage.setItem('pikchr-xfer', ePikchr.innerText); |
| 79 | /* |
| 80 | After returning from this function the link element will |
| 81 | open [/pikchrshow?fromSession], and pikchrshow will extract |
| 82 | the pikchr source code from sessionStorage['pikchr-xfer']. |
| 83 | |
| 84 | Quirks of this ^^^ design: |
| 85 | |
| 86 | We use only a single slot in sessionStorage. We could |
| 87 | alternately use a key like pikchr-$pId and pass that key on |
| 88 | to /pikchrshow via fromSession=pikchr-$pId, but that would |
| 89 | eventually lead to stale session entries if loading of |
| 90 | pikchrshow were interrupted at an untimely point. The |
| 91 | down-side of _not_ doing that is that some user (or |
| 92 | automation) options multiple "open in pikchrshow" links |
| 93 | rapidly enough, the will open the same pikchr (the one which |
| 94 | was stored in the session's slot most recently). The |
| 95 | current approach should be fine for normal human interaction |
| 96 | speeds, but if it proves to be a problem we can instead use |
| 97 | the above-described approach of storing each pikchr in its |
| 98 | own session slot and simply accept that there may be stale |
| 99 | entries at some point. |
| 100 | */ |
| 101 | }; |
| 102 | }; |
| 103 | if(!svg) svg = 'svg.pikchr'; |
| 104 | if('string' === typeof svg){ |
| 105 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 106 | return this; |
| @@ -71,15 +110,24 @@ | |
| 110 | } |
| 111 | if(svg.dataset.pikchrProcessed){ |
| 112 | return this; |
| 113 | } |
| 114 | svg.dataset.pikchrProcessed = 1; |
| 115 | const parent = svg.parentNode.parentNode /* outermost DIV.pikchr-wrapper */; |
| 116 | const srcView = parent ? svg.parentNode.nextElementSibling /* DIV.pikchr-src */ : undefined; |
| 117 | if(srcView && srcView.classList.contains('pikchr-src')){ |
| 118 | /* Without this element, there's nothing for us to do here. */ |
| 119 | parent.addEventListener('click', f.parentClick, false); |
| 120 | const eSpan = window.sessionStorage |
| 121 | ? srcView.querySelector('span') /* "open in..." link wrapper */ |
| 122 | : undefined; |
| 123 | if(eSpan){ |
| 124 | const openLink = eSpan.querySelector('a'); |
| 125 | if(openLink){ |
| 126 | openLink.addEventListener('click', f.clickPikchrShow, false); |
| 127 | eSpan.classList.remove('hidden'); |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | return this; |
| 132 | }; |
| 133 | })(window.fossil); |
| 134 |
+54
-6
| --- src/fossil.pikchr.js | ||
| +++ src/fossil.pikchr.js | ||
| @@ -38,11 +38,14 @@ | ||
| 38 | 38 | This code expects the following structure around the SVGs, and |
| 39 | 39 | will not process any which don't match this: |
| 40 | 40 | |
| 41 | 41 | <DIV.pikchr-wrapper> |
| 42 | 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | - <PRE.pikchr-src></PRE> | |
| 43 | + <DIV.pikchr-src> | |
| 44 | + <PRE>pikchr source code</PRE> | |
| 45 | + <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> | |
| 46 | + </DIV> | |
| 44 | 47 | </DIV> |
| 45 | 48 | */ |
| 46 | 49 | P.addSrcView = function f(svg){ |
| 47 | 50 | if(!f.hasOwnProperty('parentClick')){ |
| 48 | 51 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | ||
| 58 | 61 | this.classList.toggle('source'); |
| 59 | 62 | ev.stopPropagation(); |
| 60 | 63 | ev.preventDefault(); |
| 61 | 64 | } |
| 62 | 65 | }; |
| 66 | + /** | |
| 67 | + Event handler for the "open in pikchrshow" links: store the | |
| 68 | + source code for the link's pikchr in | |
| 69 | + window.sessionStorage['pikchr-xfer'] then open | |
| 70 | + /pikchrshow?fromSession to trigger loading of that pikchr. | |
| 71 | + */ | |
| 72 | + f.clickPikchrShow = function(ev){ | |
| 73 | + const pId = this.dataset['pikchrid'] /* ID of the associated pikchr source code element */; | |
| 74 | + if(!pId) return; | |
| 75 | + const ePikchr = this.parentNode.parentNode.querySelector('#'+pId); | |
| 76 | + if(!ePikchr) return; | |
| 77 | + ev.stopPropagation() /* keep pikchr source view from toggling */; | |
| 78 | + window.sessionStorage.setItem('pikchr-xfer', ePikchr.innerText); | |
| 79 | + /* | |
| 80 | + After returning from this function the link element will | |
| 81 | + open [/pikchrshow?fromSession], and pikchrshow will extract | |
| 82 | + the pikchr source code from sessionStorage['pikchr-xfer']. | |
| 83 | + | |
| 84 | + Quirks of this ^^^ design: | |
| 85 | + | |
| 86 | + We use only a single slot in sessionStorage. We could | |
| 87 | + alternately use a key like pikchr-$pId and pass that key on | |
| 88 | + to /pikchrshow via fromSession=pikchr-$pId, but that would | |
| 89 | + eventually lead to stale session entries if loading of | |
| 90 | + pikchrshow were interrupted at an untimely point. The | |
| 91 | + down-side of _not_ doing that is that some user (or | |
| 92 | + automation) options multiple "open in pikchrshow" links | |
| 93 | + rapidly enough, the will open the same pikchr (the one which | |
| 94 | + was stored in the session's slot most recently). The | |
| 95 | + current approach should be fine for normal human interaction | |
| 96 | + speeds, but if it proves to be a problem we can instead use | |
| 97 | + the above-described approach of storing each pikchr in its | |
| 98 | + own session slot and simply accept that there may be stale | |
| 99 | + entries at some point. | |
| 100 | + */ | |
| 101 | + }; | |
| 63 | 102 | }; |
| 64 | 103 | if(!svg) svg = 'svg.pikchr'; |
| 65 | 104 | if('string' === typeof svg){ |
| 66 | 105 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 67 | 106 | return this; |
| @@ -71,15 +110,24 @@ | ||
| 71 | 110 | } |
| 72 | 111 | if(svg.dataset.pikchrProcessed){ |
| 73 | 112 | return this; |
| 74 | 113 | } |
| 75 | 114 | svg.dataset.pikchrProcessed = 1; |
| 76 | - const parent = svg.parentNode.parentNode /* outermost div.pikchr-wrapper */; | |
| 77 | - const srcView = parent ? svg.parentNode.nextElementSibling : undefined; | |
| 78 | - if(!srcView || !srcView.classList.contains('pikchr-src')){ | |
| 115 | + const parent = svg.parentNode.parentNode /* outermost DIV.pikchr-wrapper */; | |
| 116 | + const srcView = parent ? svg.parentNode.nextElementSibling /* DIV.pikchr-src */ : undefined; | |
| 117 | + if(srcView && srcView.classList.contains('pikchr-src')){ | |
| 79 | 118 | /* Without this element, there's nothing for us to do here. */ |
| 80 | - return this; | |
| 119 | + parent.addEventListener('click', f.parentClick, false); | |
| 120 | + const eSpan = window.sessionStorage | |
| 121 | + ? srcView.querySelector('span') /* "open in..." link wrapper */ | |
| 122 | + : undefined; | |
| 123 | + if(eSpan){ | |
| 124 | + const openLink = eSpan.querySelector('a'); | |
| 125 | + if(openLink){ | |
| 126 | + openLink.addEventListener('click', f.clickPikchrShow, false); | |
| 127 | + eSpan.classList.remove('hidden'); | |
| 128 | + } | |
| 129 | + } | |
| 81 | 130 | } |
| 82 | - parent.addEventListener('click', f.parentClick, false); | |
| 83 | 131 | return this; |
| 84 | 132 | }; |
| 85 | 133 | })(window.fossil); |
| 86 | 134 |
| --- src/fossil.pikchr.js | |
| +++ src/fossil.pikchr.js | |
| @@ -38,11 +38,14 @@ | |
| 38 | This code expects the following structure around the SVGs, and |
| 39 | will not process any which don't match this: |
| 40 | |
| 41 | <DIV.pikchr-wrapper> |
| 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | <PRE.pikchr-src></PRE> |
| 44 | </DIV> |
| 45 | */ |
| 46 | P.addSrcView = function f(svg){ |
| 47 | if(!f.hasOwnProperty('parentClick')){ |
| 48 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | |
| 58 | this.classList.toggle('source'); |
| 59 | ev.stopPropagation(); |
| 60 | ev.preventDefault(); |
| 61 | } |
| 62 | }; |
| 63 | }; |
| 64 | if(!svg) svg = 'svg.pikchr'; |
| 65 | if('string' === typeof svg){ |
| 66 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 67 | return this; |
| @@ -71,15 +110,24 @@ | |
| 71 | } |
| 72 | if(svg.dataset.pikchrProcessed){ |
| 73 | return this; |
| 74 | } |
| 75 | svg.dataset.pikchrProcessed = 1; |
| 76 | const parent = svg.parentNode.parentNode /* outermost div.pikchr-wrapper */; |
| 77 | const srcView = parent ? svg.parentNode.nextElementSibling : undefined; |
| 78 | if(!srcView || !srcView.classList.contains('pikchr-src')){ |
| 79 | /* Without this element, there's nothing for us to do here. */ |
| 80 | return this; |
| 81 | } |
| 82 | parent.addEventListener('click', f.parentClick, false); |
| 83 | return this; |
| 84 | }; |
| 85 | })(window.fossil); |
| 86 |
| --- src/fossil.pikchr.js | |
| +++ src/fossil.pikchr.js | |
| @@ -38,11 +38,14 @@ | |
| 38 | This code expects the following structure around the SVGs, and |
| 39 | will not process any which don't match this: |
| 40 | |
| 41 | <DIV.pikchr-wrapper> |
| 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | <DIV.pikchr-src> |
| 44 | <PRE>pikchr source code</PRE> |
| 45 | <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> |
| 46 | </DIV> |
| 47 | </DIV> |
| 48 | */ |
| 49 | P.addSrcView = function f(svg){ |
| 50 | if(!f.hasOwnProperty('parentClick')){ |
| 51 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | |
| 61 | this.classList.toggle('source'); |
| 62 | ev.stopPropagation(); |
| 63 | ev.preventDefault(); |
| 64 | } |
| 65 | }; |
| 66 | /** |
| 67 | Event handler for the "open in pikchrshow" links: store the |
| 68 | source code for the link's pikchr in |
| 69 | window.sessionStorage['pikchr-xfer'] then open |
| 70 | /pikchrshow?fromSession to trigger loading of that pikchr. |
| 71 | */ |
| 72 | f.clickPikchrShow = function(ev){ |
| 73 | const pId = this.dataset['pikchrid'] /* ID of the associated pikchr source code element */; |
| 74 | if(!pId) return; |
| 75 | const ePikchr = this.parentNode.parentNode.querySelector('#'+pId); |
| 76 | if(!ePikchr) return; |
| 77 | ev.stopPropagation() /* keep pikchr source view from toggling */; |
| 78 | window.sessionStorage.setItem('pikchr-xfer', ePikchr.innerText); |
| 79 | /* |
| 80 | After returning from this function the link element will |
| 81 | open [/pikchrshow?fromSession], and pikchrshow will extract |
| 82 | the pikchr source code from sessionStorage['pikchr-xfer']. |
| 83 | |
| 84 | Quirks of this ^^^ design: |
| 85 | |
| 86 | We use only a single slot in sessionStorage. We could |
| 87 | alternately use a key like pikchr-$pId and pass that key on |
| 88 | to /pikchrshow via fromSession=pikchr-$pId, but that would |
| 89 | eventually lead to stale session entries if loading of |
| 90 | pikchrshow were interrupted at an untimely point. The |
| 91 | down-side of _not_ doing that is that some user (or |
| 92 | automation) options multiple "open in pikchrshow" links |
| 93 | rapidly enough, the will open the same pikchr (the one which |
| 94 | was stored in the session's slot most recently). The |
| 95 | current approach should be fine for normal human interaction |
| 96 | speeds, but if it proves to be a problem we can instead use |
| 97 | the above-described approach of storing each pikchr in its |
| 98 | own session slot and simply accept that there may be stale |
| 99 | entries at some point. |
| 100 | */ |
| 101 | }; |
| 102 | }; |
| 103 | if(!svg) svg = 'svg.pikchr'; |
| 104 | if('string' === typeof svg){ |
| 105 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 106 | return this; |
| @@ -71,15 +110,24 @@ | |
| 110 | } |
| 111 | if(svg.dataset.pikchrProcessed){ |
| 112 | return this; |
| 113 | } |
| 114 | svg.dataset.pikchrProcessed = 1; |
| 115 | const parent = svg.parentNode.parentNode /* outermost DIV.pikchr-wrapper */; |
| 116 | const srcView = parent ? svg.parentNode.nextElementSibling /* DIV.pikchr-src */ : undefined; |
| 117 | if(srcView && srcView.classList.contains('pikchr-src')){ |
| 118 | /* Without this element, there's nothing for us to do here. */ |
| 119 | parent.addEventListener('click', f.parentClick, false); |
| 120 | const eSpan = window.sessionStorage |
| 121 | ? srcView.querySelector('span') /* "open in..." link wrapper */ |
| 122 | : undefined; |
| 123 | if(eSpan){ |
| 124 | const openLink = eSpan.querySelector('a'); |
| 125 | if(openLink){ |
| 126 | openLink.addEventListener('click', f.clickPikchrShow, false); |
| 127 | eSpan.classList.remove('hidden'); |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | return this; |
| 132 | }; |
| 133 | })(window.fossil); |
| 134 |
+54
-6
| --- src/fossil.pikchr.js | ||
| +++ src/fossil.pikchr.js | ||
| @@ -38,11 +38,14 @@ | ||
| 38 | 38 | This code expects the following structure around the SVGs, and |
| 39 | 39 | will not process any which don't match this: |
| 40 | 40 | |
| 41 | 41 | <DIV.pikchr-wrapper> |
| 42 | 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | - <PRE.pikchr-src></PRE> | |
| 43 | + <DIV.pikchr-src> | |
| 44 | + <PRE>pikchr source code</PRE> | |
| 45 | + <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> | |
| 46 | + </DIV> | |
| 44 | 47 | </DIV> |
| 45 | 48 | */ |
| 46 | 49 | P.addSrcView = function f(svg){ |
| 47 | 50 | if(!f.hasOwnProperty('parentClick')){ |
| 48 | 51 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | ||
| 58 | 61 | this.classList.toggle('source'); |
| 59 | 62 | ev.stopPropagation(); |
| 60 | 63 | ev.preventDefault(); |
| 61 | 64 | } |
| 62 | 65 | }; |
| 66 | + /** | |
| 67 | + Event handler for the "open in pikchrshow" links: store the | |
| 68 | + source code for the link's pikchr in | |
| 69 | + window.sessionStorage['pikchr-xfer'] then open | |
| 70 | + /pikchrshow?fromSession to trigger loading of that pikchr. | |
| 71 | + */ | |
| 72 | + f.clickPikchrShow = function(ev){ | |
| 73 | + const pId = this.dataset['pikchrid'] /* ID of the associated pikchr source code element */; | |
| 74 | + if(!pId) return; | |
| 75 | + const ePikchr = this.parentNode.parentNode.querySelector('#'+pId); | |
| 76 | + if(!ePikchr) return; | |
| 77 | + ev.stopPropagation() /* keep pikchr source view from toggling */; | |
| 78 | + window.sessionStorage.setItem('pikchr-xfer', ePikchr.innerText); | |
| 79 | + /* | |
| 80 | + After returning from this function the link element will | |
| 81 | + open [/pikchrshow?fromSession], and pikchrshow will extract | |
| 82 | + the pikchr source code from sessionStorage['pikchr-xfer']. | |
| 83 | + | |
| 84 | + Quirks of this ^^^ design: | |
| 85 | + | |
| 86 | + We use only a single slot in sessionStorage. We could | |
| 87 | + alternately use a key like pikchr-$pId and pass that key on | |
| 88 | + to /pikchrshow via fromSession=pikchr-$pId, but that would | |
| 89 | + eventually lead to stale session entries if loading of | |
| 90 | + pikchrshow were interrupted at an untimely point. The | |
| 91 | + down-side of _not_ doing that is that some user (or | |
| 92 | + automation) options multiple "open in pikchrshow" links | |
| 93 | + rapidly enough, the will open the same pikchr (the one which | |
| 94 | + was stored in the session's slot most recently). The | |
| 95 | + current approach should be fine for normal human interaction | |
| 96 | + speeds, but if it proves to be a problem we can instead use | |
| 97 | + the above-described approach of storing each pikchr in its | |
| 98 | + own session slot and simply accept that there may be stale | |
| 99 | + entries at some point. | |
| 100 | + */ | |
| 101 | + }; | |
| 63 | 102 | }; |
| 64 | 103 | if(!svg) svg = 'svg.pikchr'; |
| 65 | 104 | if('string' === typeof svg){ |
| 66 | 105 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 67 | 106 | return this; |
| @@ -71,15 +110,24 @@ | ||
| 71 | 110 | } |
| 72 | 111 | if(svg.dataset.pikchrProcessed){ |
| 73 | 112 | return this; |
| 74 | 113 | } |
| 75 | 114 | svg.dataset.pikchrProcessed = 1; |
| 76 | - const parent = svg.parentNode.parentNode /* outermost div.pikchr-wrapper */; | |
| 77 | - const srcView = parent ? svg.parentNode.nextElementSibling : undefined; | |
| 78 | - if(!srcView || !srcView.classList.contains('pikchr-src')){ | |
| 115 | + const parent = svg.parentNode.parentNode /* outermost DIV.pikchr-wrapper */; | |
| 116 | + const srcView = parent ? svg.parentNode.nextElementSibling /* DIV.pikchr-src */ : undefined; | |
| 117 | + if(srcView && srcView.classList.contains('pikchr-src')){ | |
| 79 | 118 | /* Without this element, there's nothing for us to do here. */ |
| 80 | - return this; | |
| 119 | + parent.addEventListener('click', f.parentClick, false); | |
| 120 | + const eSpan = window.sessionStorage | |
| 121 | + ? srcView.querySelector('span') /* "open in..." link wrapper */ | |
| 122 | + : undefined; | |
| 123 | + if(eSpan){ | |
| 124 | + const openLink = eSpan.querySelector('a'); | |
| 125 | + if(openLink){ | |
| 126 | + openLink.addEventListener('click', f.clickPikchrShow, false); | |
| 127 | + eSpan.classList.remove('hidden'); | |
| 128 | + } | |
| 129 | + } | |
| 81 | 130 | } |
| 82 | - parent.addEventListener('click', f.parentClick, false); | |
| 83 | 131 | return this; |
| 84 | 132 | }; |
| 85 | 133 | })(window.fossil); |
| 86 | 134 |
| --- src/fossil.pikchr.js | |
| +++ src/fossil.pikchr.js | |
| @@ -38,11 +38,14 @@ | |
| 38 | This code expects the following structure around the SVGs, and |
| 39 | will not process any which don't match this: |
| 40 | |
| 41 | <DIV.pikchr-wrapper> |
| 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | <PRE.pikchr-src></PRE> |
| 44 | </DIV> |
| 45 | */ |
| 46 | P.addSrcView = function f(svg){ |
| 47 | if(!f.hasOwnProperty('parentClick')){ |
| 48 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | |
| 58 | this.classList.toggle('source'); |
| 59 | ev.stopPropagation(); |
| 60 | ev.preventDefault(); |
| 61 | } |
| 62 | }; |
| 63 | }; |
| 64 | if(!svg) svg = 'svg.pikchr'; |
| 65 | if('string' === typeof svg){ |
| 66 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 67 | return this; |
| @@ -71,15 +110,24 @@ | |
| 71 | } |
| 72 | if(svg.dataset.pikchrProcessed){ |
| 73 | return this; |
| 74 | } |
| 75 | svg.dataset.pikchrProcessed = 1; |
| 76 | const parent = svg.parentNode.parentNode /* outermost div.pikchr-wrapper */; |
| 77 | const srcView = parent ? svg.parentNode.nextElementSibling : undefined; |
| 78 | if(!srcView || !srcView.classList.contains('pikchr-src')){ |
| 79 | /* Without this element, there's nothing for us to do here. */ |
| 80 | return this; |
| 81 | } |
| 82 | parent.addEventListener('click', f.parentClick, false); |
| 83 | return this; |
| 84 | }; |
| 85 | })(window.fossil); |
| 86 |
| --- src/fossil.pikchr.js | |
| +++ src/fossil.pikchr.js | |
| @@ -38,11 +38,14 @@ | |
| 38 | This code expects the following structure around the SVGs, and |
| 39 | will not process any which don't match this: |
| 40 | |
| 41 | <DIV.pikchr-wrapper> |
| 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | <DIV.pikchr-src> |
| 44 | <PRE>pikchr source code</PRE> |
| 45 | <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> |
| 46 | </DIV> |
| 47 | </DIV> |
| 48 | */ |
| 49 | P.addSrcView = function f(svg){ |
| 50 | if(!f.hasOwnProperty('parentClick')){ |
| 51 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | |
| 61 | this.classList.toggle('source'); |
| 62 | ev.stopPropagation(); |
| 63 | ev.preventDefault(); |
| 64 | } |
| 65 | }; |
| 66 | /** |
| 67 | Event handler for the "open in pikchrshow" links: store the |
| 68 | source code for the link's pikchr in |
| 69 | window.sessionStorage['pikchr-xfer'] then open |
| 70 | /pikchrshow?fromSession to trigger loading of that pikchr. |
| 71 | */ |
| 72 | f.clickPikchrShow = function(ev){ |
| 73 | const pId = this.dataset['pikchrid'] /* ID of the associated pikchr source code element */; |
| 74 | if(!pId) return; |
| 75 | const ePikchr = this.parentNode.parentNode.querySelector('#'+pId); |
| 76 | if(!ePikchr) return; |
| 77 | ev.stopPropagation() /* keep pikchr source view from toggling */; |
| 78 | window.sessionStorage.setItem('pikchr-xfer', ePikchr.innerText); |
| 79 | /* |
| 80 | After returning from this function the link element will |
| 81 | open [/pikchrshow?fromSession], and pikchrshow will extract |
| 82 | the pikchr source code from sessionStorage['pikchr-xfer']. |
| 83 | |
| 84 | Quirks of this ^^^ design: |
| 85 | |
| 86 | We use only a single slot in sessionStorage. We could |
| 87 | alternately use a key like pikchr-$pId and pass that key on |
| 88 | to /pikchrshow via fromSession=pikchr-$pId, but that would |
| 89 | eventually lead to stale session entries if loading of |
| 90 | pikchrshow were interrupted at an untimely point. The |
| 91 | down-side of _not_ doing that is that some user (or |
| 92 | automation) options multiple "open in pikchrshow" links |
| 93 | rapidly enough, the will open the same pikchr (the one which |
| 94 | was stored in the session's slot most recently). The |
| 95 | current approach should be fine for normal human interaction |
| 96 | speeds, but if it proves to be a problem we can instead use |
| 97 | the above-described approach of storing each pikchr in its |
| 98 | own session slot and simply accept that there may be stale |
| 99 | entries at some point. |
| 100 | */ |
| 101 | }; |
| 102 | }; |
| 103 | if(!svg) svg = 'svg.pikchr'; |
| 104 | if('string' === typeof svg){ |
| 105 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 106 | return this; |
| @@ -71,15 +110,24 @@ | |
| 110 | } |
| 111 | if(svg.dataset.pikchrProcessed){ |
| 112 | return this; |
| 113 | } |
| 114 | svg.dataset.pikchrProcessed = 1; |
| 115 | const parent = svg.parentNode.parentNode /* outermost DIV.pikchr-wrapper */; |
| 116 | const srcView = parent ? svg.parentNode.nextElementSibling /* DIV.pikchr-src */ : undefined; |
| 117 | if(srcView && srcView.classList.contains('pikchr-src')){ |
| 118 | /* Without this element, there's nothing for us to do here. */ |
| 119 | parent.addEventListener('click', f.parentClick, false); |
| 120 | const eSpan = window.sessionStorage |
| 121 | ? srcView.querySelector('span') /* "open in..." link wrapper */ |
| 122 | : undefined; |
| 123 | if(eSpan){ |
| 124 | const openLink = eSpan.querySelector('a'); |
| 125 | if(openLink){ |
| 126 | openLink.addEventListener('click', f.clickPikchrShow, false); |
| 127 | eSpan.classList.remove('hidden'); |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | return this; |
| 132 | }; |
| 133 | })(window.fossil); |
| 134 |
+54
-6
| --- src/fossil.pikchr.js | ||
| +++ src/fossil.pikchr.js | ||
| @@ -38,11 +38,14 @@ | ||
| 38 | 38 | This code expects the following structure around the SVGs, and |
| 39 | 39 | will not process any which don't match this: |
| 40 | 40 | |
| 41 | 41 | <DIV.pikchr-wrapper> |
| 42 | 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | - <PRE.pikchr-src></PRE> | |
| 43 | + <DIV.pikchr-src> | |
| 44 | + <PRE>pikchr source code</PRE> | |
| 45 | + <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> | |
| 46 | + </DIV> | |
| 44 | 47 | </DIV> |
| 45 | 48 | */ |
| 46 | 49 | P.addSrcView = function f(svg){ |
| 47 | 50 | if(!f.hasOwnProperty('parentClick')){ |
| 48 | 51 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | ||
| 58 | 61 | this.classList.toggle('source'); |
| 59 | 62 | ev.stopPropagation(); |
| 60 | 63 | ev.preventDefault(); |
| 61 | 64 | } |
| 62 | 65 | }; |
| 66 | + /** | |
| 67 | + Event handler for the "open in pikchrshow" links: store the | |
| 68 | + source code for the link's pikchr in | |
| 69 | + window.sessionStorage['pikchr-xfer'] then open | |
| 70 | + /pikchrshow?fromSession to trigger loading of that pikchr. | |
| 71 | + */ | |
| 72 | + f.clickPikchrShow = function(ev){ | |
| 73 | + const pId = this.dataset['pikchrid'] /* ID of the associated pikchr source code element */; | |
| 74 | + if(!pId) return; | |
| 75 | + const ePikchr = this.parentNode.parentNode.querySelector('#'+pId); | |
| 76 | + if(!ePikchr) return; | |
| 77 | + ev.stopPropagation() /* keep pikchr source view from toggling */; | |
| 78 | + window.sessionStorage.setItem('pikchr-xfer', ePikchr.innerText); | |
| 79 | + /* | |
| 80 | + After returning from this function the link element will | |
| 81 | + open [/pikchrshow?fromSession], and pikchrshow will extract | |
| 82 | + the pikchr source code from sessionStorage['pikchr-xfer']. | |
| 83 | + | |
| 84 | + Quirks of this ^^^ design: | |
| 85 | + | |
| 86 | + We use only a single slot in sessionStorage. We could | |
| 87 | + alternately use a key like pikchr-$pId and pass that key on | |
| 88 | + to /pikchrshow via fromSession=pikchr-$pId, but that would | |
| 89 | + eventually lead to stale session entries if loading of | |
| 90 | + pikchrshow were interrupted at an untimely point. The | |
| 91 | + down-side of _not_ doing that is that some user (or | |
| 92 | + automation) options multiple "open in pikchrshow" links | |
| 93 | + rapidly enough, the will open the same pikchr (the one which | |
| 94 | + was stored in the session's slot most recently). The | |
| 95 | + current approach should be fine for normal human interaction | |
| 96 | + speeds, but if it proves to be a problem we can instead use | |
| 97 | + the above-described approach of storing each pikchr in its | |
| 98 | + own session slot and simply accept that there may be stale | |
| 99 | + entries at some point. | |
| 100 | + */ | |
| 101 | + }; | |
| 63 | 102 | }; |
| 64 | 103 | if(!svg) svg = 'svg.pikchr'; |
| 65 | 104 | if('string' === typeof svg){ |
| 66 | 105 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 67 | 106 | return this; |
| @@ -71,15 +110,24 @@ | ||
| 71 | 110 | } |
| 72 | 111 | if(svg.dataset.pikchrProcessed){ |
| 73 | 112 | return this; |
| 74 | 113 | } |
| 75 | 114 | svg.dataset.pikchrProcessed = 1; |
| 76 | - const parent = svg.parentNode.parentNode /* outermost div.pikchr-wrapper */; | |
| 77 | - const srcView = parent ? svg.parentNode.nextElementSibling : undefined; | |
| 78 | - if(!srcView || !srcView.classList.contains('pikchr-src')){ | |
| 115 | + const parent = svg.parentNode.parentNode /* outermost DIV.pikchr-wrapper */; | |
| 116 | + const srcView = parent ? svg.parentNode.nextElementSibling /* DIV.pikchr-src */ : undefined; | |
| 117 | + if(srcView && srcView.classList.contains('pikchr-src')){ | |
| 79 | 118 | /* Without this element, there's nothing for us to do here. */ |
| 80 | - return this; | |
| 119 | + parent.addEventListener('click', f.parentClick, false); | |
| 120 | + const eSpan = window.sessionStorage | |
| 121 | + ? srcView.querySelector('span') /* "open in..." link wrapper */ | |
| 122 | + : undefined; | |
| 123 | + if(eSpan){ | |
| 124 | + const openLink = eSpan.querySelector('a'); | |
| 125 | + if(openLink){ | |
| 126 | + openLink.addEventListener('click', f.clickPikchrShow, false); | |
| 127 | + eSpan.classList.remove('hidden'); | |
| 128 | + } | |
| 129 | + } | |
| 81 | 130 | } |
| 82 | - parent.addEventListener('click', f.parentClick, false); | |
| 83 | 131 | return this; |
| 84 | 132 | }; |
| 85 | 133 | })(window.fossil); |
| 86 | 134 |
| --- src/fossil.pikchr.js | |
| +++ src/fossil.pikchr.js | |
| @@ -38,11 +38,14 @@ | |
| 38 | This code expects the following structure around the SVGs, and |
| 39 | will not process any which don't match this: |
| 40 | |
| 41 | <DIV.pikchr-wrapper> |
| 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | <PRE.pikchr-src></PRE> |
| 44 | </DIV> |
| 45 | */ |
| 46 | P.addSrcView = function f(svg){ |
| 47 | if(!f.hasOwnProperty('parentClick')){ |
| 48 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | |
| 58 | this.classList.toggle('source'); |
| 59 | ev.stopPropagation(); |
| 60 | ev.preventDefault(); |
| 61 | } |
| 62 | }; |
| 63 | }; |
| 64 | if(!svg) svg = 'svg.pikchr'; |
| 65 | if('string' === typeof svg){ |
| 66 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 67 | return this; |
| @@ -71,15 +110,24 @@ | |
| 71 | } |
| 72 | if(svg.dataset.pikchrProcessed){ |
| 73 | return this; |
| 74 | } |
| 75 | svg.dataset.pikchrProcessed = 1; |
| 76 | const parent = svg.parentNode.parentNode /* outermost div.pikchr-wrapper */; |
| 77 | const srcView = parent ? svg.parentNode.nextElementSibling : undefined; |
| 78 | if(!srcView || !srcView.classList.contains('pikchr-src')){ |
| 79 | /* Without this element, there's nothing for us to do here. */ |
| 80 | return this; |
| 81 | } |
| 82 | parent.addEventListener('click', f.parentClick, false); |
| 83 | return this; |
| 84 | }; |
| 85 | })(window.fossil); |
| 86 |
| --- src/fossil.pikchr.js | |
| +++ src/fossil.pikchr.js | |
| @@ -38,11 +38,14 @@ | |
| 38 | This code expects the following structure around the SVGs, and |
| 39 | will not process any which don't match this: |
| 40 | |
| 41 | <DIV.pikchr-wrapper> |
| 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | <DIV.pikchr-src> |
| 44 | <PRE>pikchr source code</PRE> |
| 45 | <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> |
| 46 | </DIV> |
| 47 | </DIV> |
| 48 | */ |
| 49 | P.addSrcView = function f(svg){ |
| 50 | if(!f.hasOwnProperty('parentClick')){ |
| 51 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | |
| 61 | this.classList.toggle('source'); |
| 62 | ev.stopPropagation(); |
| 63 | ev.preventDefault(); |
| 64 | } |
| 65 | }; |
| 66 | /** |
| 67 | Event handler for the "open in pikchrshow" links: store the |
| 68 | source code for the link's pikchr in |
| 69 | window.sessionStorage['pikchr-xfer'] then open |
| 70 | /pikchrshow?fromSession to trigger loading of that pikchr. |
| 71 | */ |
| 72 | f.clickPikchrShow = function(ev){ |
| 73 | const pId = this.dataset['pikchrid'] /* ID of the associated pikchr source code element */; |
| 74 | if(!pId) return; |
| 75 | const ePikchr = this.parentNode.parentNode.querySelector('#'+pId); |
| 76 | if(!ePikchr) return; |
| 77 | ev.stopPropagation() /* keep pikchr source view from toggling */; |
| 78 | window.sessionStorage.setItem('pikchr-xfer', ePikchr.innerText); |
| 79 | /* |
| 80 | After returning from this function the link element will |
| 81 | open [/pikchrshow?fromSession], and pikchrshow will extract |
| 82 | the pikchr source code from sessionStorage['pikchr-xfer']. |
| 83 | |
| 84 | Quirks of this ^^^ design: |
| 85 | |
| 86 | We use only a single slot in sessionStorage. We could |
| 87 | alternately use a key like pikchr-$pId and pass that key on |
| 88 | to /pikchrshow via fromSession=pikchr-$pId, but that would |
| 89 | eventually lead to stale session entries if loading of |
| 90 | pikchrshow were interrupted at an untimely point. The |
| 91 | down-side of _not_ doing that is that some user (or |
| 92 | automation) options multiple "open in pikchrshow" links |
| 93 | rapidly enough, the will open the same pikchr (the one which |
| 94 | was stored in the session's slot most recently). The |
| 95 | current approach should be fine for normal human interaction |
| 96 | speeds, but if it proves to be a problem we can instead use |
| 97 | the above-described approach of storing each pikchr in its |
| 98 | own session slot and simply accept that there may be stale |
| 99 | entries at some point. |
| 100 | */ |
| 101 | }; |
| 102 | }; |
| 103 | if(!svg) svg = 'svg.pikchr'; |
| 104 | if('string' === typeof svg){ |
| 105 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 106 | return this; |
| @@ -71,15 +110,24 @@ | |
| 110 | } |
| 111 | if(svg.dataset.pikchrProcessed){ |
| 112 | return this; |
| 113 | } |
| 114 | svg.dataset.pikchrProcessed = 1; |
| 115 | const parent = svg.parentNode.parentNode /* outermost DIV.pikchr-wrapper */; |
| 116 | const srcView = parent ? svg.parentNode.nextElementSibling /* DIV.pikchr-src */ : undefined; |
| 117 | if(srcView && srcView.classList.contains('pikchr-src')){ |
| 118 | /* Without this element, there's nothing for us to do here. */ |
| 119 | parent.addEventListener('click', f.parentClick, false); |
| 120 | const eSpan = window.sessionStorage |
| 121 | ? srcView.querySelector('span') /* "open in..." link wrapper */ |
| 122 | : undefined; |
| 123 | if(eSpan){ |
| 124 | const openLink = eSpan.querySelector('a'); |
| 125 | if(openLink){ |
| 126 | openLink.addEventListener('click', f.clickPikchrShow, false); |
| 127 | eSpan.classList.remove('hidden'); |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | return this; |
| 132 | }; |
| 133 | })(window.fossil); |
| 134 |
+54
-6
| --- src/fossil.pikchr.js | ||
| +++ src/fossil.pikchr.js | ||
| @@ -38,11 +38,14 @@ | ||
| 38 | 38 | This code expects the following structure around the SVGs, and |
| 39 | 39 | will not process any which don't match this: |
| 40 | 40 | |
| 41 | 41 | <DIV.pikchr-wrapper> |
| 42 | 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | - <PRE.pikchr-src></PRE> | |
| 43 | + <DIV.pikchr-src> | |
| 44 | + <PRE>pikchr source code</PRE> | |
| 45 | + <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> | |
| 46 | + </DIV> | |
| 44 | 47 | </DIV> |
| 45 | 48 | */ |
| 46 | 49 | P.addSrcView = function f(svg){ |
| 47 | 50 | if(!f.hasOwnProperty('parentClick')){ |
| 48 | 51 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | ||
| 58 | 61 | this.classList.toggle('source'); |
| 59 | 62 | ev.stopPropagation(); |
| 60 | 63 | ev.preventDefault(); |
| 61 | 64 | } |
| 62 | 65 | }; |
| 66 | + /** | |
| 67 | + Event handler for the "open in pikchrshow" links: store the | |
| 68 | + source code for the link's pikchr in | |
| 69 | + window.sessionStorage['pikchr-xfer'] then open | |
| 70 | + /pikchrshow?fromSession to trigger loading of that pikchr. | |
| 71 | + */ | |
| 72 | + f.clickPikchrShow = function(ev){ | |
| 73 | + const pId = this.dataset['pikchrid'] /* ID of the associated pikchr source code element */; | |
| 74 | + if(!pId) return; | |
| 75 | + const ePikchr = this.parentNode.parentNode.querySelector('#'+pId); | |
| 76 | + if(!ePikchr) return; | |
| 77 | + ev.stopPropagation() /* keep pikchr source view from toggling */; | |
| 78 | + window.sessionStorage.setItem('pikchr-xfer', ePikchr.innerText); | |
| 79 | + /* | |
| 80 | + After returning from this function the link element will | |
| 81 | + open [/pikchrshow?fromSession], and pikchrshow will extract | |
| 82 | + the pikchr source code from sessionStorage['pikchr-xfer']. | |
| 83 | + | |
| 84 | + Quirks of this ^^^ design: | |
| 85 | + | |
| 86 | + We use only a single slot in sessionStorage. We could | |
| 87 | + alternately use a key like pikchr-$pId and pass that key on | |
| 88 | + to /pikchrshow via fromSession=pikchr-$pId, but that would | |
| 89 | + eventually lead to stale session entries if loading of | |
| 90 | + pikchrshow were interrupted at an untimely point. The | |
| 91 | + down-side of _not_ doing that is that some user (or | |
| 92 | + automation) options multiple "open in pikchrshow" links | |
| 93 | + rapidly enough, the will open the same pikchr (the one which | |
| 94 | + was stored in the session's slot most recently). The | |
| 95 | + current approach should be fine for normal human interaction | |
| 96 | + speeds, but if it proves to be a problem we can instead use | |
| 97 | + the above-described approach of storing each pikchr in its | |
| 98 | + own session slot and simply accept that there may be stale | |
| 99 | + entries at some point. | |
| 100 | + */ | |
| 101 | + }; | |
| 63 | 102 | }; |
| 64 | 103 | if(!svg) svg = 'svg.pikchr'; |
| 65 | 104 | if('string' === typeof svg){ |
| 66 | 105 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 67 | 106 | return this; |
| @@ -71,15 +110,24 @@ | ||
| 71 | 110 | } |
| 72 | 111 | if(svg.dataset.pikchrProcessed){ |
| 73 | 112 | return this; |
| 74 | 113 | } |
| 75 | 114 | svg.dataset.pikchrProcessed = 1; |
| 76 | - const parent = svg.parentNode.parentNode /* outermost div.pikchr-wrapper */; | |
| 77 | - const srcView = parent ? svg.parentNode.nextElementSibling : undefined; | |
| 78 | - if(!srcView || !srcView.classList.contains('pikchr-src')){ | |
| 115 | + const parent = svg.parentNode.parentNode /* outermost DIV.pikchr-wrapper */; | |
| 116 | + const srcView = parent ? svg.parentNode.nextElementSibling /* DIV.pikchr-src */ : undefined; | |
| 117 | + if(srcView && srcView.classList.contains('pikchr-src')){ | |
| 79 | 118 | /* Without this element, there's nothing for us to do here. */ |
| 80 | - return this; | |
| 119 | + parent.addEventListener('click', f.parentClick, false); | |
| 120 | + const eSpan = window.sessionStorage | |
| 121 | + ? srcView.querySelector('span') /* "open in..." link wrapper */ | |
| 122 | + : undefined; | |
| 123 | + if(eSpan){ | |
| 124 | + const openLink = eSpan.querySelector('a'); | |
| 125 | + if(openLink){ | |
| 126 | + openLink.addEventListener('click', f.clickPikchrShow, false); | |
| 127 | + eSpan.classList.remove('hidden'); | |
| 128 | + } | |
| 129 | + } | |
| 81 | 130 | } |
| 82 | - parent.addEventListener('click', f.parentClick, false); | |
| 83 | 131 | return this; |
| 84 | 132 | }; |
| 85 | 133 | })(window.fossil); |
| 86 | 134 |
| --- src/fossil.pikchr.js | |
| +++ src/fossil.pikchr.js | |
| @@ -38,11 +38,14 @@ | |
| 38 | This code expects the following structure around the SVGs, and |
| 39 | will not process any which don't match this: |
| 40 | |
| 41 | <DIV.pikchr-wrapper> |
| 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | <PRE.pikchr-src></PRE> |
| 44 | </DIV> |
| 45 | */ |
| 46 | P.addSrcView = function f(svg){ |
| 47 | if(!f.hasOwnProperty('parentClick')){ |
| 48 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | |
| 58 | this.classList.toggle('source'); |
| 59 | ev.stopPropagation(); |
| 60 | ev.preventDefault(); |
| 61 | } |
| 62 | }; |
| 63 | }; |
| 64 | if(!svg) svg = 'svg.pikchr'; |
| 65 | if('string' === typeof svg){ |
| 66 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 67 | return this; |
| @@ -71,15 +110,24 @@ | |
| 71 | } |
| 72 | if(svg.dataset.pikchrProcessed){ |
| 73 | return this; |
| 74 | } |
| 75 | svg.dataset.pikchrProcessed = 1; |
| 76 | const parent = svg.parentNode.parentNode /* outermost div.pikchr-wrapper */; |
| 77 | const srcView = parent ? svg.parentNode.nextElementSibling : undefined; |
| 78 | if(!srcView || !srcView.classList.contains('pikchr-src')){ |
| 79 | /* Without this element, there's nothing for us to do here. */ |
| 80 | return this; |
| 81 | } |
| 82 | parent.addEventListener('click', f.parentClick, false); |
| 83 | return this; |
| 84 | }; |
| 85 | })(window.fossil); |
| 86 |
| --- src/fossil.pikchr.js | |
| +++ src/fossil.pikchr.js | |
| @@ -38,11 +38,14 @@ | |
| 38 | This code expects the following structure around the SVGs, and |
| 39 | will not process any which don't match this: |
| 40 | |
| 41 | <DIV.pikchr-wrapper> |
| 42 | <DIV.pikchr-svg><SVG.pikchr></SVG></DIV> |
| 43 | <DIV.pikchr-src> |
| 44 | <PRE>pikchr source code</PRE> |
| 45 | <SPAN class='hidden'><A>link to open pikchr in /pikchrshow</A></SPAN> |
| 46 | </DIV> |
| 47 | </DIV> |
| 48 | */ |
| 49 | P.addSrcView = function f(svg){ |
| 50 | if(!f.hasOwnProperty('parentClick')){ |
| 51 | f.parentClick = function(ev){ |
| @@ -58,10 +61,46 @@ | |
| 61 | this.classList.toggle('source'); |
| 62 | ev.stopPropagation(); |
| 63 | ev.preventDefault(); |
| 64 | } |
| 65 | }; |
| 66 | /** |
| 67 | Event handler for the "open in pikchrshow" links: store the |
| 68 | source code for the link's pikchr in |
| 69 | window.sessionStorage['pikchr-xfer'] then open |
| 70 | /pikchrshow?fromSession to trigger loading of that pikchr. |
| 71 | */ |
| 72 | f.clickPikchrShow = function(ev){ |
| 73 | const pId = this.dataset['pikchrid'] /* ID of the associated pikchr source code element */; |
| 74 | if(!pId) return; |
| 75 | const ePikchr = this.parentNode.parentNode.querySelector('#'+pId); |
| 76 | if(!ePikchr) return; |
| 77 | ev.stopPropagation() /* keep pikchr source view from toggling */; |
| 78 | window.sessionStorage.setItem('pikchr-xfer', ePikchr.innerText); |
| 79 | /* |
| 80 | After returning from this function the link element will |
| 81 | open [/pikchrshow?fromSession], and pikchrshow will extract |
| 82 | the pikchr source code from sessionStorage['pikchr-xfer']. |
| 83 | |
| 84 | Quirks of this ^^^ design: |
| 85 | |
| 86 | We use only a single slot in sessionStorage. We could |
| 87 | alternately use a key like pikchr-$pId and pass that key on |
| 88 | to /pikchrshow via fromSession=pikchr-$pId, but that would |
| 89 | eventually lead to stale session entries if loading of |
| 90 | pikchrshow were interrupted at an untimely point. The |
| 91 | down-side of _not_ doing that is that some user (or |
| 92 | automation) options multiple "open in pikchrshow" links |
| 93 | rapidly enough, the will open the same pikchr (the one which |
| 94 | was stored in the session's slot most recently). The |
| 95 | current approach should be fine for normal human interaction |
| 96 | speeds, but if it proves to be a problem we can instead use |
| 97 | the above-described approach of storing each pikchr in its |
| 98 | own session slot and simply accept that there may be stale |
| 99 | entries at some point. |
| 100 | */ |
| 101 | }; |
| 102 | }; |
| 103 | if(!svg) svg = 'svg.pikchr'; |
| 104 | if('string' === typeof svg){ |
| 105 | document.querySelectorAll(svg).forEach((e)=>f.call(this, e)); |
| 106 | return this; |
| @@ -71,15 +110,24 @@ | |
| 110 | } |
| 111 | if(svg.dataset.pikchrProcessed){ |
| 112 | return this; |
| 113 | } |
| 114 | svg.dataset.pikchrProcessed = 1; |
| 115 | const parent = svg.parentNode.parentNode /* outermost DIV.pikchr-wrapper */; |
| 116 | const srcView = parent ? svg.parentNode.nextElementSibling /* DIV.pikchr-src */ : undefined; |
| 117 | if(srcView && srcView.classList.contains('pikchr-src')){ |
| 118 | /* Without this element, there's nothing for us to do here. */ |
| 119 | parent.addEventListener('click', f.parentClick, false); |
| 120 | const eSpan = window.sessionStorage |
| 121 | ? srcView.querySelector('span') /* "open in..." link wrapper */ |
| 122 | : undefined; |
| 123 | if(eSpan){ |
| 124 | const openLink = eSpan.querySelector('a'); |
| 125 | if(openLink){ |
| 126 | openLink.addEventListener('click', f.clickPikchrShow, false); |
| 127 | eSpan.classList.remove('hidden'); |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | return this; |
| 132 | }; |
| 133 | })(window.fossil); |
| 134 |
+12
-2
| --- src/pikchrshow.c | ||
| +++ src/pikchrshow.c | ||
| @@ -207,12 +207,22 @@ | ||
| 207 | 207 | blob_append(pOut, zOut, -1); |
| 208 | 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | 210 | } |
| 211 | 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | - blob_appendf(pOut, "<pre class='pikchr-src'>%h</pre>\n", | |
| 213 | - blob_str(&bIn)); | |
| 212 | + static int counter = 0; | |
| 213 | + ++counter; | |
| 214 | + blob_appendf(pOut, "<div class='pikchr-src'>" | |
| 215 | + "<pre id='pikchr-src-%d'>%h</pre>" | |
| 216 | + "<span class='hidden'>" | |
| 217 | + "<a href='%R/pikchrshow?fromSession' " | |
| 218 | + "class='pikchr-src-pikchrshow' target='_new-%d' " | |
| 219 | + "data-pikchrid='pikchr-src-%d' " | |
| 220 | + "title='Open this pikchr in /pikchrshow'" | |
| 221 | + ">→ /pikchrshow</a></span>" | |
| 222 | + "</div>\n", | |
| 223 | + counter, blob_str(&bIn), counter, counter); | |
| 214 | 224 | } |
| 215 | 225 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 216 | 226 | blob_append(pOut, "</div>\n", 7); |
| 217 | 227 | } |
| 218 | 228 | }else{ |
| 219 | 229 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -207,12 +207,22 @@ | |
| 207 | blob_append(pOut, zOut, -1); |
| 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | } |
| 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | blob_appendf(pOut, "<pre class='pikchr-src'>%h</pre>\n", |
| 213 | blob_str(&bIn)); |
| 214 | } |
| 215 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 216 | blob_append(pOut, "</div>\n", 7); |
| 217 | } |
| 218 | }else{ |
| 219 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -207,12 +207,22 @@ | |
| 207 | blob_append(pOut, zOut, -1); |
| 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | } |
| 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | static int counter = 0; |
| 213 | ++counter; |
| 214 | blob_appendf(pOut, "<div class='pikchr-src'>" |
| 215 | "<pre id='pikchr-src-%d'>%h</pre>" |
| 216 | "<span class='hidden'>" |
| 217 | "<a href='%R/pikchrshow?fromSession' " |
| 218 | "class='pikchr-src-pikchrshow' target='_new-%d' " |
| 219 | "data-pikchrid='pikchr-src-%d' " |
| 220 | "title='Open this pikchr in /pikchrshow'" |
| 221 | ">→ /pikchrshow</a></span>" |
| 222 | "</div>\n", |
| 223 | counter, blob_str(&bIn), counter, counter); |
| 224 | } |
| 225 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 226 | blob_append(pOut, "</div>\n", 7); |
| 227 | } |
| 228 | }else{ |
| 229 |
+12
-2
| --- src/pikchrshow.c | ||
| +++ src/pikchrshow.c | ||
| @@ -207,12 +207,22 @@ | ||
| 207 | 207 | blob_append(pOut, zOut, -1); |
| 208 | 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | 210 | } |
| 211 | 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | - blob_appendf(pOut, "<pre class='pikchr-src'>%h</pre>\n", | |
| 213 | - blob_str(&bIn)); | |
| 212 | + static int counter = 0; | |
| 213 | + ++counter; | |
| 214 | + blob_appendf(pOut, "<div class='pikchr-src'>" | |
| 215 | + "<pre id='pikchr-src-%d'>%h</pre>" | |
| 216 | + "<span class='hidden'>" | |
| 217 | + "<a href='%R/pikchrshow?fromSession' " | |
| 218 | + "class='pikchr-src-pikchrshow' target='_new-%d' " | |
| 219 | + "data-pikchrid='pikchr-src-%d' " | |
| 220 | + "title='Open this pikchr in /pikchrshow'" | |
| 221 | + ">→ /pikchrshow</a></span>" | |
| 222 | + "</div>\n", | |
| 223 | + counter, blob_str(&bIn), counter, counter); | |
| 214 | 224 | } |
| 215 | 225 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 216 | 226 | blob_append(pOut, "</div>\n", 7); |
| 217 | 227 | } |
| 218 | 228 | }else{ |
| 219 | 229 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -207,12 +207,22 @@ | |
| 207 | blob_append(pOut, zOut, -1); |
| 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | } |
| 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | blob_appendf(pOut, "<pre class='pikchr-src'>%h</pre>\n", |
| 213 | blob_str(&bIn)); |
| 214 | } |
| 215 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 216 | blob_append(pOut, "</div>\n", 7); |
| 217 | } |
| 218 | }else{ |
| 219 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -207,12 +207,22 @@ | |
| 207 | blob_append(pOut, zOut, -1); |
| 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | } |
| 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | static int counter = 0; |
| 213 | ++counter; |
| 214 | blob_appendf(pOut, "<div class='pikchr-src'>" |
| 215 | "<pre id='pikchr-src-%d'>%h</pre>" |
| 216 | "<span class='hidden'>" |
| 217 | "<a href='%R/pikchrshow?fromSession' " |
| 218 | "class='pikchr-src-pikchrshow' target='_new-%d' " |
| 219 | "data-pikchrid='pikchr-src-%d' " |
| 220 | "title='Open this pikchr in /pikchrshow'" |
| 221 | ">→ /pikchrshow</a></span>" |
| 222 | "</div>\n", |
| 223 | counter, blob_str(&bIn), counter, counter); |
| 224 | } |
| 225 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 226 | blob_append(pOut, "</div>\n", 7); |
| 227 | } |
| 228 | }else{ |
| 229 |
+12
-2
| --- src/pikchrshow.c | ||
| +++ src/pikchrshow.c | ||
| @@ -207,12 +207,22 @@ | ||
| 207 | 207 | blob_append(pOut, zOut, -1); |
| 208 | 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | 210 | } |
| 211 | 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | - blob_appendf(pOut, "<pre class='pikchr-src'>%h</pre>\n", | |
| 213 | - blob_str(&bIn)); | |
| 212 | + static int counter = 0; | |
| 213 | + ++counter; | |
| 214 | + blob_appendf(pOut, "<div class='pikchr-src'>" | |
| 215 | + "<pre id='pikchr-src-%d'>%h</pre>" | |
| 216 | + "<span class='hidden'>" | |
| 217 | + "<a href='%R/pikchrshow?fromSession' " | |
| 218 | + "class='pikchr-src-pikchrshow' target='_new-%d' " | |
| 219 | + "data-pikchrid='pikchr-src-%d' " | |
| 220 | + "title='Open this pikchr in /pikchrshow'" | |
| 221 | + ">→ /pikchrshow</a></span>" | |
| 222 | + "</div>\n", | |
| 223 | + counter, blob_str(&bIn), counter, counter); | |
| 214 | 224 | } |
| 215 | 225 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 216 | 226 | blob_append(pOut, "</div>\n", 7); |
| 217 | 227 | } |
| 218 | 228 | }else{ |
| 219 | 229 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -207,12 +207,22 @@ | |
| 207 | blob_append(pOut, zOut, -1); |
| 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | } |
| 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | blob_appendf(pOut, "<pre class='pikchr-src'>%h</pre>\n", |
| 213 | blob_str(&bIn)); |
| 214 | } |
| 215 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 216 | blob_append(pOut, "</div>\n", 7); |
| 217 | } |
| 218 | }else{ |
| 219 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -207,12 +207,22 @@ | |
| 207 | blob_append(pOut, zOut, -1); |
| 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | } |
| 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | static int counter = 0; |
| 213 | ++counter; |
| 214 | blob_appendf(pOut, "<div class='pikchr-src'>" |
| 215 | "<pre id='pikchr-src-%d'>%h</pre>" |
| 216 | "<span class='hidden'>" |
| 217 | "<a href='%R/pikchrshow?fromSession' " |
| 218 | "class='pikchr-src-pikchrshow' target='_new-%d' " |
| 219 | "data-pikchrid='pikchr-src-%d' " |
| 220 | "title='Open this pikchr in /pikchrshow'" |
| 221 | ">→ /pikchrshow</a></span>" |
| 222 | "</div>\n", |
| 223 | counter, blob_str(&bIn), counter, counter); |
| 224 | } |
| 225 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 226 | blob_append(pOut, "</div>\n", 7); |
| 227 | } |
| 228 | }else{ |
| 229 |
+12
-2
| --- src/pikchrshow.c | ||
| +++ src/pikchrshow.c | ||
| @@ -207,12 +207,22 @@ | ||
| 207 | 207 | blob_append(pOut, zOut, -1); |
| 208 | 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | 210 | } |
| 211 | 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | - blob_appendf(pOut, "<pre class='pikchr-src'>%h</pre>\n", | |
| 213 | - blob_str(&bIn)); | |
| 212 | + static int counter = 0; | |
| 213 | + ++counter; | |
| 214 | + blob_appendf(pOut, "<div class='pikchr-src'>" | |
| 215 | + "<pre id='pikchr-src-%d'>%h</pre>" | |
| 216 | + "<span class='hidden'>" | |
| 217 | + "<a href='%R/pikchrshow?fromSession' " | |
| 218 | + "class='pikchr-src-pikchrshow' target='_new-%d' " | |
| 219 | + "data-pikchrid='pikchr-src-%d' " | |
| 220 | + "title='Open this pikchr in /pikchrshow'" | |
| 221 | + ">→ /pikchrshow</a></span>" | |
| 222 | + "</div>\n", | |
| 223 | + counter, blob_str(&bIn), counter, counter); | |
| 214 | 224 | } |
| 215 | 225 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 216 | 226 | blob_append(pOut, "</div>\n", 7); |
| 217 | 227 | } |
| 218 | 228 | }else{ |
| 219 | 229 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -207,12 +207,22 @@ | |
| 207 | blob_append(pOut, zOut, -1); |
| 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | } |
| 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | blob_appendf(pOut, "<pre class='pikchr-src'>%h</pre>\n", |
| 213 | blob_str(&bIn)); |
| 214 | } |
| 215 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 216 | blob_append(pOut, "</div>\n", 7); |
| 217 | } |
| 218 | }else{ |
| 219 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -207,12 +207,22 @@ | |
| 207 | blob_append(pOut, zOut, -1); |
| 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | } |
| 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | static int counter = 0; |
| 213 | ++counter; |
| 214 | blob_appendf(pOut, "<div class='pikchr-src'>" |
| 215 | "<pre id='pikchr-src-%d'>%h</pre>" |
| 216 | "<span class='hidden'>" |
| 217 | "<a href='%R/pikchrshow?fromSession' " |
| 218 | "class='pikchr-src-pikchrshow' target='_new-%d' " |
| 219 | "data-pikchrid='pikchr-src-%d' " |
| 220 | "title='Open this pikchr in /pikchrshow'" |
| 221 | ">→ /pikchrshow</a></span>" |
| 222 | "</div>\n", |
| 223 | counter, blob_str(&bIn), counter, counter); |
| 224 | } |
| 225 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 226 | blob_append(pOut, "</div>\n", 7); |
| 227 | } |
| 228 | }else{ |
| 229 |
+12
-2
| --- src/pikchrshow.c | ||
| +++ src/pikchrshow.c | ||
| @@ -207,12 +207,22 @@ | ||
| 207 | 207 | blob_append(pOut, zOut, -1); |
| 208 | 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | 210 | } |
| 211 | 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | - blob_appendf(pOut, "<pre class='pikchr-src'>%h</pre>\n", | |
| 213 | - blob_str(&bIn)); | |
| 212 | + static int counter = 0; | |
| 213 | + ++counter; | |
| 214 | + blob_appendf(pOut, "<div class='pikchr-src'>" | |
| 215 | + "<pre id='pikchr-src-%d'>%h</pre>" | |
| 216 | + "<span class='hidden'>" | |
| 217 | + "<a href='%R/pikchrshow?fromSession' " | |
| 218 | + "class='pikchr-src-pikchrshow' target='_new-%d' " | |
| 219 | + "data-pikchrid='pikchr-src-%d' " | |
| 220 | + "title='Open this pikchr in /pikchrshow'" | |
| 221 | + ">→ /pikchrshow</a></span>" | |
| 222 | + "</div>\n", | |
| 223 | + counter, blob_str(&bIn), counter, counter); | |
| 214 | 224 | } |
| 215 | 225 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 216 | 226 | blob_append(pOut, "</div>\n", 7); |
| 217 | 227 | } |
| 218 | 228 | }else{ |
| 219 | 229 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -207,12 +207,22 @@ | |
| 207 | blob_append(pOut, zOut, -1); |
| 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | } |
| 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | blob_appendf(pOut, "<pre class='pikchr-src'>%h</pre>\n", |
| 213 | blob_str(&bIn)); |
| 214 | } |
| 215 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 216 | blob_append(pOut, "</div>\n", 7); |
| 217 | } |
| 218 | }else{ |
| 219 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -207,12 +207,22 @@ | |
| 207 | blob_append(pOut, zOut, -1); |
| 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | } |
| 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | static int counter = 0; |
| 213 | ++counter; |
| 214 | blob_appendf(pOut, "<div class='pikchr-src'>" |
| 215 | "<pre id='pikchr-src-%d'>%h</pre>" |
| 216 | "<span class='hidden'>" |
| 217 | "<a href='%R/pikchrshow?fromSession' " |
| 218 | "class='pikchr-src-pikchrshow' target='_new-%d' " |
| 219 | "data-pikchrid='pikchr-src-%d' " |
| 220 | "title='Open this pikchr in /pikchrshow'" |
| 221 | ">→ /pikchrshow</a></span>" |
| 222 | "</div>\n", |
| 223 | counter, blob_str(&bIn), counter, counter); |
| 224 | } |
| 225 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 226 | blob_append(pOut, "</div>\n", 7); |
| 227 | } |
| 228 | }else{ |
| 229 |
+12
-2
| --- src/pikchrshow.c | ||
| +++ src/pikchrshow.c | ||
| @@ -207,12 +207,22 @@ | ||
| 207 | 207 | blob_append(pOut, zOut, -1); |
| 208 | 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | 210 | } |
| 211 | 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | - blob_appendf(pOut, "<pre class='pikchr-src'>%h</pre>\n", | |
| 213 | - blob_str(&bIn)); | |
| 212 | + static int counter = 0; | |
| 213 | + ++counter; | |
| 214 | + blob_appendf(pOut, "<div class='pikchr-src'>" | |
| 215 | + "<pre id='pikchr-src-%d'>%h</pre>" | |
| 216 | + "<span class='hidden'>" | |
| 217 | + "<a href='%R/pikchrshow?fromSession' " | |
| 218 | + "class='pikchr-src-pikchrshow' target='_new-%d' " | |
| 219 | + "data-pikchrid='pikchr-src-%d' " | |
| 220 | + "title='Open this pikchr in /pikchrshow'" | |
| 221 | + ">→ /pikchrshow</a></span>" | |
| 222 | + "</div>\n", | |
| 223 | + counter, blob_str(&bIn), counter, counter); | |
| 214 | 224 | } |
| 215 | 225 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 216 | 226 | blob_append(pOut, "</div>\n", 7); |
| 217 | 227 | } |
| 218 | 228 | }else{ |
| 219 | 229 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -207,12 +207,22 @@ | |
| 207 | blob_append(pOut, zOut, -1); |
| 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | } |
| 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | blob_appendf(pOut, "<pre class='pikchr-src'>%h</pre>\n", |
| 213 | blob_str(&bIn)); |
| 214 | } |
| 215 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 216 | blob_append(pOut, "</div>\n", 7); |
| 217 | } |
| 218 | }else{ |
| 219 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -207,12 +207,22 @@ | |
| 207 | blob_append(pOut, zOut, -1); |
| 208 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 209 | blob_append(pOut, "</div>\n", 7); |
| 210 | } |
| 211 | if(PIKCHR_PROCESS_SRC & pikFlags){ |
| 212 | static int counter = 0; |
| 213 | ++counter; |
| 214 | blob_appendf(pOut, "<div class='pikchr-src'>" |
| 215 | "<pre id='pikchr-src-%d'>%h</pre>" |
| 216 | "<span class='hidden'>" |
| 217 | "<a href='%R/pikchrshow?fromSession' " |
| 218 | "class='pikchr-src-pikchrshow' target='_new-%d' " |
| 219 | "data-pikchrid='pikchr-src-%d' " |
| 220 | "title='Open this pikchr in /pikchrshow'" |
| 221 | ">→ /pikchrshow</a></span>" |
| 222 | "</div>\n", |
| 223 | counter, blob_str(&bIn), counter, counter); |
| 224 | } |
| 225 | if(PIKCHR_PROCESS_DIV & pikFlags){ |
| 226 | blob_append(pOut, "</div>\n", 7); |
| 227 | } |
| 228 | }else{ |
| 229 |