Sha256: 88ce9f17b81baed42ad1ea24263c90d78b94fa37982fef815ca407ad597c8b1c
Contents?: true
Size: 1.01 KB
Versions: 33
Compression:
Stored size: 1.01 KB
Contents
class Modules.MrDropFileEvents constructor: (@element,@fileUpload) -> dragHovered = 0 el = angular.element("<div class='hovered-cover'>Drop Files Here</div>") @element.bind 'dragenter', (event) => dragHovered += 1 @element.addClass('hovered') if dragHovered == 1 @element.append el if dragHovered == 1 height = window.getComputedStyle(@element[0]).height el.css('height', height) el.css('line-height',height) el.css('margin-top', '-' + height) @element.bind 'dragleave', (event) => dragHovered -= 1 @element.removeClass('hovered') if dragHovered == 0 el.remove() if dragHovered == 0 @element.bind 'dragover', (event) => event.preventDefault() event.stopPropagation() @element.bind 'drop', (event) => event.preventDefault() event.stopPropagation() @element.removeClass('hovered') el.remove() dragHovered = 0 file = (event.originalEvent || event).dataTransfer.files[0] @fileUpload.uploadFile(file)
Version data entries
33 entries across 33 versions & 1 rubygems