Sha256: 44e95431fa44c6e55b8107c728865efb23792ddff243e4c448ba09a95c399e76
Contents?: true
Size: 885 Bytes
Versions: 66
Compression:
Stored size: 885 Bytes
Contents
# # Enable copy capability to the machines copy/paste buffer # $(document).ready -> if clipboardEnabled() $('a.copy').on 'click', (e) -> node = e.target textField = document.createElement('textarea') node.parentNode.insertBefore(textField, node) try textField.innerText = $(this).data('clipboard-text') textField.select() textField.focus() if document.execCommand('copy') M.toast({html: 'Copied!'}, 3000); else M.toast({html: 'Unable to copy text'}, 3000); catch error M.toast({html: 'Unable to copy text'}, 3000); finally textField.parentNode.removeChild(textField) else $('.copy').hide() # # Test that we can issue the execCommand for copy and that it returns # clipboardEnabled = -> try document.execCommand('copy') true catch error false
Version data entries
66 entries across 66 versions & 1 rubygems