Fossil SCM

Minor tweak to the copybtn.js interface to fall back to the default element ID "copy-IDTARGET".

florian 2019-06-07 12:03 copybtn.js-tweaks
Commit 16fcd48aa46d909f9441ca3cdb334485e43b8269aeb7fb834e76719df8791963
1 file changed +1
--- src/copybtn.js
+++ src/copybtn.js
@@ -30,10 +30,11 @@
3030
elButton.id = "copy-" + idTarget;
3131
initCopyButton(elButton,idTarget,cchLength);
3232
return elButton;
3333
}
3434
function initCopyButtonById(idButton,idTarget,cchLength){
35
+ idButton = idButton || "copy-" + idTarget;
3536
var elButton = document.getElementById(idButton);
3637
if( elButton ) initCopyButton(elButton,idTarget,cchLength);
3738
return elButton;
3839
}
3940
function initCopyButton(elButton,idTarget,cchLength){
4041
--- src/copybtn.js
+++ src/copybtn.js
@@ -30,10 +30,11 @@
30 elButton.id = "copy-" + idTarget;
31 initCopyButton(elButton,idTarget,cchLength);
32 return elButton;
33 }
34 function initCopyButtonById(idButton,idTarget,cchLength){
 
35 var elButton = document.getElementById(idButton);
36 if( elButton ) initCopyButton(elButton,idTarget,cchLength);
37 return elButton;
38 }
39 function initCopyButton(elButton,idTarget,cchLength){
40
--- src/copybtn.js
+++ src/copybtn.js
@@ -30,10 +30,11 @@
30 elButton.id = "copy-" + idTarget;
31 initCopyButton(elButton,idTarget,cchLength);
32 return elButton;
33 }
34 function initCopyButtonById(idButton,idTarget,cchLength){
35 idButton = idButton || "copy-" + idTarget;
36 var elButton = document.getElementById(idButton);
37 if( elButton ) initCopyButton(elButton,idTarget,cchLength);
38 return elButton;
39 }
40 function initCopyButton(elButton,idTarget,cchLength){
41

Keyboard Shortcuts

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