Fossil SCM
Automatically add "glob=<str>" to the query string of the /vdiff page when looking at subdirectory history.
Commit
3e588c822ca1019d269463171734e1f307717941ae40b8daf2838f40536448c4
Parent
5df47469a174421…
1 file changed
+28
-2
+28
-2
| --- src/graph.js | ||
| +++ src/graph.js | ||
| @@ -82,10 +82,22 @@ | ||
| 82 | 82 | style.textContent = css; |
| 83 | 83 | document.querySelector("head").appendChild(style); |
| 84 | 84 | } |
| 85 | 85 | amendCssOnce = 0; |
| 86 | 86 | } |
| 87 | + | |
| 88 | +/* Legacy function to get a single key in the QueryString. */ | |
| 89 | +function getQueryStringValue (key) { | |
| 90 | + return decodeURIComponent( | |
| 91 | + window.location.search.replace( | |
| 92 | + new RegExp( | |
| 93 | + "^(?:.*[&\\?]" + encodeURIComponent(key).replace( | |
| 94 | + /[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i" | |
| 95 | + ), "$1" | |
| 96 | + ) | |
| 97 | + ); | |
| 98 | +} | |
| 87 | 99 | |
| 88 | 100 | /* The <span> object that holds the tooltip */ |
| 89 | 101 | var tooltipObj = document.createElement("span"); |
| 90 | 102 | tooltipObj.className = "tl-tooltip"; |
| 91 | 103 | tooltipObj.style.display = "none"; |
| @@ -568,13 +580,27 @@ | ||
| 568 | 580 | selRow = null; |
| 569 | 581 | this.className = this.className.replace(" sel", ""); |
| 570 | 582 | canvasDiv.className = canvasDiv.className.replace(" sel", ""); |
| 571 | 583 | }else{ |
| 572 | 584 | if( tx.fileDiff ){ |
| 573 | - location.href=tx.baseUrl + "/fdiff?v1="+selRow.h+"&v2="+p.h | |
| 585 | + location.href=tx.baseUrl + "/fdiff?v1="+selRow.h+"&v2="+p.h; | |
| 574 | 586 | }else{ |
| 575 | - location.href=tx.baseUrl + "/vdiff?from="+selRow.h+"&to="+p.h | |
| 587 | + var href = tx.baseUrl + "/vdiff?from="+selRow.h+"&to="+p.h; | |
| 588 | + | |
| 589 | + /* When called from /timeline page, If chng=str was specified in the | |
| 590 | + ** QueryString, specify glob=str on the /vdiff page */ | |
| 591 | + var glob = getQueryStringValue("chng"); | |
| 592 | + if( !glob ){ | |
| 593 | + /* When called from /vdiff page, keep the glob= QueryString if | |
| 594 | + ** present. */ | |
| 595 | + glob = getQueryStringValue("glob"); | |
| 596 | + } | |
| 597 | + if( glob ){ | |
| 598 | + href += "&glob=" + glob; | |
| 599 | + } | |
| 600 | + | |
| 601 | + location.href = href; | |
| 576 | 602 | } |
| 577 | 603 | } |
| 578 | 604 | e.stopPropagation() |
| 579 | 605 | } |
| 580 | 606 | function dblclickOnNode(e){ |
| 581 | 607 |
| --- src/graph.js | |
| +++ src/graph.js | |
| @@ -82,10 +82,22 @@ | |
| 82 | style.textContent = css; |
| 83 | document.querySelector("head").appendChild(style); |
| 84 | } |
| 85 | amendCssOnce = 0; |
| 86 | } |
| 87 | |
| 88 | /* The <span> object that holds the tooltip */ |
| 89 | var tooltipObj = document.createElement("span"); |
| 90 | tooltipObj.className = "tl-tooltip"; |
| 91 | tooltipObj.style.display = "none"; |
| @@ -568,13 +580,27 @@ | |
| 568 | selRow = null; |
| 569 | this.className = this.className.replace(" sel", ""); |
| 570 | canvasDiv.className = canvasDiv.className.replace(" sel", ""); |
| 571 | }else{ |
| 572 | if( tx.fileDiff ){ |
| 573 | location.href=tx.baseUrl + "/fdiff?v1="+selRow.h+"&v2="+p.h |
| 574 | }else{ |
| 575 | location.href=tx.baseUrl + "/vdiff?from="+selRow.h+"&to="+p.h |
| 576 | } |
| 577 | } |
| 578 | e.stopPropagation() |
| 579 | } |
| 580 | function dblclickOnNode(e){ |
| 581 |
| --- src/graph.js | |
| +++ src/graph.js | |
| @@ -82,10 +82,22 @@ | |
| 82 | style.textContent = css; |
| 83 | document.querySelector("head").appendChild(style); |
| 84 | } |
| 85 | amendCssOnce = 0; |
| 86 | } |
| 87 | |
| 88 | /* Legacy function to get a single key in the QueryString. */ |
| 89 | function getQueryStringValue (key) { |
| 90 | return decodeURIComponent( |
| 91 | window.location.search.replace( |
| 92 | new RegExp( |
| 93 | "^(?:.*[&\\?]" + encodeURIComponent(key).replace( |
| 94 | /[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i" |
| 95 | ), "$1" |
| 96 | ) |
| 97 | ); |
| 98 | } |
| 99 | |
| 100 | /* The <span> object that holds the tooltip */ |
| 101 | var tooltipObj = document.createElement("span"); |
| 102 | tooltipObj.className = "tl-tooltip"; |
| 103 | tooltipObj.style.display = "none"; |
| @@ -568,13 +580,27 @@ | |
| 580 | selRow = null; |
| 581 | this.className = this.className.replace(" sel", ""); |
| 582 | canvasDiv.className = canvasDiv.className.replace(" sel", ""); |
| 583 | }else{ |
| 584 | if( tx.fileDiff ){ |
| 585 | location.href=tx.baseUrl + "/fdiff?v1="+selRow.h+"&v2="+p.h; |
| 586 | }else{ |
| 587 | var href = tx.baseUrl + "/vdiff?from="+selRow.h+"&to="+p.h; |
| 588 | |
| 589 | /* When called from /timeline page, If chng=str was specified in the |
| 590 | ** QueryString, specify glob=str on the /vdiff page */ |
| 591 | var glob = getQueryStringValue("chng"); |
| 592 | if( !glob ){ |
| 593 | /* When called from /vdiff page, keep the glob= QueryString if |
| 594 | ** present. */ |
| 595 | glob = getQueryStringValue("glob"); |
| 596 | } |
| 597 | if( glob ){ |
| 598 | href += "&glob=" + glob; |
| 599 | } |
| 600 | |
| 601 | location.href = href; |
| 602 | } |
| 603 | } |
| 604 | e.stopPropagation() |
| 605 | } |
| 606 | function dblclickOnNode(e){ |
| 607 |