Fossil SCM
On the /brlist page, try to prevent flicker of the "View N branches" label by creating the label using JS instead of as part of the original document.
Commit
668f0e71e63c4343c08f53a4626ddba1d9d11b4eff08ba71ba31e3e9637a61e7
Parent
95a726914208dba…
2 files changed
+2
-1
+9
-4
+2
-1
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -467,16 +467,17 @@ | ||
| 467 | 467 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 468 | 468 | style_set_current_feature("branch"); |
| 469 | 469 | style_header("Branches"); |
| 470 | 470 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 471 | 471 | style_submenu_checkbox("colors", "Use Branch Colors", 0, 0); |
| 472 | - style_submenu_element("Timeline", "%R/timeline"); | |
| 473 | 472 | login_anonymous_available(); |
| 474 | 473 | |
| 475 | 474 | brlist_create_temp_table(); |
| 476 | 475 | db_prepare(&q, "SELECT * FROM tmp_brlist ORDER BY mtime DESC"); |
| 477 | 476 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 477 | + @ <script id="brlist-data" type="application/json">\ | |
| 478 | + @ {"timelineUrl":"%R/timeline"}</script> | |
| 478 | 479 | @ <div class="brlist"> |
| 479 | 480 | @ <table class='sortable' data-column-types='tkNtt' data-init-sort='2'> |
| 480 | 481 | @ <thead><tr> |
| 481 | 482 | @ <th>Branch Name</th> |
| 482 | 483 | @ <th>Last Change</th> |
| 483 | 484 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -467,16 +467,17 @@ | |
| 467 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 468 | style_set_current_feature("branch"); |
| 469 | style_header("Branches"); |
| 470 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 471 | style_submenu_checkbox("colors", "Use Branch Colors", 0, 0); |
| 472 | style_submenu_element("Timeline", "%R/timeline"); |
| 473 | login_anonymous_available(); |
| 474 | |
| 475 | brlist_create_temp_table(); |
| 476 | db_prepare(&q, "SELECT * FROM tmp_brlist ORDER BY mtime DESC"); |
| 477 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 478 | @ <div class="brlist"> |
| 479 | @ <table class='sortable' data-column-types='tkNtt' data-init-sort='2'> |
| 480 | @ <thead><tr> |
| 481 | @ <th>Branch Name</th> |
| 482 | @ <th>Last Change</th> |
| 483 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -467,16 +467,17 @@ | |
| 467 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 468 | style_set_current_feature("branch"); |
| 469 | style_header("Branches"); |
| 470 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 471 | style_submenu_checkbox("colors", "Use Branch Colors", 0, 0); |
| 472 | login_anonymous_available(); |
| 473 | |
| 474 | brlist_create_temp_table(); |
| 475 | db_prepare(&q, "SELECT * FROM tmp_brlist ORDER BY mtime DESC"); |
| 476 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 477 | @ <script id="brlist-data" type="application/json">\ |
| 478 | @ {"timelineUrl":"%R/timeline"}</script> |
| 479 | @ <div class="brlist"> |
| 480 | @ <table class='sortable' data-column-types='tkNtt' data-init-sort='2'> |
| 481 | @ <thead><tr> |
| 482 | @ <th>Branch Name</th> |
| 483 | @ <th>Last Change</th> |
| 484 |
+9
-4
| --- src/fossil.page.brlist.js | ||
| +++ src/fossil.page.brlist.js | ||
| @@ -10,14 +10,20 @@ | ||
| 10 | 10 | * For the time being, continueing without 'const' and 'indexOf' |
| 11 | 11 | * (but that may be reconsidered later). |
| 12 | 12 | */ |
| 13 | 13 | window.addEventListener( 'load', function() { |
| 14 | 14 | |
| 15 | -var anchor = document.querySelector("div.submenu > a:first-of-type" ); | |
| 16 | -if( !anchor || anchor.innerText != "Timeline" ) return; | |
| 15 | +var submenu = document.querySelector("div.submenu"); | |
| 16 | +var anchor = document.createElement("A"); | |
| 17 | +var brlistDataObj = document.getElementById("brlist-data"); | |
| 18 | +var brlistDataTxt = brlistDataObj.textContent || brlistDataObj.innerText; | |
| 19 | +var brlistData = JSON.parse(brlistDataTxt); | |
| 20 | +anchor.classList.add("label"); | |
| 21 | +anchor.classList.add("timeline-link"); | |
| 22 | +anchor.href = brlistData.timelineUrl; | |
| 17 | 23 | var prefix = anchor.href.toString() + "?ms=brlist&t="; |
| 18 | -anchor.classList.add('timeline-link'); | |
| 24 | +submenu.insertBefore(anchor,submenu.childNodes[0]); | |
| 19 | 25 | |
| 20 | 26 | var amendAnchor = function( selected ){ |
| 21 | 27 | if( selected.length == 0 ){ |
| 22 | 28 | anchor.classList.remove('selected'); |
| 23 | 29 | anchor.href = prefix; |
| @@ -28,11 +34,10 @@ | ||
| 28 | 34 | catch{console.log("encodeURIComponent() failed for ",re);} |
| 29 | 35 | anchor.href = prefix + re; |
| 30 | 36 | anchor.innerHTML = "View " + selected.length + |
| 31 | 37 | ( selected.length > 1 ? " branches" : " branch" ); |
| 32 | 38 | anchor.classList.add('selected'); |
| 33 | - // console.log("Link:",anchor.href); | |
| 34 | 39 | } |
| 35 | 40 | |
| 36 | 41 | var onChange = function( event ){ |
| 37 | 42 | var cbx = event.target; |
| 38 | 43 | var tr = cbx.parentElement.parentElement; |
| 39 | 44 |
| --- src/fossil.page.brlist.js | |
| +++ src/fossil.page.brlist.js | |
| @@ -10,14 +10,20 @@ | |
| 10 | * For the time being, continueing without 'const' and 'indexOf' |
| 11 | * (but that may be reconsidered later). |
| 12 | */ |
| 13 | window.addEventListener( 'load', function() { |
| 14 | |
| 15 | var anchor = document.querySelector("div.submenu > a:first-of-type" ); |
| 16 | if( !anchor || anchor.innerText != "Timeline" ) return; |
| 17 | var prefix = anchor.href.toString() + "?ms=brlist&t="; |
| 18 | anchor.classList.add('timeline-link'); |
| 19 | |
| 20 | var amendAnchor = function( selected ){ |
| 21 | if( selected.length == 0 ){ |
| 22 | anchor.classList.remove('selected'); |
| 23 | anchor.href = prefix; |
| @@ -28,11 +34,10 @@ | |
| 28 | catch{console.log("encodeURIComponent() failed for ",re);} |
| 29 | anchor.href = prefix + re; |
| 30 | anchor.innerHTML = "View " + selected.length + |
| 31 | ( selected.length > 1 ? " branches" : " branch" ); |
| 32 | anchor.classList.add('selected'); |
| 33 | // console.log("Link:",anchor.href); |
| 34 | } |
| 35 | |
| 36 | var onChange = function( event ){ |
| 37 | var cbx = event.target; |
| 38 | var tr = cbx.parentElement.parentElement; |
| 39 |
| --- src/fossil.page.brlist.js | |
| +++ src/fossil.page.brlist.js | |
| @@ -10,14 +10,20 @@ | |
| 10 | * For the time being, continueing without 'const' and 'indexOf' |
| 11 | * (but that may be reconsidered later). |
| 12 | */ |
| 13 | window.addEventListener( 'load', function() { |
| 14 | |
| 15 | var submenu = document.querySelector("div.submenu"); |
| 16 | var anchor = document.createElement("A"); |
| 17 | var brlistDataObj = document.getElementById("brlist-data"); |
| 18 | var brlistDataTxt = brlistDataObj.textContent || brlistDataObj.innerText; |
| 19 | var brlistData = JSON.parse(brlistDataTxt); |
| 20 | anchor.classList.add("label"); |
| 21 | anchor.classList.add("timeline-link"); |
| 22 | anchor.href = brlistData.timelineUrl; |
| 23 | var prefix = anchor.href.toString() + "?ms=brlist&t="; |
| 24 | submenu.insertBefore(anchor,submenu.childNodes[0]); |
| 25 | |
| 26 | var amendAnchor = function( selected ){ |
| 27 | if( selected.length == 0 ){ |
| 28 | anchor.classList.remove('selected'); |
| 29 | anchor.href = prefix; |
| @@ -28,11 +34,10 @@ | |
| 34 | catch{console.log("encodeURIComponent() failed for ",re);} |
| 35 | anchor.href = prefix + re; |
| 36 | anchor.innerHTML = "View " + selected.length + |
| 37 | ( selected.length > 1 ? " branches" : " branch" ); |
| 38 | anchor.classList.add('selected'); |
| 39 | } |
| 40 | |
| 41 | var onChange = function( event ){ |
| 42 | var cbx = event.target; |
| 43 | var tr = cbx.parentElement.parentElement; |
| 44 |