Fossil

Check-in [44a7149dc7]
Login

Check-in [44a7149dc7]

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

Overview
Comment:Merge fixes to the accordion panel JS script.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 44a7149dc78046d7884790b84e6d8b4c65c87acf48d3c2cf3ecb614a6c178887
User & Date: florian 2022-08-10 06:03:00.000
Context
2022-08-11
10:02
Potential, minimally-tested fix for (remote add default URL) not working, as reported in [forum:5748fcb117a99b43|forum post 5748fcb117a99b43]. ... (check-in: c06f58b565 user: stephan tags: remote-add-fix)
03:53
Fix a build error introduced by check-in [fc8e5750d7]. ... (check-in: 49a2d1361f user: florian tags: trunk)
2022-08-10
06:03
Merge fixes to the accordion panel JS script. ... (check-in: 44a7149dc7 user: florian tags: trunk)
06:02
Record a comment on the findings discovered during repair of the accordion panel JS script. ... (Closed-Leaf check-in: 2fc93df48f user: florian tags: accordion-fix)
06:00
Add the new subcommand `fossil branch lsh' to list the most recently modified branches. ... (check-in: fc8e5750d7 user: florian tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/accordion.js.

1
2

3
4




















5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29



30


31

32
33
34
35

/* Attach appropriate javascript to each ".accordion" button so that
** it expands and contracts when clicked.

** The uncompressed source code for the SVG icons can be found on the
** wiki page "branch/accordion-experiments" in the Fossil repository.




















*/
var acc_svgdata = ["data:image/svg+xml,"+
  "%3Csvg xmlns='http:"+"/"+"/www.w3.org/2000/svg' viewBox='0 0 16 16'%3E"+
  "%3Cpath style='fill:black;opacity:0' d='M16,16H0V0h16v16z'/%3E"+
  "%3Cpath style='fill:rgb(240,240,240)' d='M14,14H2V2h12v12z'/%3E"+
  "%3Cpath style='fill:rgb(64,64,64)' d='M13,13H3V3h10v10z'/%3E"+
  "%3Cpath style='fill:rgb(248,248,248)' d='M12,12H4V4h8v8z'/%3E"+
  "%3Cpath style='fill:rgb(80,128,208)' d='", "'/%3E%3C/svg%3E",
  "M5,7h2v-2h2v2h2v2h-2v2h-2v-2h-2z", "M11,9H5V7h6v6z"];
var a = document.getElementsByClassName("accordion");
for(var i=0; i<a.length; i++){
  var img = document.createElement("img");
  img.src = acc_svgdata[0]+acc_svgdata[2]+acc_svgdata[1];
  img.className = "accordion_btn accordion_btn_plus";
  a[i].insertBefore(img,a[i].firstChild);
  img = document.createElement("img");
  img.src = acc_svgdata[0]+acc_svgdata[3]+acc_svgdata[1];
  img.className = "accordion_btn accordion_btn_minus";
  a[i].insertBefore(img,a[i].firstChild);
  var p = a[i].nextElementSibling;
  p.style.maxHeight = p.scrollHeight + "px";
  a[i].addEventListener("click",function(){
    var x = this.nextElementSibling;
    if( this.classList.contains("accordion_closed") ){
      x.style.maxHeight = x.scrollHeight + "px";



    }else{


      x.style.maxHeight = "0";

    }
    this.classList.toggle("accordion_closed");
  });
}
>
|
|
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


|
















<
<




>
>
>

>
>
|
>




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
** Attach appropriate javascript to each ".accordion" button so that it expands
** and contracts when clicked.
**
** The uncompressed source code for the SVG icons can be found on the wiki page
** "branch/accordion-experiments" in the Fossil repository.
**
** Implementation notes:
**
** The `maxHeight' CSS property is quite restrictive for vertical resizing of
** elements, especially for dynamic-content areas like the diff panels. That's
** why `maxHeight' is set only during animation, to prevent truncated elements.
** (The diff panels may get truncated right after page loading, and other
** elements may get truncated when resizing the browser window to a smaller
** width, causing vertical growth.)
**
** Another problem is that `scrollHeight' used to calculate the expanded height
** while still in the contracted state may return values with small errors on
** some browsers, especially for large elements, presumably due to omitting the
** space required by the vertical scrollbar that may become necessary, causing
** additional horizontal shrinking and consequently more vertical growth than
** calculated. That's why setting `maxHeight' to `scrollHeight' is considered
** "good enough" only during animation, but cleared afterwards.
**
** https://fossil-scm.org/forum/forumpost/66d7075f40
** https://fossil-scm.org/home/timeline?r=accordion-fix
*/
var acc_svgdata = ["data:image/svg+xml,"+
  "%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E"+
  "%3Cpath style='fill:black;opacity:0' d='M16,16H0V0h16v16z'/%3E"+
  "%3Cpath style='fill:rgb(240,240,240)' d='M14,14H2V2h12v12z'/%3E"+
  "%3Cpath style='fill:rgb(64,64,64)' d='M13,13H3V3h10v10z'/%3E"+
  "%3Cpath style='fill:rgb(248,248,248)' d='M12,12H4V4h8v8z'/%3E"+
  "%3Cpath style='fill:rgb(80,128,208)' d='", "'/%3E%3C/svg%3E",
  "M5,7h2v-2h2v2h2v2h-2v2h-2v-2h-2z", "M11,9H5V7h6v6z"];
var a = document.getElementsByClassName("accordion");
for(var i=0; i<a.length; i++){
  var img = document.createElement("img");
  img.src = acc_svgdata[0]+acc_svgdata[2]+acc_svgdata[1];
  img.className = "accordion_btn accordion_btn_plus";
  a[i].insertBefore(img,a[i].firstChild);
  img = document.createElement("img");
  img.src = acc_svgdata[0]+acc_svgdata[3]+acc_svgdata[1];
  img.className = "accordion_btn accordion_btn_minus";
  a[i].insertBefore(img,a[i].firstChild);


  a[i].addEventListener("click",function(){
    var x = this.nextElementSibling;
    if( this.classList.contains("accordion_closed") ){
      x.style.maxHeight = x.scrollHeight + "px";
      setTimeout(function(){
        x.style.maxHeight = "";
      },250); // default.css: .accordion_panel { transition-duration }
    }else{
      x.style.maxHeight = x.scrollHeight + "px";
      setTimeout(function(){
        x.style.maxHeight = "0";
      },1);
    }
    this.classList.toggle("accordion_closed");
  });
}
Changes to src/info.c.
876
877
878
879
880
881
882
883

884
885
886
887
888
889
890
  if( !PB("nowiki") ){
    wiki_render_associated("checkin", zUuid, 0);
  }
  render_backlink_graph(zUuid, 
       "<div class=\"section accordion\">References</div>\n");
  @ <div class="section accordion">Context</div><div class="accordion_panel">
  render_checkin_context(rid, 0, 0, 0);
  @ </div><div class="section">Changes</div>

  @ <div class="sectionmenu">
  pCfg = construct_diff_flags(diffType, &DCfg);
  DCfg.pRe = pRe;  
  zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
  if( diffType!=0 ){
    @ %z(chref("button","%R/%s/%T?diff=0",zPageHide,zName))\
    @ Hide&nbsp;Diffs</a>







|
>







876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
  if( !PB("nowiki") ){
    wiki_render_associated("checkin", zUuid, 0);
  }
  render_backlink_graph(zUuid, 
       "<div class=\"section accordion\">References</div>\n");
  @ <div class="section accordion">Context</div><div class="accordion_panel">
  render_checkin_context(rid, 0, 0, 0);
  @ </div><div class="section accordion">Changes</div>
  @ <div class="accordion_panel">
  @ <div class="sectionmenu">
  pCfg = construct_diff_flags(diffType, &DCfg);
  DCfg.pRe = pRe;  
  zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
  if( diffType!=0 ){
    @ %z(chref("button","%R/%s/%T?diff=0",zPageHide,zName))\
    @ Hide&nbsp;Diffs</a>
937
938
939
940
941
942
943

944
945
946
947
948
949
950
    const char *zOld = db_column_text(&q3,2);
    const char *zNew = db_column_text(&q3,3);
    const char *zOldName = db_column_text(&q3, 4);
    append_file_change_line(zUuid, zName, zOld, zNew, zOldName, 
                            pCfg,mperm);
  }
  db_finalize(&q3);

  append_diff_javascript(diffType);
  style_finish_page();
}

/*
** WEBPAGE: winfo
** URL:  /winfo?name=HASH







>







938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
    const char *zOld = db_column_text(&q3,2);
    const char *zNew = db_column_text(&q3,3);
    const char *zOldName = db_column_text(&q3, 4);
    append_file_change_line(zUuid, zName, zOld, zNew, zOldName, 
                            pCfg,mperm);
  }
  db_finalize(&q3);
  @ </div>
  append_diff_javascript(diffType);
  style_finish_page();
}

/*
** WEBPAGE: winfo
** URL:  /winfo?name=HASH