代码拉取完成,页面将自动刷新
同步操作将从 OneCoder/End Admin 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>复制插件</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="res/public/highlight/zenburn.css">
</head>
<body>
<!-- 面包屑导航 -->
<ol class="breadcrumb tool_margin_bottom_0 tool_border_radius_0 tool_border_bottom_style">
<li>
<a href="/">首页</a>
</li>
<li class="active">复制插件 Zero Clipboard</li>
</ol>
<div class="page_content">
<div class="page-header">
<h1>
复制插件
<small>zeroClipboard.html</small>
</h1>
</div>
<div id="alertDanger" class="alert alert-danger" style="display:none;" role="alert">复制插件必须在服务器端运行,本地运行无效。</div>
<h2>示例</h2>
<div class="col-sm-5">
<textarea class="form-control" rows="3" id="txtCopy" placeholder="输入要复制的文本"></textarea>
</div>
<div class="col-sm-2">
<button id="copy-button" class="btn btn-primary">Copy</button>
</div>
<div class="col-sm-5">
<div class="well" style="height:100px; overflow:auto;" id="copyShow">
</div>
</div>
<h2>使用</h2>
<div class="highlight">
<span class="btn_copy">复制</span>
<pre><code class="javascript hljs ">
seajs.use([<span class="hljs-string">'zeroClipboard'</span>], <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(zero)</span></span>{
<span class="hljs-keyword">var</span> client = <span class="hljs-keyword">new</span> ZeroClipboard( <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"copy-button"</span>) ); <span class="hljs-comment">//copy-button是复制按钮的id</span>
client.on(<span class="hljs-string">"ready"</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(readyEvent)</span></span>{ <span class="hljs-comment">//加载事件</span>
client.on( <span class="hljs-string">"copy"</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">( event )</span> </span>{ <span class="hljs-comment">//点击按钮事件</span>
ZeroClipboard.setData({
<span class="hljs-string">'text/plain'</span>: $(<span class="hljs-string">"#txtCopy"</span>).val() <span class="hljs-comment">//动态设置要复制的内容</span>
});
});
client.on(<span class="hljs-string">"aftercopy"</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(event)</span></span>{ <span class="hljs-comment">//点击按钮之后 触发 事件</span>
$(<span class="hljs-string">"#copyShow"</span>).append(event.data[<span class="hljs-string">"text/plain"</span>]+<span class="hljs-string">"<br/>"</span>); <span class="hljs-comment">//event.data["text/plain"] 获取该格式的内容</span>
});
});
});
</code></pre>
</div>
</div>
<script>
if(window.location.protocol === "file:"){
$("#alertDanger").show(); //本地打开此页面给予不支持的提示
}
seajs.use(['zeroClipboard', 'endCopy'], function(zero, endCopy){
var client = new zero( document.getElementById("copy-button") ); //copy-button是复制按钮的id
client.on("ready", function(readyEvent){ //加载事件
client.on( "copy", function( event ) { //点击按钮事件
zero.setData({
'text/plain': $("#txtCopy").val() //动态设置要复制的内容
});
});
client.on("aftercopy", function(event){ //点击按钮之后 触发 事件
$("#copyShow").append(event.data["text/plain"]+"<br/>"); //event.data["text/plain"] 获取该格式的内容
});
});
//统一初始化 代码复制
endCopy.init({btn:'span.btn_copy'});
});
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。