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.
Commit
7c98df415874259b0f6e5ecaffc5959dee756ba8eb7db27352fae6c7499631a8
Parent
d2d8894bb2d6a0d…
1 file changed
+8
-4
+8
-4
| --- src/fossil.numbered-lines.js | ||
| +++ src/fossil.numbered-lines.js | ||
| @@ -18,11 +18,14 @@ | ||
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | const F = window.fossil, D = F.dom; |
| 21 | 21 | const tdLn = tbl.querySelector('td.line-numbers'); |
| 22 | 22 | 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('?&','?'), | |
| 24 | 27 | start: 0, end: 0 |
| 25 | 28 | }; |
| 26 | 29 | |
| 27 | 30 | const lineTip = new fossil.PopupWidget({ |
| 28 | 31 | style: { |
| @@ -38,12 +41,13 @@ | ||
| 38 | 41 | window.location.toString().split('?')[0] |
| 39 | 42 | + lineState.urlArgs + '&ln='+ls.join('-') |
| 40 | 43 | ); |
| 41 | 44 | D.append( |
| 42 | 45 | 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('-') | |
| 45 | 49 | ); |
| 46 | 50 | }else{ |
| 47 | 51 | D.append(link, "No lines selected."); |
| 48 | 52 | } |
| 49 | 53 | }, |
| @@ -55,11 +59,11 @@ | ||
| 55 | 59 | F.copyButton(btnCopy,{ |
| 56 | 60 | copyFromElement: link, |
| 57 | 61 | extractText: ()=>link.dataset.url, |
| 58 | 62 | oncopy: (ev)=>{ |
| 59 | 63 | 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."); | |
| 61 | 65 | } |
| 62 | 66 | }); |
| 63 | 67 | this.e.addEventListener('click', ()=>btnCopy.click(), false); |
| 64 | 68 | D.append(this.e, btnCopy, link) |
| 65 | 69 | } |
| 66 | 70 |
| --- 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 |