/*! * nanoclipboard v1.0.0 */ !function(){"use strict";var t=function(t){this.init(t)};t.prototype={constructor:t,init:function(t){this.clear();var e=document.querySelector(t),i=e.getAttribute("data-clipboard-text"),o=e.getAttribute("data-clipboard-selector");if(!i&&!o)throw new Error("text and selector are undefined");this._el=e,this._text=i,this._selector=o;var n=this;this._el.addEventListener("click",this._onClick=function(t){n._copy()})},clear:function(){this._el&&(this._el.removeEventListener("click",this._onClick),this._onClick=null),this._outsideEl&&(document.body.removeChild(this._outsideEl),this._outsideEl=null)},select:function(){var t=null;return t=this._selector?document.querySelector(this._selector):this._attachedOutsideEl(),t.select(),t.value},unselect:function(){this._outsideEl&&this._outsideEl.blur(),window.getSelection().removeAllRanges()},onSuccess:function(t){},onError:function(t){},_copy:function(){var t=this.select(),e=!1;try{e=document.execCommand("copy")}catch(i){e=!1}e?this.onSuccess(t):this.onError(t)},_attachedOutsideEl:function(){if(!this._outsideEl){var t=document.createElement("textarea");t.style.cssText="position:absolute;left:-9999px;top:-9999px;",t.value=this._text,document.body.appendChild(t),this._outsideEl=t}return this._outsideEl}},window.NanoClipboard=t}();