Skip to content

Instantly share code, notes, and snippets.

@uadev
Last active August 29, 2015 14:11
Show Gist options
  • Save uadev/f05e4c0f8f32529f4ff3 to your computer and use it in GitHub Desktop.
Save uadev/f05e4c0f8f32529f4ff3 to your computer and use it in GitHub Desktop.
Github create a Release Notes copy Button
/** @global ZeroClipboard **/
function addTab(text) {
var li = document.createElement('li');
li.classList.add('tabnav-tab');
li.innerText = 'Copy Notes';
li.style.cursor = 'pointer';
var c = new ZeroClipboard(li);
c.on('copy', function(e) {
e.clipboardData.setData('text/plain', text);
li.innerHTML = 'Notes <small><b>(copied)<b></small>';
})
document.querySelector('.tabnav-tabs').appendChild(li);
};
addTab('Hey!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment