awsmug/torro-forms

View on GitHub
assets/dist/js/clipboard.min.js

Summary

Maintainability
A
0 mins
Test Coverage
/*!
 * Torro Forms Version 1.0.8 (https://torro-forms.com)
 * Licensed under GNU General Public License v2 (or later) (http://www.gnu.org/licenses/gpl-2.0.html)
 */
!function(){"use strict";function e(e){var t=e.srcElement;t.select()}function t(e){var t,o,c;if(t=e.target||e.srcElement,"BUTTON"!==t.tagName.toUpperCase()&&(t=t.parentNode),o=document.querySelector(t.dataset.clipboardTarget)){o.select();try{document.execCommand("copy")}catch(e){console.warn("Could not copy content from "+t.dataset.clipboardTarget+" to clipboard.")}c=window.getSelection?window.getSelection():document.selection,c&&(c.removeAllRanges?c.removeAllRanges():c.empty&&c.empty())}}var o,c,n,a;for(n=document.getElementsByClassName("clipboard-field"),a=0;a<n.length;a++)n[a].addEventListener("focus",e);try{o=document.queryCommandSupported("copy")}catch(e){return}if(o)for(document.body.className=document.body.className.replace("no-clipboard","clipboard"),c=document.getElementsByClassName("clipboard-button"),a=0;a<c.length;a++)c[a].addEventListener("click",t)}();