fix drag n drop bug

This commit is contained in:
pg 2015-10-10 03:59:36 +02:00
parent 836711dd69
commit 2a50c2b180
6 changed files with 41 additions and 6 deletions

View File

@ -5,14 +5,14 @@ html(lang="en")
link(rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css')
link(rel='stylesheet prefetch' href='http://cdn.foundation5.zurb.com/foundation.css')
link(rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.9/css/dataTables.foundation.css')
link(rel="stylesheet" href="css/style.css")
link(rel="stylesheet" href="../css/style.css")
script(src='http://code.jquery.com/jquery-1.11.3.min.js' onload="window.$ = window.jQuery = module.exports;")
script(src='http://cdn.foundation5.zurb.com/foundation.js')
script(src='http://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js')
script(src='https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.9/js/jquery.dataTables.min.js')
script(src='js/index.js')
script(src='../js/index.js')
include ./mixing.jade
include ./page.jade

View File

@ -42,7 +42,7 @@ body
#panel2-3.content
p Third panel content goes here...
#panel2-4.content
p Fourth panel content goes here...
#dragdrop Drag file here

View File

@ -40,7 +40,22 @@ var dataSet = [
//$(document).foundation();
$(document).ready(function(){
document.addEventListener('dragover',function(event){
event.preventDefault();
return false;
},false);
document.addEventListener('drop',function(event){
event.preventDefault();
return false;
},false);
$('#a_report').click( function() {
$(".menu a").removeClass('active');
$('#a_report').addClass("active");
@ -70,6 +85,19 @@ $('#a_msg').click( function() {
$("#panel2-4").addClass("active");
})
var holder = document.getElementById('dragdrop');
holder.ondragover = function () {
return false;
};
holder.ondragleave = holder.ondragend = function () {
return false;
};
holder.ondrop = function (e) {
e.preventDefault();
var file = e.dataTransfer.files[0];
console.log('File you dragged here is', file.path);
return false;
};
var line_plot = function (elt, data){

View File

@ -3,6 +3,10 @@ var locals = {/* ...*/};
var j = require('electron-jade')({pretty: true}, locals);
var BrowserWindow = require('browser-window'); // Module to create native browser window.
var WebTorrent = require('webtorrent')
var TorrentClient = new WebTorrent()
// Report crashes to our server.
require('crash-reporter').start();
@ -26,10 +30,10 @@ app.on('ready', function() {
mainWindow = new BrowserWindow({width: 1024, height: 768});
// and load the index.html of the app.
mainWindow.loadUrl('file://' + __dirname + '/index.jade');
mainWindow.loadUrl('file://' + __dirname + '/jade/index.jade');
// Open the DevTools.
// mainWindow.openDevTools();
mainWindow.openDevTools();
// Emitted when the window is closed.
mainWindow.on('closed', function() {
@ -39,3 +43,4 @@ app.on('ready', function() {
mainWindow = null;
});
});

View File

@ -3,8 +3,10 @@
"version": "0.1.0",
"main": "main.js",
"dependencies": {
"drag-drop": "^2.3.0",
"electron-jade": "^1.2.2",
"jade": "^1.11.0",
"jquery": "^2.1.4"
"jquery": "^2.1.4",
"webtorrent": "^0.62.2"
}
}