Fossil SCM

Automatically add "glob=<str>" to the query string of the /vdiff page when looking at subdirectory history.

mgagnon 2021-04-23 20:03 trunk
Commit 3e588c822ca1019d269463171734e1f307717941ae40b8daf2838f40536448c4
1 file changed +28 -2
+28 -2
--- src/graph.js
+++ src/graph.js
@@ -82,10 +82,22 @@
8282
style.textContent = css;
8383
document.querySelector("head").appendChild(style);
8484
}
8585
amendCssOnce = 0;
8686
}
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
+}
8799
88100
/* The <span> object that holds the tooltip */
89101
var tooltipObj = document.createElement("span");
90102
tooltipObj.className = "tl-tooltip";
91103
tooltipObj.style.display = "none";
@@ -568,13 +580,27 @@
568580
selRow = null;
569581
this.className = this.className.replace(" sel", "");
570582
canvasDiv.className = canvasDiv.className.replace(" sel", "");
571583
}else{
572584
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;
574586
}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;
576602
}
577603
}
578604
e.stopPropagation()
579605
}
580606
function dblclickOnNode(e){
581607
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button