mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Renames JS files and changes clipboard selector #68
This commit is contained in:
parent
9bf6bf6136
commit
91d9064f75
@ -1,6 +1,6 @@
|
||||
var clipboard = new Clipboard('.btn');
|
||||
var clipboardDemos = new Clipboard('[data-clipboard-demo]');
|
||||
|
||||
clipboard.on('success', function(e) {
|
||||
clipboardDemos.on('success', function(e) {
|
||||
e.clearSelection();
|
||||
|
||||
console.info('Action:', e.action);
|
||||
@ -10,7 +10,7 @@ clipboard.on('success', function(e) {
|
||||
showTooltip(e.trigger, 'Copied!');
|
||||
});
|
||||
|
||||
clipboard.on('error', function(e) {
|
||||
clipboardDemos.on('error', function(e) {
|
||||
console.error('Action:', e.action);
|
||||
console.error('Trigger:', e.trigger);
|
||||
|
@ -8,7 +8,7 @@ for (var i = 0; i < btns.length; i++) {
|
||||
}
|
||||
|
||||
function showTooltip(elem, msg) {
|
||||
elem.setAttribute('class', elem.className.indexOf('clip') === -1 ? 'btn tooltipped tooltipped-s': 'btn clip tooltipped tooltipped-s');
|
||||
elem.setAttribute('class', 'btn tooltipped tooltipped-s');
|
||||
elem.setAttribute('aria-label', msg);
|
||||
}
|
||||
|
10
index.html
10
index.html
@ -80,7 +80,7 @@ allowtransparency="true" frameborder="0" scrolling="0" width="156" height="30"><
|
||||
<div class="input-group">
|
||||
<input id="foo" type="text" value="https://github.com/zenorocha/clipboard.js.git">
|
||||
<span class="input-group-button">
|
||||
<button class="btn" type="button" data-clipboard-target="#foo">
|
||||
<button class="btn" type="button" data-clipboard-demo data-clipboard-target="#foo">
|
||||
<img class="clippy" src="assets/images/clippy.svg" width="13" alt="Copy to clipboard">
|
||||
</button>
|
||||
</span>
|
||||
@ -105,7 +105,7 @@ allowtransparency="true" frameborder="0" scrolling="0" width="156" height="30"><
|
||||
<textarea id="bar" cols="62" rows="5" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">Mussum ipsum cacilds, vidis litro abertis. Consetis adipiscings elitis. Pra lá , depois divoltis porris, paradis. Paisis, filhis, espiritis santis. Mé faiz elementum girarzis, nisi eros vermeio, in elementis mé pra quem é amistosis quis leo. Manduma pindureta quium dia nois paga.</textarea>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button class="btn" type="button" data-clipboard-action="cut" data-clipboard-target="#bar">
|
||||
<button class="btn" type="button" data-clipboard-demo data-clipboard-action="cut" data-clipboard-target="#bar">
|
||||
Cut to clipboard
|
||||
</button>
|
||||
</div>
|
||||
@ -126,7 +126,7 @@ allowtransparency="true" frameborder="0" scrolling="0" width="156" height="30"><
|
||||
<p>Truth is, you don't even need another element to copy its content from. You can just include a <code>data-clipboard-text</code> attribute in your trigger element.</p>
|
||||
|
||||
<div id="example-text" class="example">
|
||||
<button class="btn" data-clipboard-action="copy" data-clipboard-text="Just because you can doesn't mean you should — clipboard.js">Copy to clipboard</button>
|
||||
<button class="btn" data-clipboard-demo data-clipboard-action="copy" data-clipboard-text="Just because you can doesn't mean you should — clipboard.js">Copy to clipboard</button>
|
||||
</div>
|
||||
|
||||
<pre class="snippet"><code class="html"><!-- Trigger -->
|
||||
@ -224,9 +224,9 @@ clipboard.destroy();</code></pre>
|
||||
<script src="bower_components/highlightjs/highlight.pack.min.js"></script>
|
||||
<script src="dist/clipboard.min.js"></script>
|
||||
|
||||
<script src="assets/scripts/clipboard.js"></script>
|
||||
<script src="assets/scripts/main.js"></script>
|
||||
<script src="assets/scripts/demos.js"></script>
|
||||
<script src="assets/scripts/snippets.js"></script>
|
||||
<script src="assets/scripts/tooltips.js"></script>
|
||||
|
||||
<!-- Google Analytics -->
|
||||
<script>
|
||||
|
Loading…
Reference in New Issue
Block a user