mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 14:37:59 +01:00
18e41d2af4
Volume Slider Track Uploader Fav list A bunch of other things And stuff.
20 lines
No EOL
535 B
CoffeeScript
20 lines
No EOL
535 B
CoffeeScript
angular.module('ponyfm').directive 'uploader', [
|
|
'upload'
|
|
(upload) -> (scope, element) ->
|
|
$dropzone = $(element)
|
|
|
|
$dropzone[0].addEventListener 'dragover', (e) ->
|
|
e.preventDefault()
|
|
$dropzone.addClass 'file-over'
|
|
|
|
$dropzone[0].addEventListener 'dragleave', (e) ->
|
|
e.preventDefault()
|
|
$dropzone.removeClass 'file-over'
|
|
|
|
$dropzone[0].addEventListener 'drop', (e) ->
|
|
e.preventDefault()
|
|
$dropzone.removeClass 'file-over'
|
|
|
|
files = e.target.files || e.dataTransfer.files
|
|
scope.$apply -> upload.upload files
|
|
] |