Fossil

Check-in [ba3e6fe7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update the copyTextToClipboard() Javascript function to suppress scrolling, and remove the temporary textarea in case of an error (i.e. blocked clipboard access), as suggested here: https://fossil-scm.org/forum/forumpost/40189d7d2f.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | copybtn.js-tweaks
Files: files | file ages | folders
SHA3-256: ba3e6fe7385867459ffc3344511ac1581c3e01f292c535794eb793d943ca1d89
User & Date: florian 2019-06-13 07:49:00
Context
2019-06-13
09:00
Update the copyTextToClipboard() javascript routine to work better cross-platform. check-in: 0904aa8b user: drh tags: trunk
07:49
Update the copyTextToClipboard() Javascript function to suppress scrolling, and remove the temporary textarea in case of an error (i.e. blocked clipboard access), as suggested here: https://fossil-scm.org/forum/forumpost/40189d7d2f. Closed-Leaf check-in: ba3e6fe7 user: florian tags: copybtn.js-tweaks
06:15
Documented the --setmtime flag to the update command. check-in: 34fcaf82 user: stephan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/copybtn.js.

77
78
79
80
81
82
83



84
85
86
87
88
89
90
91
92

93
94


      elButton.style.opacity = 1;
    }
    lockCopyText = false;
  }.bind(null,this.id),400);
}
/* Create a temporary <textarea> element and copy the contents to clipboard. */
function copyTextToClipboard(text){



  var x = document.createElement("textarea");
  x.style.position = 'absolute';
  x.style.left = '-9999px';
  x.value = text;
  document.body.appendChild(x);
  x.select();
  try{
    document.execCommand('copy');
  }catch(err){}

  document.body.removeChild(x);
}









>
>
>
|
|
<
|
|
|
|
|
|
>
|
|
>
>
77
78
79
80
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
99
      elButton.style.opacity = 1;
    }
    lockCopyText = false;
  }.bind(null,this.id),400);
}
/* Create a temporary <textarea> element and copy the contents to clipboard. */
function copyTextToClipboard(text){
  if( window.clipboardData && window.clipboardData.setData ){
    clipboardData.setData('Text',text);
  }else{
    var x = document.createElement("textarea");
    x.style.position = 'fixed';

    x.value = text;
    document.body.appendChild(x);
    x.select();
    try{
      document.execCommand('copy');
    }catch(err){
    }finally{
      document.body.removeChild(x);
    }
  }
}