Fossil

Check-in [698245db]
Login

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

Overview
Comment:Cherry-pick [6a54cf2939]: Trim leading and trailing white space from the text to be copied to clipboard (do this in Javascript, so no need to care about the extra white space when generating HTML elements).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | copybtn.js-demonstration
Files: files | file ages | folders
SHA3-256: 698245db8d9f2837d41e1067fa23fa55e24744427024bbc6f126db2b1a1c5e0b
User & Date: florian 2019-06-02 12:36:00
Context
2019-06-03
09:08
Remove unnecessary white space between the copy button and the branch name. check-in: b5bbad23 user: florian tags: copybtn.js-demonstration
2019-06-02
12:36
Cherry-pick [6a54cf2939]: Trim leading and trailing white space from the text to be copied to clipboard (do this in Javascript, so no need to care about the extra white space when generating HTML elements). check-in: 698245db user: florian tags: copybtn.js-demonstration
12:32
Trim leading and trailing white space from the text to be copied to clipboard (do this in Javascript, so no need to care about the extra white space when generating HTML elements). check-in: 6a54cf29 user: florian tags: tooltip-copyhash
12:03
Add a copy button for the artifact hash on the /artifact page. check-in: 3aab0bfd user: florian tags: copybtn.js-demonstration
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/copybtn.js.

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  if( lockCopyText ) return;
  lockCopyText = true;
  this.style.transition = "opacity 400ms ease-in-out";
  this.style.opacity = 0;
  var idTarget = this.getAttribute("data-copytarget");
  var elTarget = document.getElementById(idTarget);
  if( elTarget ){
    var text = elTarget.innerText;
    var cchLength = parseInt(this.getAttribute("data-copylength"));
    if( !isNaN(cchLength) && cchLength>0 ){
      text = text.slice(0,cchLength);   // Assume single-byte chars.
    }
    copyTextToClipboard(text);
  }
  setTimeout(function(id){







|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  if( lockCopyText ) return;
  lockCopyText = true;
  this.style.transition = "opacity 400ms ease-in-out";
  this.style.opacity = 0;
  var idTarget = this.getAttribute("data-copytarget");
  var elTarget = document.getElementById(idTarget);
  if( elTarget ){
    var text = elTarget.innerText.replace(/^\s+|\s+$/g,'');
    var cchLength = parseInt(this.getAttribute("data-copylength"));
    if( !isNaN(cchLength) && cchLength>0 ){
      text = text.slice(0,cchLength);   // Assume single-byte chars.
    }
    copyTextToClipboard(text);
  }
  setTimeout(function(id){