Fossil SCM

Line numbering forum feedback: removed toast message, replaced vague 'lines X-Y' label with 'Copy link to lines X-Y', removed udc=xxx from the generated URL.

stephan 2020-08-18 22:53 trunk
Commit 7c98df415874259b0f6e5ecaffc5959dee756ba8eb7db27352fae6c7499631a8
--- src/fossil.numbered-lines.js
+++ src/fossil.numbered-lines.js
@@ -18,11 +18,14 @@
1818
}
1919
}
2020
const F = window.fossil, D = F.dom;
2121
const tdLn = tbl.querySelector('td.line-numbers');
2222
const lineState = {
23
- urlArgs: (window.location.search||'?').replace(/&?\bln=[^&]*/,''),
23
+ urlArgs: (window.location.search||'?')
24
+ .replace(/&?\budc=[^&]*/,'') /* "update display prefs cookie" */
25
+ .replace(/&?\bln=[^&]*/,'') /* inbound line number/range */
26
+ .replace('?&','?'),
2427
start: 0, end: 0
2528
};
2629
2730
const lineTip = new fossil.PopupWidget({
2831
style: {
@@ -38,12 +41,13 @@
3841
window.location.toString().split('?')[0]
3942
+ lineState.urlArgs + '&ln='+ls.join('-')
4043
);
4144
D.append(
4245
D.clearElement(link),
43
- ' ',
44
- (ls.length===1 ? 'line ' : 'lines ')+ls.join('-')
46
+ ' Copy link to '+(
47
+ ls.length===1 ? 'line ' : 'lines '
48
+ )+ls.join('-')
4549
);
4650
}else{
4751
D.append(link, "No lines selected.");
4852
}
4953
},
@@ -55,11 +59,11 @@
5559
F.copyButton(btnCopy,{
5660
copyFromElement: link,
5761
extractText: ()=>link.dataset.url,
5862
oncopy: (ev)=>{
5963
D.flashOnce(ev.target, undefined, ()=>lineTip.hide());
60
- F.toast.message("Copied link to clipboard.");
64
+ // arguably too snazzy: F.toast.message("Copied link to clipboard.");
6165
}
6266
});
6367
this.e.addEventListener('click', ()=>btnCopy.click(), false);
6468
D.append(this.e, btnCopy, link)
6569
}
6670
--- src/fossil.numbered-lines.js
+++ src/fossil.numbered-lines.js
@@ -18,11 +18,14 @@
18 }
19 }
20 const F = window.fossil, D = F.dom;
21 const tdLn = tbl.querySelector('td.line-numbers');
22 const lineState = {
23 urlArgs: (window.location.search||'?').replace(/&?\bln=[^&]*/,''),
 
 
 
24 start: 0, end: 0
25 };
26
27 const lineTip = new fossil.PopupWidget({
28 style: {
@@ -38,12 +41,13 @@
38 window.location.toString().split('?')[0]
39 + lineState.urlArgs + '&ln='+ls.join('-')
40 );
41 D.append(
42 D.clearElement(link),
43 ' ',
44 (ls.length===1 ? 'line ' : 'lines ')+ls.join('-')
 
45 );
46 }else{
47 D.append(link, "No lines selected.");
48 }
49 },
@@ -55,11 +59,11 @@
55 F.copyButton(btnCopy,{
56 copyFromElement: link,
57 extractText: ()=>link.dataset.url,
58 oncopy: (ev)=>{
59 D.flashOnce(ev.target, undefined, ()=>lineTip.hide());
60 F.toast.message("Copied link to clipboard.");
61 }
62 });
63 this.e.addEventListener('click', ()=>btnCopy.click(), false);
64 D.append(this.e, btnCopy, link)
65 }
66
--- src/fossil.numbered-lines.js
+++ src/fossil.numbered-lines.js
@@ -18,11 +18,14 @@
18 }
19 }
20 const F = window.fossil, D = F.dom;
21 const tdLn = tbl.querySelector('td.line-numbers');
22 const lineState = {
23 urlArgs: (window.location.search||'?')
24 .replace(/&?\budc=[^&]*/,'') /* "update display prefs cookie" */
25 .replace(/&?\bln=[^&]*/,'') /* inbound line number/range */
26 .replace('?&','?'),
27 start: 0, end: 0
28 };
29
30 const lineTip = new fossil.PopupWidget({
31 style: {
@@ -38,12 +41,13 @@
41 window.location.toString().split('?')[0]
42 + lineState.urlArgs + '&ln='+ls.join('-')
43 );
44 D.append(
45 D.clearElement(link),
46 ' Copy link to '+(
47 ls.length===1 ? 'line ' : 'lines '
48 )+ls.join('-')
49 );
50 }else{
51 D.append(link, "No lines selected.");
52 }
53 },
@@ -55,11 +59,11 @@
59 F.copyButton(btnCopy,{
60 copyFromElement: link,
61 extractText: ()=>link.dataset.url,
62 oncopy: (ev)=>{
63 D.flashOnce(ev.target, undefined, ()=>lineTip.hide());
64 // arguably too snazzy: F.toast.message("Copied link to clipboard.");
65 }
66 });
67 this.e.addEventListener('click', ()=>btnCopy.click(), false);
68 D.append(this.e, btnCopy, link)
69 }
70

Keyboard Shortcuts

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