Diffstat (limited to 'frontend/beta/js/YUI-extensions/dd/DropZone.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/YUI-extensions/dd/DropZone.js | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/frontend/beta/js/YUI-extensions/dd/DropZone.js b/frontend/beta/js/YUI-extensions/dd/DropZone.js new file mode 100644 index 0000000..ce446fb --- a/dev/null +++ b/frontend/beta/js/YUI-extensions/dd/DropZone.js | |||
@@ -0,0 +1,81 @@ | |||
1 | // kill drag drop dependency | ||
2 | if(YAHOO.util.DragDrop){ | ||
3 | YAHOO.ext.dd.DropZone = function(el, config){ | ||
4 | YAHOO.ext.dd.DropZone.superclass.constructor.call(this, el, config); | ||
5 | }; | ||
6 | |||
7 | YAHOO.extendX(YAHOO.ext.dd.DropZone, YAHOO.ext.dd.DropTarget, { | ||
8 | getTargetFromEvent : function(e){ | ||
9 | return YAHOO.ext.dd.Registry.getTargetFromEvent(e); | ||
10 | }, | ||
11 | |||
12 | onNodeEnter : function(n, dd, e, data){ | ||
13 | |||
14 | }, | ||
15 | |||
16 | onNodeOver : function(n, dd, e, data){ | ||
17 | return this.dropAllowed; | ||
18 | }, | ||
19 | |||
20 | onNodeOut : function(n, dd, e, data){ | ||
21 | |||
22 | }, | ||
23 | |||
24 | onNodeDrop : function(n, dd, e, data){ | ||
25 | return false; | ||
26 | }, | ||
27 | |||
28 | onContainerOver : function(n, dd, e, data){ | ||
29 | return this.dropNotAllowed; | ||
30 | }, | ||
31 | |||
32 | onContainerDrop : function(n, dd, e, data){ | ||
33 | return false; | ||
34 | }, | ||
35 | |||
36 | notifyEnter : function(dd, e, data){ | ||
37 | return this.dropNotAllowed; | ||
38 | }, | ||
39 | |||
40 | notifyOver : function(dd, e, data){ | ||
41 | var n = this.getTargetFromEvent(e); | ||
42 | if(!n){ // not over valid drop target | ||
43 | if(this.lastOverNode){ | ||
44 | this.onNodeOut(this.lastOverNode, dd, e, data); | ||
45 | this.lastOverNode = null; | ||
46 | } | ||
47 | return this.onContainerOver(dd, e, data); | ||
48 | } | ||
49 | if(this.lastOverNode != n){ | ||
50 | if(this.lastOverNode){ | ||
51 | this.onNodeOut(this.lastOverNode, dd, e, data); | ||
52 | } | ||
53 | this.onNodeEnter(n, dd, e, data); | ||
54 | this.lastOverNode = n; | ||
55 | } | ||
56 | return this.onNodeOver(n, dd, e, data); | ||
57 | }, | ||
58 | |||
59 | notifyOut : function(dd, e, data){ | ||
60 | if(this.lastOverNode){ | ||
61 | this.onNodeOut(this.lastOverNode, dd, e, data); | ||
62 | this.lastOverNode = null; | ||
63 | } | ||
64 | }, | ||
65 | |||
66 | notifyDrop : function(dd, e, data){ | ||
67 | if(this.lastOverNode){ | ||
68 | this.onNodeOut(this.lastOverNode, dd, e, data); | ||
69 | this.lastOverNode = null; | ||
70 | } | ||
71 | var n = this.getTargetFromEvent(e); | ||
72 | return n ? | ||
73 | this.onNodeDrop(n, dd, e, data) : | ||
74 | this.onContainerDrop(n, dd, e, data); | ||
75 | }, | ||
76 | |||
77 | triggerCacheRefresh : function(){ | ||
78 | YAHOO.util.DDM.refreshCache(this.groups); | ||
79 | } | ||
80 | }); | ||
81 | } | ||