var client = new WebTorrent({
rtcConfig: { iceServers:
[{url: "stun:23.21.150.121"},
{url: "stun:stun.1.google.com:19302"}]
}
});
function init_start(){
//upload
var dropZone = document.body;
//Optional. Show the copy icon when dragging over. Seems to only work for chrome.
dropZone.addEventListener('dragover', function(e) {
e.stopPropagation();
e.preventDefault();
e.dataTransfer.dropEffect = 'copy';
});
// Get file data on drop
dropZone.addEventListener('drop', function(e) {
e.stopPropagation();
e.preventDefault();
var files = e.dataTransfer.files; // Array of all files
slingit_upload(client,files);
});
//download
$('#btn_load_infohash').click(function(e){
e.preventDefault();
slingit_download(client,$('#input_load_infohash').val());});
//start download if hash provided
if($('#input_load_infohash').val() != ''){
slingit_download(client,$('#input_load_infohash').val());}
}
function handleFileSelect(evt) {
var files = evt.target.files; // FileList object
// files is a FileList of File objects. List some properties.
var output = [];
for (var i = 0, f; f = files[i]; i++) {
output.push('