diff --git a/LICENSE b/LICENSE index 4617ead..c7d0faf 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018 Guilherme Nascimento +Copyright (c) 2021 Guilherme Nascimento Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/README.html b/README.html index 47ddbc1..9e47bf5 100644 --- a/README.html +++ b/README.html @@ -1063,7 +1063,7 @@
Or use CDN:
-<script src="https://cdn.jsdelivr.net/npm/simple-copy.js@0.4/simple-copy.min.js"></script> +<script src="https://cdn.jsdelivr.net/npm/simple-copy.js@0.5/simple-copy.min.js"></script>Import:
diff --git a/README.md b/README.md index 505c343..e151b30 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Include lib Or use CDN: ```html - + ``` Import: diff --git a/package.json b/package.json index af19b40..4daafd4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-copy.js", - "version": "0.5.1", + "version": "0.5.2", "description": "Copy DOM, textarea or fields values to clipboard, no Flash, only 2.3kB minified (1.14kB gzipped)", "main": "simple-copy.js", "scripts": { diff --git a/simple-copy.js b/simple-copy.js index 4dd6297..783b5f3 100644 --- a/simple-copy.js +++ b/simple-copy.js @@ -1,7 +1,7 @@ /* - * simple-copy.js 0.5.1 + * simple-copy.js 0.5.2 * - * Copyright (c) 2020 Guilherme Nascimento (brcontainer@yahoo.com.br) + * Copyright (c) 2021 Guilherme Nascimento (brcontainer@yahoo.com.br) * * Released under the MIT license */ @@ -173,9 +173,9 @@ target = d.querySelector(query); - if (!target) return false; - - copyElement(target, attr(el, "select"), attr(el, "text"), attr(el, "node"), attr(el, "multiple", true)); + if (target) { + copyElement(target, attr(el, "select"), attr(el, "text"), attr(el, "node"), attr(el, "multiple", true)); + } } } diff --git a/simple-copy.min.js b/simple-copy.min.js index 1f54422..829308c 100644 --- a/simple-copy.min.js +++ b/simple-copy.min.js @@ -1,2 +1,2 @@ -/* simple-copy.js 0.5.1 | Copyright (c) 2020 Guilherme Nascimento (brcontainer@yahoo.com.br) | Released under the MIT license */ -!function(e){var t="undefined"!=typeof window?window:{},n=t.document||{},o=t.jQuery,r=t.getSelection(),i=n.implementation.createHTMLDocument("").body,l="data-simplecopy-",c="script,noscript,object,link,img,[simple-copy-ignore=true]";function a(e){return"true"!==e.hasAttribute("simple-copy-ignore")&&!e.offsetWidth&&!e.offsetHeight&&!e.getClientRects().length}function u(t,o,l,u,f){if("string"==typeof t)try{t=n.querySelector(t)}catch(e){return!1}if(!t||1!==t.nodeType)return!1;var d="object"==typeof t.form;if(l&&!d)return function(t){for(var n=t.getElementsByTagName("*"),o=[],r=n.length-1;r>=0;r--)a(u=n[r])&&(u.setAttribute("simple-copy-ignore","true"),o.push(u));for(i.innerHTML=t.innerHTML,r=o.length-1;r>=0;r--)o[r].removeAttribute("simple-copy-ignore");o=e;var l=tmpDoc.querySelectorAll(c);for(r=l.length-1;r>=0;r--){var u;(u=l[r])&&u.parentNode&&u.parentNode.removeChild(u)}return p(i.textContent)}(t);var m=n.createRange(),y=!o&&!d,g=t.isContentEditable;if(r.removeAllRanges(),y&&(t.contentEditable=!u||"inherit"),d&&!u){if(o)return s(t);if("SELECT"===t.nodeName&&f){for(var v,h=0,b=[],C=t.options,x=C.length;h=0;r--)a(u=n[r])&&(u.setAttribute("simple-copy-ignore","true"),o.push(u));for(i.innerHTML=t.innerHTML,r=o.length-1;r>=0;r--)o[r].removeAttribute("simple-copy-ignore");o=e;var l=tmpDoc.querySelectorAll(c);for(r=l.length-1;r>=0;r--){var u;(u=l[r])&&u.parentNode&&u.parentNode.removeChild(u)}return p(i.textContent)}(t);var m=n.createRange(),y=!o&&!d,g=t.isContentEditable;if(r.removeAllRanges(),y&&(t.contentEditable=!u||"inherit"),d&&!u){if(o)return s(t);if("SELECT"===t.nodeName&&f){for(var v,h=0,b=[],C=t.options,x=C.length;h