Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
fix(clipboard): replaced zero clipboard to clipboard.js to get rid of…
Browse files Browse the repository at this point in the history
… flash.

Closes #12
  • Loading branch information
arnaudruffin committed Dec 14, 2016
1 parent 0016f59 commit 7306573
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ app.use(express.static(path.join(__dirname, path.join('node_modules', 'tether',
app.use(express.static(path.join(__dirname, path.join('node_modules', 'boosted', 'dist'))));
app.use(express.static(path.join(__dirname, path.join('node_modules', 'jquery', 'dist','cdn'))));
app.use(express.static(path.join(__dirname, path.join('node_modules', 'jquery-file-download', 'src','Scripts'))));
app.use(express.static(path.join(__dirname, path.join('node_modules', 'zeroclipboard', 'dist'))));
app.use(express.static(path.join(__dirname, path.join('node_modules', 'clipboard', 'dist'))));

var receiveUriPath = '/receive';
app.use('/', send);
Expand Down
17 changes: 6 additions & 11 deletions client/jdropit-send.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,13 @@ function sendFile(isLocal) {
var senderHandler = new SenderHandler(isLocal);

$("#clipboardcopyok").hide();
//____ Handling of copy to clipboard with zeroClipboard
var clip = new ZeroClipboard(document.getElementById("copy-button"));
clip.on("ready", function () {
clip.on("copy", function (event) {
var clipboard = event.clipboardData;
clipboard.setData("text/plain", 'http://' + senderHandler.receiverUrl);
});
clip.on("aftercopy", function () {
$("#clipboardcopyok").show(300);
});
});

var clipboard = new Clipboard('#copy-button');
clipboard.on('success', function(e) {
console.info('Copied to clipboard:', e.text);
$("#clipboardcopyok").show(300);
e.clearSelection();
});

var dropZone = $('#drop-zone');
//----- Handling drag and drop zone style
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"uglify-js" : "~2.4.23",
"boosted" : "~4.0.0-alpha.4",
"tether" : "~1.1.1",
"zeroclipboard" : "~2.2.0",
"clipboard" : "~1.5.16",
"jquery" : "1.11.2",
"jquery-file-download" : "1.4.5"

Expand Down
6 changes: 3 additions & 3 deletions views/send.jade
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ block extra_scripts
script(src="/js/HackTimer.js")
script(src="/js/HackTimerWorker.js")
script(src="/js/socket.io-stream.js")
script(src="/ZeroClipboard.js")
script(src="/clipboard.js")
script(src="/js/jdropit-send.js")
else
script(src="/js/HackTimer.silent.min.js")
script(src="/js/HackTimerWorker.min.js")
script(src="/js/socket.io-stream.min.js")
script(src="/ZeroClipboard.min.js")
script(src="/clipboard.min.js")
script(src="/js/jdropit-send.min.js")
script.

Expand Down Expand Up @@ -72,7 +72,7 @@ block content
p.lead Tell your friend to go to this url:
p.text-muted.text-xs-center.lead#generatedurl
span.text-success.pull-xs-right.icon-checkbox-tick#clipboardcopyok(aria-hidden="true")
button.btn.btn-orange.pull-xs-right#copy-button(title="Click to copy url to clipboard") Copy to clipboard
button.btn.btn-orange.pull-xs-right#copy-button(title="Click to copy url to clipboard",data-clipboard-target="#generatedurl") Copy to clipboard
div#transferContainer(style="display: none;")
div.row.top-buffer
div.col-xs-12
Expand Down
8 changes: 4 additions & 4 deletions views/thirdparties.jade
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ block modal_body
a(href="https://github.com/socketio/nkzawa/socket.io-stream/blob/master/LICENSE") MIT license

h4
a(href="http://zeroclipboard.org/") ZeroClipboard
p Copyright (c) 2009-2014 Jon Rohan, James M. Greene
a(href="https://clipboardjs.com/") clipboard.js
p Copyright (c) 2016 Zeno Rocha
br
| ZeroClipboard is distributed under the terms and conditions of the  
| clipboard.js is distributed under the terms and conditions of the  
i
a(href="https://github.com/zeroclipboard/zeroclipboard/blob/master/LICENSE") MIT License
a(href="https://zenorocha.mit-license.org/") MIT License
h4
a(href="http://jquery.com") jQuery JavaScript Library
p Includes 
Expand Down

0 comments on commit 7306573

Please sign in to comment.