simple_form_fileinput 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c10a766801b75e03fa91317d3f128c43a79d6c4c
|
4
|
+
data.tar.gz: b6cdcc296ba7bdbda64218f819635ea56f726bb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5288a9be02ac3b0c9eb5f8a8c3b25604f4f718900837b07e93f2e89aa3336cd2a49b9251e3d355e1298f64b1d8f37009eb4edb0449836ef3672bb5c82c6b657
|
7
|
+
data.tar.gz: 4594d3e631a45f255ca39c20b8e09e35472d8a83e88747fd872846ad52f2031ed3b77b5e2d6b2973e4280363b3586f96cb96a6a558c8495e5800dfae72e632dc
|
@@ -1,18 +1,29 @@
|
|
1
1
|
$ ->
|
2
2
|
# The plugin code
|
3
|
-
$.fn.draghover = (options)->
|
3
|
+
$.fn.draghover = (options={})->
|
4
|
+
defaults =
|
5
|
+
fireDragLeaveOnChild: true
|
6
|
+
settings = $.extend true, defaults, options
|
4
7
|
@each ->
|
5
8
|
collection = $()
|
6
9
|
self = $(@)
|
7
|
-
self.on
|
8
|
-
self.trigger
|
10
|
+
self.on 'dragenter', (e)->
|
11
|
+
self.trigger 'draghoverstart' if collection.length is 0
|
9
12
|
collection = collection.add(e.target)
|
10
|
-
self.on
|
13
|
+
self.on 'dragleave', (e)->
|
14
|
+
console.log e
|
15
|
+
console.log "#{e.originalEvent.pageX}, #{e.originalEvent.pageY}"
|
16
|
+
if !settings.fireDragLeaveOnChild && e.originalEvent.pageX != 0
|
17
|
+
e.preventDefault()
|
18
|
+
return false
|
19
|
+
collection = collection.not(e.target)
|
20
|
+
self.trigger "draghoverend" if collection.length is 0
|
21
|
+
self.on 'drop', (e)->
|
11
22
|
collection = collection.not(e.target)
|
12
23
|
self.trigger "draghoverend" if collection.length is 0
|
13
24
|
|
14
25
|
$(document).ready ->
|
15
|
-
$(window).draghover().on
|
26
|
+
$(window).draghover({fireDragLeaveOnChild: false}).on
|
16
27
|
draghoverstart: ->
|
17
28
|
$('.file-input-wrapper').addClass('file-in-window')
|
18
29
|
draghoverend: ->
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form_fileinput
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- smit1625
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|