Fossil

Check-in [db1afa75be]
Login

Check-in [db1afa75be]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Consolidated the common styles of the bottom- and right-side forum post expansion toggles and resolved a layout quirk which could cause the right-side expander to sit too far to the left.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: db1afa75be73a5343c34039892031df7f352cefc53a9f7f238a5b6117bb6c165
User & Date: stephan 2020-08-14 18:54:03.833
Context
2020-08-16
13:18
Version 2.12 ... (check-in: d075b6199c user: drh tags: trunk, release, version-2.12)
10:05
Reverted [33610b04de8fdf56] because a subtle bug in Chrome and FF causes both browsers to break scrolling of elements if they are descendants, however deeply nested, of a fieldset element. The one known workaround for that is too fragile. This is not release-critical. ... (Closed-Leaf check-in: e5c3ffeb36 user: stephan tags: post-2.12-fixes)
2020-08-14
19:25
Merged trunk to avoid style collisions later. Changed table.numbered-lines line-height from ex units to unitless, as Mozilla recommends. ... (check-in: 41f270de75 user: stephan tags: line-number-selection)
18:54
Consolidated the common styles of the bottom- and right-side forum post expansion toggles and resolved a layout quirk which could cause the right-side expander to sit too far to the left. ... (check-in: db1afa75be user: stephan tags: trunk)
17:57
Several forum style improvements based on forum feedback. ... (check-in: 2121b1f7a7 user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/default.css.
772
773
774
775
776
777
778


779
780
781








782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820

821
822
823
824
825
826
827

828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
}
div.forumHier > div > form,
div.forumTime > div > form,
div.forumHierRoot > div > form {
  margin: 0.5em 0;
}
.forum-post-collapser {


  font-size: 0.8em;
  margin: 0 0 0.4em 0;
  padding: 0;








  height: 1.75em;
  line-height: 1.75em;
  /* ^^^ Those sizes are finely tuned for the current selection of
     arrow characters. If those change, these should, too. Remember that
     FF/Chrome simply do not agree on alignment with most values :/.  */
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0 0 0.5em 0.5em;
  border-color: rgba(0, 0, 0, 0.2);
  opacity: 0.8;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
.forum-post-collapser > span {
  margin: 0 1em 0 1em;
  vertical-align: middle;
}
.forum-post-collapser.expanded > span:before {
  content: "⇡⇡⇡" /*reminder: FF/Chrome cannot agree on alignment of ⮝*/;
}
.forum-post-collapser:not(.expanded) > span:before {
  content: "⇣⇣⇣";
}
div.forumPostBody{
  max-height: 50em;
  overflow: auto;
}
div.forumPostBody.with-expander {
  display: flex;
  flex-direction: row;
  overflow: auto;
}
div.forumPostBody.with-expander:not(.expanded) > :first-child {
  overflow-y: hidden;
}
div.forumPostBody.with-expander > *:first-child {
  /* Main content DIV */
  overflow: auto;

}
div.forumPostBody.with-expander.expanded > *:first-child {
  margin-bottom: 0.5em /* try to suppress scroll bar */;
}
div.forumPostBody.with-expander > *:nth-child(2) {
  /* "Tap zone" for expansion of the post, sits to the right of the
     post's content. */

  min-width: 1.25em;
  max-width: 1.25em;
  /*for testing only:*//*background: magenta;*/
  margin: 0 0 0 0.2em /* leave a gap between this and the neighboring scrollbar */;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  border-radius: 0.1em;
  cursor: pointer;
  background-color: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-bottom: 0;
  border-radius: 0 0.5em 0 0;
  border-color: rgba(0, 0, 0, 0.2);
  opacity: 0.8;
}
div.forumPostBody.with-expander > *:nth-child(2) > span:before {
  content: "⇣";
}
div.forumPostBody.with-expander.expanded > *:nth-child(2) > span:before {
  content: "⇡";
}
div.forumPostBody.expanded {
  max-height: initial;
}
div.forumPostBody.shrunken {
  /* When an expandable post is un-expanded, it is shrunkend down







>
>

<

>
>
>
>
>
>
>
>





<
<
<
<
<




|



|
|

|
|














|

>




|


>


<
|







<
<


<
<

|


|







772
773
774
775
776
777
778
779
780
781

782
783
784
785
786
787
788
789
790
791
792
793
794
795





796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835

836
837
838
839
840
841
842
843


844
845


846
847
848
849
850
851
852
853
854
855
856
857
}
div.forumHier > div > form,
div.forumTime > div > form,
div.forumHierRoot > div > form {
  margin: 0.5em 0;
}
.forum-post-collapser {
  /* Common style for the bottom-of-post and right-of-post
     expand/collapse widgets. */
  font-size: 0.8em;

  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0 0 0.5em 0.5em;
  background-color: rgba(0, 0, 0, 0.05);
  opacity: 0.8;
  cursor: pointer;
}
.forum-post-collapser.bottom {
  margin: 0 0 0.4em 0;
  height: 1.75em;
  line-height: 1.75em;
  /* ^^^ Those sizes are finely tuned for the current selection of
     arrow characters. If those change, these should, too. Remember that
     FF/Chrome simply do not agree on alignment with most values :/.  */





  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
.forum-post-collapser.bottom > span {
  margin: 0 1em 0 1em;
  vertical-align: middle;
}
.forum-post-collapser.bottom > span::before {
  content: "⇣⇣⇣";
}
.forum-post-collapser.bottom.expanded > span::before {
  content: "⇡⇡⇡" /*reminder: FF/Chrome cannot agree on alignment of ⮝*/;
}
div.forumPostBody{
  max-height: 50em;
  overflow: auto;
}
div.forumPostBody.with-expander {
  display: flex;
  flex-direction: row;
  overflow: auto;
}
div.forumPostBody.with-expander:not(.expanded) > :first-child {
  overflow-y: hidden;
}
div.forumPostBody.with-expander > *:first-child {
  /* Main content DIV/PRE */
  overflow: auto;
  flex: 10 1 auto;
}
div.forumPostBody.with-expander.expanded > *:first-child {
  margin-bottom: 0.5em /* try to suppress scroll bar */;
}
div.forumPostBody.with-expander .forum-post-collapser.right {
  /* "Tap zone" for expansion of the post, sits to the right of the
     post's content. */
  flex: 1 10 auto;
  min-width: 1.25em;
  max-width: 1.25em;

  margin: 0 0 0 0.2em;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  border-radius: 0.1em;
  cursor: pointer;


  border-bottom: 0;
  border-radius: 0 0.5em 0 0;


}
div.forumPostBody.with-expander .forum-post-collapser.right > span:before {
  content: "⇣";
}
div.forumPostBody.with-expander.expanded .forum-post-collapser.right > span:before {
  content: "⇡";
}
div.forumPostBody.expanded {
  max-height: initial;
}
div.forumPostBody.shrunken {
  /* When an expandable post is un-expanded, it is shrunkend down
Changes to src/fossil.page.forumpost.js.
33
34
35
36
37
38
39




40
41


42
43
44
45
46
47
48
       their max-height). */
    document.querySelectorAll(
      'div.forumHier, div.forumTime, div.forumHierRoot'
    ).forEach(function f(forumPostWrapper){
      const content = forumPostWrapper.querySelector('div.forumPostBody');
      if(!content || !scrollbarIsVisible(content)) return;
      const parent = content.parentElement,




            rightTapZone = D.div(),
            widget = D.div();


      /* Repopulates the rightTapZone with arrow indicators. Because
         of the wildly varying height of these elements, This has to
         be done dynamically at init time and upon collapse/expand. Will not
         work until the rightTapZone has been added to the DOM. */
      const refillTapZone = function f(){
        if(!f.baseTapIndicatorHeight){
          /* To figure out how often to place an arrow in the rightTapZone,







>
>
>
>
|
|
>
>







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
       their max-height). */
    document.querySelectorAll(
      'div.forumHier, div.forumTime, div.forumHierRoot'
    ).forEach(function f(forumPostWrapper){
      const content = forumPostWrapper.querySelector('div.forumPostBody');
      if(!content || !scrollbarIsVisible(content)) return;
      const parent = content.parentElement,
            widget =  D.addClass(
              D.div(),
              'forum-post-collapser','bottom'
            ),
            rightTapZone = D.addClass(
              D.div(),
              'forum-post-collapser','right'
            );
      /* Repopulates the rightTapZone with arrow indicators. Because
         of the wildly varying height of these elements, This has to
         be done dynamically at init time and upon collapse/expand. Will not
         work until the rightTapZone has been added to the DOM. */
      const refillTapZone = function f(){
        if(!f.baseTapIndicatorHeight){
          /* To figure out how often to place an arrow in the rightTapZone,
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
          D.append(rightTapZone, D.span());
          rtzHeight -= f.baseTapIndicatorHeight * 8;
        }while(rtzHeight>0);
      };
      const handlerStep1 = getWidgetHandler(widget, content);
      const widgetEventHandler = ()=>{ handlerStep1(); refillTapZone(); };
      content.classList.add('with-expander');
      widget.classList.add('forum-post-collapser');
      widget.addEventListener('click', widgetEventHandler, false);
      /** Append 3 children, which CSS will evenly space across the
          widget. This improves visibility over having the label
          in only the left, right, or center. */
      var i = 0;
      for( ; i < 3; ++i ) D.append(widget, D.span());
      if(content.nextSibling){







<







63
64
65
66
67
68
69

70
71
72
73
74
75
76
          D.append(rightTapZone, D.span());
          rtzHeight -= f.baseTapIndicatorHeight * 8;
        }while(rtzHeight>0);
      };
      const handlerStep1 = getWidgetHandler(widget, content);
      const widgetEventHandler = ()=>{ handlerStep1(); refillTapZone(); };
      content.classList.add('with-expander');

      widget.addEventListener('click', widgetEventHandler, false);
      /** Append 3 children, which CSS will evenly space across the
          widget. This improves visibility over having the label
          in only the left, right, or center. */
      var i = 0;
      for( ; i < 3; ++i ) D.append(widget, D.span());
      if(content.nextSibling){