UNPKG

@ylz/plugins

Version:

ylz plugins

3 lines (2 loc) 750 B
/* * Copyright © 2019-2019 chenwenbin * Released under the MIT License. */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).clipboard=t()}(this,(function(){"use strict";return{copy:function(e){var t=function(){var e=document.getElementById("$copy");return e||((e=document.createElement("input")).id="$copy",e.style.width="48px",e.style.height="12px",e.style.position="fixed",e.style["z-index"]="0",e.style.left="-500px",e.style.top="-500px",document.body.appendChild(e)),e}(),n=null==e?"":""+e;try{t.value=n,t.focus(),t.setSelectionRange(0,n.length);var o=document.execCommand("copy",!0);return document.body.removeChild(t),o}catch(e){}return!1}}}));