Fossil

Check-in [0904aa8b]
Login

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

Overview
Comment:Update the copyTextToClipboard() javascript routine to work better cross-platform.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0904aa8b10fb9fb939f8e1f254edc8ee3d769f946393cc65944d38c4da4beb6e
User & Date: drh 2019-06-13 09:00:30
Context
2019-06-13
10:15
Per forum discussion, the "touch" command now defaults to --now (the current timestamp) unless --checkin is used, which applies the timestamp of the most recent checkin in which each file was modified. check-in: c3b48561 user: stephan tags: trunk
09:00
Update the copyTextToClipboard() javascript routine to work better cross-platform. check-in: 0904aa8b user: drh tags: trunk
08:58
Add the --setmtime option to the "checkout" and "open" commands. Add a new "touch" command that does nothing but run --setmtime on all named files. check-in: a7e86f5b 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
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);
    }
  }
}