UNPKG

xe-command

Version:

Using JavaScript copy the text to the clipboard,Support IE、Chrome、Firefox、Opera、Safari、IOS、Android.

7 lines 833 B
/** * xe-command.js v1.1.3 * (c) 2017-2018 Xu Liangzhan * ISC License. * @preserve */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.XECommand=t()}(this,function(){"use strict";function n(){}return n.copy=function(e){var t,n=((t=document.getElementById("$XECopy"))||((t=document.createElement("input")).id="$XECopy",t.style.width="48px",t.style.height="12px",t.style.position="absolute",t.style["z-index"]="0",t.style.left="-500px",t.style.top="-500px",document.body.appendChild(t)),t),o=e||"";try{return n.value=o,n.focus(),n.setSelectionRange(0,o.length),document.execCommand("copy",!0)}catch(e){return!1}},n.mixin=function(e){!function(e,t,n){for(var o in e)e.hasOwnProperty(o)&&t.call(n||this,e[o],o,e)}(e,function(e,t){n[t]=e})},n});