Skip to content

Commit

Permalink
update 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Mar 7, 2019
1 parent eb0a6e0 commit c52fe3f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
12 changes: 7 additions & 5 deletions dist/xe-clipboard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* xe-clipboard.js v1.0.1
* xe-clipboard.js v1.0.2
* (c) 2017-2018 Xu Liangzhan
* ISC License.
* @preserve
Expand All @@ -11,18 +11,20 @@
}(this, function () {
'use strict'

var doc = window.document

function getContainer () {
var $copy = document.getElementById('$XECopy')
var $copy = doc.getElementById('$XECopy')
if (!$copy) {
$copy = document.createElement('input')
$copy = doc.createElement('input')
$copy.id = '$XECopy'
$copy.style['width'] = '48px'
$copy.style['height'] = '12px'
$copy.style['position'] = 'absolute'
$copy.style['z-index'] = '0'
$copy.style['left'] = '-500px'
$copy.style['top'] = '-500px'
document.body.appendChild($copy)
doc.body.appendChild($copy)
}
return $copy
}
Expand All @@ -39,7 +41,7 @@
$copy.value = value
$copy.focus()
$copy.setSelectionRange(0, value.length)
return document.execCommand('copy', true)
return doc.execCommand('copy', true)
} catch (e) { }
return false
}
Expand Down
4 changes: 2 additions & 2 deletions dist/xe-clipboard.min.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* xe-clipboard.js v1.0.1
* xe-clipboard.js v1.0.2
* (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.XEClipboard=t()}(this,function(){"use strict";function e(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=null==e?"":""+e;try{return n.value=o,n.focus(),n.setSelectionRange(0,o.length),document.execCommand("copy",!0)}catch(e){}return!1}return e.copy=e});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.XEClipboard=t()}(this,function(){"use strict";var i=window.document;function e(e){var t,n=((t=i.getElementById("$XECopy"))||((t=i.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",i.body.appendChild(t)),t),o=null==e?"":""+e;try{return n.value=o,n.focus(),n.setSelectionRange(0,o.length),i.execCommand("copy",!0)}catch(e){}return!1}return e.copy=e});
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
'use strict'

var doc = window.document

function getContainer () {
var $copy = document.getElementById('$XECopy')
var $copy = doc.getElementById('$XECopy')
if (!$copy) {
$copy = document.createElement('input')
$copy = doc.createElement('input')
$copy.id = '$XECopy'
$copy.style['width'] = '48px'
$copy.style['height'] = '12px'
$copy.style['position'] = 'absolute'
$copy.style['z-index'] = '0'
$copy.style['left'] = '-500px'
$copy.style['top'] = '-500px'
document.body.appendChild($copy)
doc.body.appendChild($copy)
}
return $copy
}
Expand All @@ -28,7 +30,7 @@ function XEClipboard (content) {
$copy.value = value
$copy.focus()
$copy.setSelectionRange(0, value.length)
return document.execCommand('copy', true)
return doc.execCommand('copy', true)
} catch (e) {}
return false
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xe-clipboard",
"version": "1.0.1",
"version": "1.0.2",
"description": "Copy the contents to the clipboard, support commonly used H5 browser IE, Chrome, Firefox, Opera, Safari, IOS, Android.",
"main": "index.js",
"unpkg": "dist/xe-clipboard.js",
Expand Down

0 comments on commit c52fe3f

Please sign in to comment.