### WARNING
**This `master` branch contains the `v2.x` codebase for ZeroClipboard! For the `v1.x` codebase, see the [`1.x-master`](https://github.com/zeroclipboard/zeroclipboard/tree/1.x-master) branch instead.**
# ZeroClipboard
[![GitHub Latest Release](https://badge.fury.io/gh/zeroclipboard%2Fzeroclipboard.svg)](https://github.com/zeroclipboard/zeroclipboard) [![Build Status](https://secure.travis-ci.org/zeroclipboard/zeroclipboard.svg?branch=master)](https://travis-ci.org/zeroclipboard/zeroclipboard) [![Coverage Status](https://coveralls.io/repos/zeroclipboard/zeroclipboard/badge.svg?branch=master)](https://coveralls.io/r/zeroclipboard/zeroclipboard?branch=master) [![Dependency Status](https://david-dm.org/zeroclipboard/zeroclipboard.svg?theme=shields.io)](https://david-dm.org/zeroclipboard/zeroclipboard) [![Dev Dependency Status](https://david-dm.org/zeroclipboard/zeroclipboard/dev-status.svg?theme=shields.io)](https://david-dm.org/zeroclipboard/zeroclipboard#info=devDependencies)
The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible [Adobe Flash](http://en.wikipedia.org/wiki/Adobe_Flash) movie and a [JavaScript](http://en.wikipedia.org/wiki/JavaScript) interface. The "Zero" signifies that the library is invisible and the user interface is left entirely up to you.
This is achieved by automatically floating the invisible movie on top of a [DOM](http://en.wikipedia.org/wiki/Document_Object_Model) element of your choice. Standard mouse events are even propagated out to your DOM element, so you can still have rollover and mousedown effects.
Suggestions welcome read over the [contributing](/CONTRIBUTING.md) guidelines.
## Setup
To setup the project for local development start with these commands in your terminal.
```sh
$ git clone https://github.com/zeroclipboard/zeroclipboard.git
$ cd zeroclipboard/
$ npm install -g grunt-cli
$ npm install
$ grunt
```
## Development
Before submitting a pull request you'll need to validate, build, and test your code. Run the default grunt task in your terminal.
```sh
$ grunt
```
## Testing
If you just want to run the tests, run grunt test.
```sh
$ grunt test
```
## Limitations
### User Interaction Required
Due to browser and Flash security restrictions, this clipboard injection can _**ONLY**_ occur when
the user clicks on the invisible Flash movie. A simulated `click` event from JavaScript will not
suffice as this would enable [clipboard poisoning](http://www.computerworld.com/s/article/9117268/Adobe_patches_Flash_clickjacking_and_clipboard_poisoning_bugs).
### Other Limitations
For a complete list of limitations, see [docs/instructions.md#limitations](docs/instructions.md#limitations).
On that page, you will also find an [explanation of why ZeroClipboard will _NOT_ work by default on code playground sites](docs/instructions.md#starter-snippets-for-playground-sites) like JSFiddle, JSBin, and CodePen, as well as the appropriate "View" URLs to use on those sites in order to allow ZeroClipboard to work.
## Simple Example
```html
<html>
<body>
<button id="copy-button" data-clipboard-text="Copy Me!" title="Click to copy me.">Copy to Clipboard</button>
<script src="ZeroClipboard.js"></script>
<script src="main.js"></script>
</body>
</html>
```
```js
// main.js
var client = new ZeroClipboard( document.getElementById("copy-button") );
client.on( "ready", function( readyEvent ) {
// alert( "ZeroClipboard SWF is ready!" );
client.on( "aftercopy", function( event ) {
// `this` === `client`
// `event.target` === the element that was clicked
event.target.style.display = "none";
alert("Copied text to clipboard: " + event.data["text/plain"] );
} );
} );
```
See [docs/instructions.md](docs/instructions.md) for more advanced options in using the library on your site.
See [docs/api/ZeroClipboard.md](docs/api/ZeroClipboard.md) for the complete API documentation.
Here is a working [test page](http://zeroclipboard.org/#demo) where you can try out ZeroClipboard in your browser.
## Testing ZeroClipboard Locally
To test the page [demo page](http://zeroclipboard.org/#demo) locally, clone the [website repo](https://github.com/zeroclipboard/zeroclipboard.org).
## Support
This library is fully compatible with Flash Player 11.0.0 and above, which requires
that the clipboard copy operation be initiated by a user click event inside the
Flash movie. This is achieved by automatically floating the invisible movie on top
of a [DOM](http://en.wikipedia.org/wiki/Document_Object_Model) element of your
choice. Standard mouse events are even propagated out to your DOM element, so you
can still have rollover and mousedown effects with just a _little_ extra effort.
ZeroClipboard `v2.x` is expected to work in IE9+ and all of the evergreen browsers.
Although support for IE7 & IE8 was officially dropped in `v2.0.0`, it was actually
still _technically_ supported through `v2.0.2`.
## Releases
Starting with version [1.1.7](https://github.com/zeroclipboard/zeroclipboard/releases/tag/v1.1.7), ZeroClipboard uses [semantic versioning](http://semver.org/).
see [releases](https://github.com/zeroclipboard/zeroclipboard/releases)
## Related
* [jquery.zeroclipboard](https://github.com/zeroclipboard/jquery.zeroclipboard)
* [zeroclipboard-rails](https://github.com/zeroclipboard/zeroclipboard-rails)
## License
MIT © [James M. Greene](http://greene.io/) [Jon Rohan](http://jonrohan.codes)
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
思途旅游cms破解版V6.0手机端模块app_mobilelbsV5.0等老版本通用 (126个子文件)
JsProxy.as 13KB
ZeroClipboard.as 13KB
ClipboardInjector.as 7KB
XssUtils.as 3KB
map.css 1KB
base.css 1KB
.gitignore 92B
.htaccess 556B
api.tests.js.html 4KB
api.tests.js.html 4KB
ZeroClipboard.tests.js.html 3KB
private.tests.js.html 2KB
private.tests.js.html 2KB
ZeroClipboard.Core.tests.js.html 1KB
index.html 962B
private.tests.js.html 866B
fenxiao.iml 281B
installer.ini 69B
sm.min.js 107KB
jquery.min.js 91KB
ZeroClipboard.js 84KB
ZeroClipboard.Core.js 67KB
private.js 57KB
api.tests.js 46KB
private.tests.js 35KB
ZeroClipboard.min.js 30KB
zepto.min.js 25KB
ZeroClipboard.Core.min.js 24KB
private.tests.js 20KB
api.tests.js 19KB
private.js 14KB
Gruntfile.js 10KB
ZeroClipboard.tests.js 10KB
private.js 8KB
state.js 7KB
api.js 5KB
api.js 5KB
ZeroClipboard.Core.tests.js 2KB
private.tests.js 2KB
common.js 2KB
state.js 2KB
state.js 1KB
end.js 538B
start.js 47B
.jshintrc 1KB
.jshintrc 1KB
.jshintrc 1KB
package.json 2KB
composer.json 1KB
bower.json 958B
component.json 768B
LICENSE 1KB
ZeroClipboard.min.map 128KB
ZeroClipboard.Core.min.map 101KB
instructions.md 33KB
ZeroClipboard.md 32KB
ZeroClipboard.Core.md 28KB
README.md 5KB
CONTRIBUTING.md 4KB
security.md 2KB
roadmap.md 782B
.name 7B
.npmignore 21B
03.php 84KB
04.php 80KB
10.php 72KB
08.php 68KB
07.php 46KB
09.php 35KB
view.php 21KB
28.php 13KB
11.php 8KB
mapnear.php 6KB
mapnear.php 6KB
bootstrap.php 5KB
map.php 4KB
map.php 4KB
index.php 4KB
common.php 3KB
base.php 3KB
tool.php 2KB
spot.php 2KB
hotel.php 2KB
controller.php 2KB
st.php 1KB
validation.php 1KB
17.php 777B
spot.php 553B
hotel.php 465B
ch.php 337B
database.php 140B
version.php 135B
cache.php 134B
rate.php 114B
currency.php 109B
st_user_ico.png 27KB
map_near.png 3KB
map_go.png 2KB
map_10.png 2KB
map_8.png 2KB
共 126 条
- 1
- 2
资源评论
- sasab2016-10-14看一看,谢谢分享
- atpatheric2016-10-15TMD,骗子,根本没有程序
产品经理人
- 粉丝: 35
- 资源: 22
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功