Fossil

Check-in [73ebf81b93]
Login

Check-in [73ebf81b93]

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

Overview
Comment:Cosmetic tweaks: align the new checkboxes consistently and toggle a class on the Timeline link when any checkboxes are selected, to give the user some indication that the checkboxes are doing something.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | brlist-timeline
Files: files | file ages | folders
SHA3-256: 73ebf81b9331ee89690a8fff72ac48b1892b09d12a0e5d68048106e7fa3864ee
User & Date: stephan 2021-04-18 21:08:03.984
Context
2021-04-19
01:01
Rename 'Timeline' submenu link into 'View X branches' that is shown only if two or more branches are selected. Also some minor code refactoring for better compatability with old versions of WebView. ... (check-in: 00891cba00 user: george tags: brlist-timeline)
2021-04-18
21:17
Removed a reference to a removed function. ... (Closed-Leaf check-in: 90f9af2171 user: stephan tags: brlist-timeline)
21:08
Cosmetic tweaks: align the new checkboxes consistently and toggle a class on the Timeline link when any checkboxes are selected, to give the user some indication that the checkboxes are doing something. ... (check-in: 73ebf81b93 user: stephan tags: brlist-timeline)
20:11
Fix the previous: add the <tt>fossil.page.brlist.js</tt> script which was forgotten. ... (check-in: 6f5a5643ae user: george tags: brlist-timeline)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/branch.c.
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
      }
    }
    if( zBgClr && zBgClr[0] && show_colors ){
      @ <tr style="background-color:%s(zBgClr)">
    }else{
      @ <tr>
    }
    @ <td>%z(href("%R/timeline?r=%T",zBranch))%h(zBranch)</a>
    @     <input type="checkbox" disabled="disabled"/></td>
    @ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td>
    @ <td>%d(nCkin)</td>
    fossil_free(zAge);
    @ <td>%s(isClosed?"closed":"")</td>
    if( zMergeTo ){
      @ <td>merged into
      @ %z(href("%R/timeline?f=%!S",zLastCkin))%h(zMergeTo)</a></td>







|
|







503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
      }
    }
    if( zBgClr && zBgClr[0] && show_colors ){
      @ <tr style="background-color:%s(zBgClr)">
    }else{
      @ <tr>
    }
    @ <td>%z(href("%R/timeline?r=%T",zBranch))%h(zBranch)</a><input 
    @  type="checkbox" disabled="disabled"/></td>
    @ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td>
    @ <td>%d(nCkin)</td>
    fossil_free(zAge);
    @ <td>%s(isClosed?"closed":"")</td>
    if( zMergeTo ){
      @ <td>merged into
      @ %z(href("%R/timeline?f=%!S",zLastCkin))%h(zMergeTo)</a></td>
Changes to src/default.css.
1770
1771
1772
1773
1774
1775
1776










1777
1778
1779
1780
1781
1782
1783
  max-width: 45%;
  max-height: 45%;
}

input[type="checkbox"].diff-toggle {
  float: right;
}










/* Objects in the "desktoponly" class are invisible on mobile */
@media screen and (max-width: 600px) {
  .desktoponly {
    display: none;
  }
}
/* Objects in the "wideonly" class are invisible only on wide-screen desktops */







>
>
>
>
>
>
>
>
>
>







1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
  max-width: 45%;
  max-height: 45%;
}

input[type="checkbox"].diff-toggle {
  float: right;
}

body.branch .brlist > table > tbody > tr > td:nth-child(1) {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
body.branch a.label.timeline-link.selected {
  font-weight: bold;
}

/* Objects in the "desktoponly" class are invisible on mobile */
@media screen and (max-width: 600px) {
  .desktoponly {
    display: none;
  }
}
/* Objects in the "wideonly" class are invisible only on wide-screen desktops */
Changes to src/fossil.page.brlist.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
/*
 * This script adds multiselect facility for the list of branches.
*/
window.addEventListener( 'load', function() {

var anchor = document.querySelector("div.submenu > a.label" );
if( !anchor || anchor.innerText != "Timeline" ) return;
var prefix = anchor.href.toString() + "?ms=regexp&rel&t=";


var onChange = function( event ){
  var cbx = event.target;
  var tag = cbx.parentElement.children[0].innerText;
  var re = anchor.href.substr(prefix.length);
  if( cbx.checked ){
    if( re != "" ){
      re += "|";
    }
    re += tag;










  }else if( re == tag ){
    re = ""

  }else {
      var a = re.split("|");
      var i = a.length;
      while( --i >= 0 ){
        if( a[i] == tag )
          a.splice(i,1);
      }
      re = a.join("|");

  }
  anchor.href = prefix + re;
}

var selected = [];
document.querySelectorAll("div.brlist > table td:first-child > input")
  .forEach( function( cbx ){








|
>

|
|






>
>
>
>
>
>
>
>
>
>
|
|
>
|







>







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
/*
 * This script adds multiselect facility for the list of branches.
*/
window.addEventListener( 'load', function() {

var anchor = document.querySelector("div.submenu > a.label" );
if( !anchor || anchor.innerText != "Timeline" ) return;
var prefix = anchor.href.toString() + "?ms=regexp&rel&t=";
anchor.classList.add('timeline-link');
const selectedCheckboxes = []/*currently-selected checkboxes*/;
var onChange = function( event ){
  const cbx = event.target;
  const tag = cbx.parentElement.children[0].innerText;
  var re = anchor.href.substr(prefix.length);
  if( cbx.checked ){
    if( re != "" ){
      re += "|";
    }
    re += tag;
    selectedCheckboxes.push(cbx);
    anchor.classList.add('selected'); 
  }else{
    const ndx = selectedCheckboxes.indexOf(cbx);
    if(ndx>=0){
      selectedCheckboxes.splice(ndx,1);
      if(!selectedCheckboxes.length){
        anchor.classList.remove('selected');
      }
    }
    if( re == tag ){
      re = "";
      removeSelected(cbx);
    }else {
      var a = re.split("|");
      var i = a.length;
      while( --i >= 0 ){
        if( a[i] == tag )
          a.splice(i,1);
      }
      re = a.join("|");
    }
  }
  anchor.href = prefix + re;
}

var selected = [];
document.querySelectorAll("div.brlist > table td:first-child > input")
  .forEach( function( cbx ){