Re-implement existing website template (from PHP). Add all assets.
This commit is contained in:
parent
a87a334bc7
commit
ddf6c5b8ce
60 changed files with 2514 additions and 87 deletions
38
Website/wwwroot/js/directives/dragDrop.js
Normal file
38
Website/wwwroot/js/directives/dragDrop.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
angular.module("robware").directive('dragDrop', function() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope: {
|
||||
dragDrop:'='
|
||||
},
|
||||
link: function(scope, element) {
|
||||
function handleEvent(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
element.on('dragover', function(e) {
|
||||
handleEvent(e);
|
||||
});
|
||||
element.on('dragenter', function(e) {
|
||||
handleEvent(e);
|
||||
$(element).addClass("dragOver");
|
||||
});
|
||||
element.on('dragleave', function(e) {
|
||||
handleEvent(e);
|
||||
$(element).removeClass("dragOver");
|
||||
});
|
||||
element.on('drop', function(e){
|
||||
handleEvent(e);
|
||||
$(element).removeClass("dragOver");
|
||||
|
||||
if (e.originalEvent.dataTransfer){
|
||||
if (e.originalEvent.dataTransfer.files.length > 0) {
|
||||
scope.dragDrop(e.originalEvent.dataTransfer.files);
|
||||
scope.$apply();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue