Last active
August 29, 2015 14:11
-
-
Save uadev/f05e4c0f8f32529f4ff3 to your computer and use it in GitHub Desktop.
Github create a Release Notes copy Button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @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