Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a 'Show QR Code' button #148

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var throttle = require('throttleit')
var thunky = require('thunky')
var uploadElement = require('upload-element')
var WebTorrent = require('webtorrent')
var kjua = require('kjua')

var util = require('./util')

Expand Down Expand Up @@ -181,9 +182,17 @@ function onTorrent (torrent) {
'Torrent info hash: ' + torrent.infoHash + ' ' +
'<a href="/#' + torrent.infoHash + '" onclick="prompt(\'Share this link with anyone you want to download this torrent:\', this.href);return false;">[Share link]</a> ' +
'<a href="' + torrent.magnetURI + '" target="_blank">[Magnet URI]</a> ' +
'<a href="' + torrent.torrentFileBlobURL + '" target="_blank" download="' + torrentFileName + '">[Download .torrent]</a>'
'<a href="' + torrent.torrentFileBlobURL + '" target="_blank" download="' + torrentFileName + '">[Download .torrent]</a>' +
'<a id="show-qr" href="#">[Show QR Code]</a>'
)

document.getElementById('show-qr').onclick = function (e) {
e.preventDefault()
this.outerHTML = '<br />' + kjua({
text: window.location.href + '#' + torrent.magnetURI
}).outerHTML
}

function updateSpeed () {
var progress = (100 * torrent.progress).toFixed(1)

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"downgrade": "^1.0.0",
"drag-drop": "^2.0.0",
"express": "^4.8.5",
"kjua": "0.1.2",
"moment": "^2.15.1",
"prettier-bytes": "^1.0.3",
"pug": "^2.0.0-beta11",
Expand Down