Index: skins/bootstrap/css.txt ================================================================== --- skins/bootstrap/css.txt +++ skins/bootstrap/css.txt cannot compute difference between binary files Index: skins/bootstrap/footer.txt ================================================================== --- skins/bootstrap/footer.txt +++ skins/bootstrap/footer.txt @@ -8,20 +8,24 @@ +}); Index: src/branch.c ================================================================== --- src/branch.c +++ src/branch.c @@ -467,10 +467,11 @@ if( !g.perm.Read ){ login_needed(g.anon.Read); return; } style_set_current_feature("branch"); style_header("Branches"); style_adunit_config(ADUNIT_RIGHT_OK); style_submenu_checkbox("colors", "Use Branch Colors", 0, 0); + style_submenu_element("Timeline", "%R/timeline"); login_anonymous_available(); brlist_create_temp_table(); db_prepare(&q, "SELECT * FROM tmp_brlist ORDER BY mtime DESC"); rNow = db_double(0.0, "SELECT julianday('now')"); @@ -504,11 +505,12 @@ if( zBgClr && zBgClr[0] && show_colors ){ @ }else{ @ } - @ %z(href("%R/timeline?r=%T",zBranch))%h(zBranch) + @ %z(href("%R/timeline?r=%T",zBranch))%h(zBranch) @ %s(zAge) @ %d(nCkin) fossil_free(zAge); @ %s(isClosed?"closed":"") if( zMergeTo ){ @@ -519,10 +521,11 @@ } @ } @ db_finalize(&q); + builtin_request_js("fossil.page.brlist.js"); style_table_sorter(); style_finish_page(); } /* Index: src/default.css ================================================================== --- src/default.css +++ src/default.css @@ -1772,10 +1772,30 @@ } input[type="checkbox"].diff-toggle { float: right; } + +body.branch .brlist > table > tbody > tr:hover > td:first-child, +body.branch .brlist > table > tbody > tr.selected { + font-weight: bold; +} +body.branch .brlist > table > tbody td:first-child > input { + cursor: pointer; +} +body.branch .brlist > table > tbody > tr > td:nth-child(1) { + display: flex; + flex-direction: row; + justify-content: space-between; +} +body.branch .submenu > a.timeline-link { + display: none; +} +body.branch .submenu > a.timeline-link.selected { + display: inline; +} + /* Objects in the "desktoponly" class are invisible on mobile */ @media screen and (max-width: 600px) { .desktoponly { display: none; } ADDED src/fossil.page.brlist.js Index: src/fossil.page.brlist.js ================================================================== --- /dev/null +++ src/fossil.page.brlist.js @@ -0,0 +1,69 @@ +/* + * This script adds multiselect facility for the list of branches. + * + * Some info on 'const': + * https://caniuse.com/const + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const#browser_compatibility + * + * According to MDN 'const' requires Android's WebView 37, + * which may not be available. + * For the time being, continueing without 'const' and 'indexOf' + * (but that may be reconsidered later). +*/ +window.addEventListener( 'load', function() { + +var anchor = document.querySelector("div.submenu > a:first-of-type" ); +if( !anchor || anchor.innerText != "Timeline" ) return; +var prefix = anchor.href.toString() + "?ms=regexp&rel&t="; +anchor.classList.add('timeline-link'); + +var amendAnchor = function( selected ){ + if( selected.length == 0 ){ + anchor.classList.remove('selected'); + anchor.href = prefix; + return; + } + re = selected.join("|"); + try{re = encodeURIComponent(re);} + catch{console.log("encodeURIComponent() failed for ",re);} + anchor.href = prefix + re; + anchor.innerHTML = "View " + selected.length + + ( selected.length > 1 ? " branches" : " branch" ); + anchor.classList.add('selected'); + // console.log("Link:",anchor.href); +} + +var onChange = function( event ){ + var cbx = event.target; + var tr = cbx.parentElement.parentElement; + var tag = cbx.parentElement.children[0].innerText; + var re = anchor.href.substr(prefix.length); + try{re = decodeURIComponent(re);} + catch{console.log("decodeURIComponent() failed for ",re);} + var selected = ( re != "" ? re.split("|") : [] ); + if( cbx.checked ){ + selected.push(tag); + tr.classList.add('selected'); + } + else { + tr.classList.remove('selected'); + for( var i = selected.length; --i >= 0 ;) + if( selected[i] == tag ) + selected.splice(i,1); + } + amendAnchor( selected ); +} + +var stags = []; /* initially selected tags, not used above */ +document.querySelectorAll("div.brlist > table td:first-child > input") + .forEach( function( cbx ){ + cbx.onchange = onChange; + cbx.disabled = false; + if( cbx.checked ){ + stags.push(cbx.parentElement.children[0].innerText); + cbx.parentElement.parentElement.classList.add('selected'); + } + }); +amendAnchor( stags ); + +}); // window.addEventListener( 'load' ... Index: src/main.mk ================================================================== --- src/main.mk +++ src/main.mk @@ -226,10 +226,11 @@ $(SRCDIR)/fossil.copybutton.js \ $(SRCDIR)/fossil.dom.js \ $(SRCDIR)/fossil.fetch.js \ $(SRCDIR)/fossil.info-diff.js \ $(SRCDIR)/fossil.numbered-lines.js \ + $(SRCDIR)/fossil.page.brlist.js \ $(SRCDIR)/fossil.page.fileedit.js \ $(SRCDIR)/fossil.page.forumpost.js \ $(SRCDIR)/fossil.page.pikchrshow.js \ $(SRCDIR)/fossil.page.whistory.js \ $(SRCDIR)/fossil.page.wikiedit.js \ Index: www/changes.wiki ================================================================== --- www/changes.wiki +++ www/changes.wiki @@ -1,7 +1,15 @@ Change Log + +

Changes for Version 2.16 (pending)

+ * [/brlist|List of branches] gained + [/timeline?r=brlist-timeline|the facility] to select several + branches and [./javascript.md#brlist|point a user] to the + /timeline view that shows just these selected branches + and the related check-ins. +

Changes for Version 2.15 (2021-03-26) and Patch 2.15.1 on (2021-04-07)

* Patch 2.15.1: Fix a data exfiltration bug in the server. Upgrading to the patch is recommended.

* The [./defcsp.md|default CSP] has been relaxed slightly to allow Index: www/javascript.md ================================================================== --- www/javascript.md +++ www/javascript.md @@ -570,10 +570,23 @@ …would pull the messages submitted since the last poll. Making the gateway bidirectional should be possible as well, as long as it properly uses SQLite transactions. +### List of branches + +Since Fossil 2.16 [`/brlist`](/brlist) page uses JavaScript to enable +selection of several branches for further study via `/timeline`. +Client-side script interactively responds to checkboxes' events +and constructs a special hyperlink in the submenu. +Clicking this hyperlink loads a `/timeline` page that shows +only these selected branches (and the related check-ins). + +_Potential Workaround:_ A user can manually construct an appropriate +regular expession and put it into the "Tag Filter" entry of the +`/timeline` page (in its advanced mode). + ---- ## Future Plans for JavaScript in Fossil As of mid-2020, the informal provisional plan is to increase Fossil