pakunok 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +98 -0
- data/MIT-LICENSE +20 -0
- data/README.md +168 -0
- data/Rakefile +37 -0
- data/lib/pakunok.rb +4 -0
- data/lib/pakunok/version.rb +5 -0
- data/lib/tasks/pakunok_tasks.rake +4 -0
- data/pakunok.gemspec +24 -0
- data/spec/colorpicker_spec.rb +18 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +10 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/pages_controller.rb +2 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/pages/index.html.erb +20 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +47 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +27 -0
- data/spec/dummy/config/environments/production.rb +51 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +60 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/fileuploader_spec.rb +29 -0
- data/spec/jquery-ui_spec.rb +71 -0
- data/spec/jquery_spec.rb +10 -0
- data/spec/misc_spec.rb +23 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/support/global.rb +12 -0
- data/spec/support/matchers.rb +64 -0
- data/vendor/assets/images/pakunok/colorpicker/colorpicker_background.png +0 -0
- data/vendor/assets/images/pakunok/colorpicker/colorpicker_hex.png +0 -0
- data/vendor/assets/images/pakunok/colorpicker/colorpicker_hsb_b.png +0 -0
- data/vendor/assets/images/pakunok/colorpicker/colorpicker_hsb_h.png +0 -0
- data/vendor/assets/images/pakunok/colorpicker/colorpicker_hsb_s.png +0 -0
- data/vendor/assets/images/pakunok/colorpicker/colorpicker_indic.gif +0 -0
- data/vendor/assets/images/pakunok/colorpicker/colorpicker_overlay.png +0 -0
- data/vendor/assets/images/pakunok/colorpicker/colorpicker_rgb_b.png +0 -0
- data/vendor/assets/images/pakunok/colorpicker/colorpicker_rgb_g.png +0 -0
- data/vendor/assets/images/pakunok/colorpicker/colorpicker_rgb_r.png +0 -0
- data/vendor/assets/images/pakunok/colorpicker/colorpicker_select.gif +0 -0
- data/vendor/assets/images/pakunok/colorpicker/colorpicker_submit.png +0 -0
- data/vendor/assets/images/pakunok/fileuploader/loading.gif +0 -0
- data/vendor/assets/javascripts/pakunok/colorpicker.js +484 -0
- data/vendor/assets/javascripts/pakunok/fileuploader.js +1247 -0
- data/vendor/assets/javascripts/pakunok/innershiv.js +87 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui.js +20 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/accordion.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/autocomplete.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/button.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/core.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/datepicker.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/dialog.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/draggable.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/droppable.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/effects.js +14 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/mouse.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/order.txt +485 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/accordion.js +4 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/autocomplete.js +5 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/basic.js +5 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/button.js +4 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/datepicker.js +3 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/dialog.js +8 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/draggable.js +5 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/droppable.js +3 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/effects.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/progressbar.js +4 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/resizable.js +5 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/selectable.js +5 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/slider.js +5 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/sortable.js +5 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/pack/tabs.js +4 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/position.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/progressbar.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/resizable.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/selectable.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/slider.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/sortable.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/tabs.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery-ui-i18n.js +1379 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-af.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-ar-DZ.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-ar.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-az.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-bg.js +24 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-bs.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-ca.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-cs.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-da.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-de.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-el.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-en-AU.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-en-GB.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-en-NZ.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-eo.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-es.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-et.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-eu.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-fa.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-fi.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-fo.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-fr-CH.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-fr.js +25 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-gl.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-he.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-hr.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-hu.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-hy.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-id.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-is.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-it.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-ja.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-ko.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-kz.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-lt.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-lv.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-ml.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-ms.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-nl.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-no.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-pl.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-pt-BR.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-pt.js +22 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-rm.js +21 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-ro.js +26 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-ru.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-sk.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-sl.js +24 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-sq.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-sr-SR.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-sr.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-sv.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-ta.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-th.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-tj.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-tr.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-uk.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-vi.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-zh-CN.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-zh-HK.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/i18n/jquery.ui.datepicker-zh-TW.js +23 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.effects.blind.js +49 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.effects.bounce.js +78 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.effects.clip.js +54 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.effects.core.js +746 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.effects.drop.js +50 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.effects.explode.js +79 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.effects.fade.js +32 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.effects.fold.js +56 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.effects.highlight.js +50 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.effects.pulsate.js +51 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.effects.scale.js +178 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.effects.shake.js +57 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.effects.slide.js +50 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.effects.transfer.js +45 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.accordion.js +611 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.autocomplete.js +612 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.button.js +416 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.core.js +314 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.datepicker.js +1824 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.dialog.js +878 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.draggable.js +823 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.droppable.js +296 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.mouse.js +156 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.position.js +252 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.progressbar.js +109 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.resizable.js +842 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.selectable.js +266 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.slider.js +666 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.sortable.js +1077 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.tabs.js +758 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/ui/jquery.ui.widget.js +262 -0
- data/vendor/assets/javascripts/pakunok/jquery-ui/widget.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery.form.js +911 -0
- data/vendor/assets/javascripts/pakunok/jquery.js +1 -0
- data/vendor/assets/javascripts/pakunok/jquery.jscrollpane.js +1390 -0
- data/vendor/assets/javascripts/pakunok/jquery.mousewheel.js +78 -0
- data/vendor/assets/javascripts/pakunok/jquery.validate.js +1166 -0
- data/vendor/assets/javascripts/pakunok/jquery.validate/additional-methods.js +280 -0
- data/vendor/assets/javascripts/pakunok/jquery.viewport.js +58 -0
- data/vendor/assets/javascripts/pakunok/jquery/jquery-1.5.2.js +8374 -0
- data/vendor/assets/javascripts/pakunok/jquery/jquery-1.6.2.js +8981 -0
- data/vendor/assets/javascripts/pakunok/mwheelIntent.js +76 -0
- data/vendor/assets/stylesheets/pakunok/colorpicker.css.erb +161 -0
- data/vendor/assets/stylesheets/pakunok/fileuploader.css.erb +31 -0
- data/vendor/assets/stylesheets/pakunok/jquery.jscrollpane.css +120 -0
- metadata +292 -0
@@ -0,0 +1,296 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery UI Droppable 1.8.15
|
3
|
+
*
|
4
|
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
5
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6
|
+
* http://jquery.org/license
|
7
|
+
*
|
8
|
+
* http://docs.jquery.com/UI/Droppables
|
9
|
+
*
|
10
|
+
* Depends:
|
11
|
+
* jquery.ui.core.js
|
12
|
+
* jquery.ui.widget.js
|
13
|
+
* jquery.ui.mouse.js
|
14
|
+
* jquery.ui.draggable.js
|
15
|
+
*/
|
16
|
+
(function( $, undefined ) {
|
17
|
+
|
18
|
+
$.widget("ui.droppable", {
|
19
|
+
widgetEventPrefix: "drop",
|
20
|
+
options: {
|
21
|
+
accept: '*',
|
22
|
+
activeClass: false,
|
23
|
+
addClasses: true,
|
24
|
+
greedy: false,
|
25
|
+
hoverClass: false,
|
26
|
+
scope: 'default',
|
27
|
+
tolerance: 'intersect'
|
28
|
+
},
|
29
|
+
_create: function() {
|
30
|
+
|
31
|
+
var o = this.options, accept = o.accept;
|
32
|
+
this.isover = 0; this.isout = 1;
|
33
|
+
|
34
|
+
this.accept = $.isFunction(accept) ? accept : function(d) {
|
35
|
+
return d.is(accept);
|
36
|
+
};
|
37
|
+
|
38
|
+
//Store the droppable's proportions
|
39
|
+
this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
|
40
|
+
|
41
|
+
// Add the reference and positions to the manager
|
42
|
+
$.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
|
43
|
+
$.ui.ddmanager.droppables[o.scope].push(this);
|
44
|
+
|
45
|
+
(o.addClasses && this.element.addClass("ui-droppable"));
|
46
|
+
|
47
|
+
},
|
48
|
+
|
49
|
+
destroy: function() {
|
50
|
+
var drop = $.ui.ddmanager.droppables[this.options.scope];
|
51
|
+
for ( var i = 0; i < drop.length; i++ )
|
52
|
+
if ( drop[i] == this )
|
53
|
+
drop.splice(i, 1);
|
54
|
+
|
55
|
+
this.element
|
56
|
+
.removeClass("ui-droppable ui-droppable-disabled")
|
57
|
+
.removeData("droppable")
|
58
|
+
.unbind(".droppable");
|
59
|
+
|
60
|
+
return this;
|
61
|
+
},
|
62
|
+
|
63
|
+
_setOption: function(key, value) {
|
64
|
+
|
65
|
+
if(key == 'accept') {
|
66
|
+
this.accept = $.isFunction(value) ? value : function(d) {
|
67
|
+
return d.is(value);
|
68
|
+
};
|
69
|
+
}
|
70
|
+
$.Widget.prototype._setOption.apply(this, arguments);
|
71
|
+
},
|
72
|
+
|
73
|
+
_activate: function(event) {
|
74
|
+
var draggable = $.ui.ddmanager.current;
|
75
|
+
if(this.options.activeClass) this.element.addClass(this.options.activeClass);
|
76
|
+
(draggable && this._trigger('activate', event, this.ui(draggable)));
|
77
|
+
},
|
78
|
+
|
79
|
+
_deactivate: function(event) {
|
80
|
+
var draggable = $.ui.ddmanager.current;
|
81
|
+
if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
|
82
|
+
(draggable && this._trigger('deactivate', event, this.ui(draggable)));
|
83
|
+
},
|
84
|
+
|
85
|
+
_over: function(event) {
|
86
|
+
|
87
|
+
var draggable = $.ui.ddmanager.current;
|
88
|
+
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
|
89
|
+
|
90
|
+
if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
91
|
+
if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
|
92
|
+
this._trigger('over', event, this.ui(draggable));
|
93
|
+
}
|
94
|
+
|
95
|
+
},
|
96
|
+
|
97
|
+
_out: function(event) {
|
98
|
+
|
99
|
+
var draggable = $.ui.ddmanager.current;
|
100
|
+
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
|
101
|
+
|
102
|
+
if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
103
|
+
if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
|
104
|
+
this._trigger('out', event, this.ui(draggable));
|
105
|
+
}
|
106
|
+
|
107
|
+
},
|
108
|
+
|
109
|
+
_drop: function(event,custom) {
|
110
|
+
|
111
|
+
var draggable = custom || $.ui.ddmanager.current;
|
112
|
+
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
|
113
|
+
|
114
|
+
var childrenIntersection = false;
|
115
|
+
this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
|
116
|
+
var inst = $.data(this, 'droppable');
|
117
|
+
if(
|
118
|
+
inst.options.greedy
|
119
|
+
&& !inst.options.disabled
|
120
|
+
&& inst.options.scope == draggable.options.scope
|
121
|
+
&& inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
|
122
|
+
&& $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
|
123
|
+
) { childrenIntersection = true; return false; }
|
124
|
+
});
|
125
|
+
if(childrenIntersection) return false;
|
126
|
+
|
127
|
+
if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
128
|
+
if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
|
129
|
+
if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
|
130
|
+
this._trigger('drop', event, this.ui(draggable));
|
131
|
+
return this.element;
|
132
|
+
}
|
133
|
+
|
134
|
+
return false;
|
135
|
+
|
136
|
+
},
|
137
|
+
|
138
|
+
ui: function(c) {
|
139
|
+
return {
|
140
|
+
draggable: (c.currentItem || c.element),
|
141
|
+
helper: c.helper,
|
142
|
+
position: c.position,
|
143
|
+
offset: c.positionAbs
|
144
|
+
};
|
145
|
+
}
|
146
|
+
|
147
|
+
});
|
148
|
+
|
149
|
+
$.extend($.ui.droppable, {
|
150
|
+
version: "1.8.15"
|
151
|
+
});
|
152
|
+
|
153
|
+
$.ui.intersect = function(draggable, droppable, toleranceMode) {
|
154
|
+
|
155
|
+
if (!droppable.offset) return false;
|
156
|
+
|
157
|
+
var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
|
158
|
+
y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
|
159
|
+
var l = droppable.offset.left, r = l + droppable.proportions.width,
|
160
|
+
t = droppable.offset.top, b = t + droppable.proportions.height;
|
161
|
+
|
162
|
+
switch (toleranceMode) {
|
163
|
+
case 'fit':
|
164
|
+
return (l <= x1 && x2 <= r
|
165
|
+
&& t <= y1 && y2 <= b);
|
166
|
+
break;
|
167
|
+
case 'intersect':
|
168
|
+
return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
|
169
|
+
&& x2 - (draggable.helperProportions.width / 2) < r // Left Half
|
170
|
+
&& t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
|
171
|
+
&& y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
|
172
|
+
break;
|
173
|
+
case 'pointer':
|
174
|
+
var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
|
175
|
+
draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
|
176
|
+
isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
|
177
|
+
return isOver;
|
178
|
+
break;
|
179
|
+
case 'touch':
|
180
|
+
return (
|
181
|
+
(y1 >= t && y1 <= b) || // Top edge touching
|
182
|
+
(y2 >= t && y2 <= b) || // Bottom edge touching
|
183
|
+
(y1 < t && y2 > b) // Surrounded vertically
|
184
|
+
) && (
|
185
|
+
(x1 >= l && x1 <= r) || // Left edge touching
|
186
|
+
(x2 >= l && x2 <= r) || // Right edge touching
|
187
|
+
(x1 < l && x2 > r) // Surrounded horizontally
|
188
|
+
);
|
189
|
+
break;
|
190
|
+
default:
|
191
|
+
return false;
|
192
|
+
break;
|
193
|
+
}
|
194
|
+
|
195
|
+
};
|
196
|
+
|
197
|
+
/*
|
198
|
+
This manager tracks offsets of draggables and droppables
|
199
|
+
*/
|
200
|
+
$.ui.ddmanager = {
|
201
|
+
current: null,
|
202
|
+
droppables: { 'default': [] },
|
203
|
+
prepareOffsets: function(t, event) {
|
204
|
+
|
205
|
+
var m = $.ui.ddmanager.droppables[t.options.scope] || [];
|
206
|
+
var type = event ? event.type : null; // workaround for #2317
|
207
|
+
var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
|
208
|
+
|
209
|
+
droppablesLoop: for (var i = 0; i < m.length; i++) {
|
210
|
+
|
211
|
+
if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
|
212
|
+
for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
|
213
|
+
m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
|
214
|
+
|
215
|
+
if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
|
216
|
+
|
217
|
+
m[i].offset = m[i].element.offset();
|
218
|
+
m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
|
219
|
+
|
220
|
+
}
|
221
|
+
|
222
|
+
},
|
223
|
+
drop: function(draggable, event) {
|
224
|
+
|
225
|
+
var dropped = false;
|
226
|
+
$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
|
227
|
+
|
228
|
+
if(!this.options) return;
|
229
|
+
if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
|
230
|
+
dropped = dropped || this._drop.call(this, event);
|
231
|
+
|
232
|
+
if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
233
|
+
this.isout = 1; this.isover = 0;
|
234
|
+
this._deactivate.call(this, event);
|
235
|
+
}
|
236
|
+
|
237
|
+
});
|
238
|
+
return dropped;
|
239
|
+
|
240
|
+
},
|
241
|
+
dragStart: function( draggable, event ) {
|
242
|
+
//Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
|
243
|
+
draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
|
244
|
+
if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
|
245
|
+
});
|
246
|
+
},
|
247
|
+
drag: function(draggable, event) {
|
248
|
+
|
249
|
+
//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
|
250
|
+
if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
|
251
|
+
|
252
|
+
//Run through all droppables and check their positions based on specific tolerance options
|
253
|
+
$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
|
254
|
+
|
255
|
+
if(this.options.disabled || this.greedyChild || !this.visible) return;
|
256
|
+
var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
|
257
|
+
|
258
|
+
var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
|
259
|
+
if(!c) return;
|
260
|
+
|
261
|
+
var parentInstance;
|
262
|
+
if (this.options.greedy) {
|
263
|
+
var parent = this.element.parents(':data(droppable):eq(0)');
|
264
|
+
if (parent.length) {
|
265
|
+
parentInstance = $.data(parent[0], 'droppable');
|
266
|
+
parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
|
267
|
+
}
|
268
|
+
}
|
269
|
+
|
270
|
+
// we just moved into a greedy child
|
271
|
+
if (parentInstance && c == 'isover') {
|
272
|
+
parentInstance['isover'] = 0;
|
273
|
+
parentInstance['isout'] = 1;
|
274
|
+
parentInstance._out.call(parentInstance, event);
|
275
|
+
}
|
276
|
+
|
277
|
+
this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
|
278
|
+
this[c == "isover" ? "_over" : "_out"].call(this, event);
|
279
|
+
|
280
|
+
// we just moved out of a greedy child
|
281
|
+
if (parentInstance && c == 'isout') {
|
282
|
+
parentInstance['isout'] = 0;
|
283
|
+
parentInstance['isover'] = 1;
|
284
|
+
parentInstance._over.call(parentInstance, event);
|
285
|
+
}
|
286
|
+
});
|
287
|
+
|
288
|
+
},
|
289
|
+
dragStop: function( draggable, event ) {
|
290
|
+
draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
|
291
|
+
//Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
|
292
|
+
if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
|
293
|
+
}
|
294
|
+
};
|
295
|
+
|
296
|
+
})(jQuery);
|
@@ -0,0 +1,156 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery UI Mouse 1.8.15
|
3
|
+
*
|
4
|
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
5
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6
|
+
* http://jquery.org/license
|
7
|
+
*
|
8
|
+
* http://docs.jquery.com/UI/Mouse
|
9
|
+
*
|
10
|
+
* Depends:
|
11
|
+
* jquery.ui.widget.js
|
12
|
+
*/
|
13
|
+
(function( $, undefined ) {
|
14
|
+
|
15
|
+
$.widget("ui.mouse", {
|
16
|
+
options: {
|
17
|
+
cancel: ':input,option',
|
18
|
+
distance: 1,
|
19
|
+
delay: 0
|
20
|
+
},
|
21
|
+
_mouseInit: function() {
|
22
|
+
var self = this;
|
23
|
+
|
24
|
+
this.element
|
25
|
+
.bind('mousedown.'+this.widgetName, function(event) {
|
26
|
+
return self._mouseDown(event);
|
27
|
+
})
|
28
|
+
.bind('click.'+this.widgetName, function(event) {
|
29
|
+
if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
|
30
|
+
$.removeData(event.target, self.widgetName + '.preventClickEvent');
|
31
|
+
event.stopImmediatePropagation();
|
32
|
+
return false;
|
33
|
+
}
|
34
|
+
});
|
35
|
+
|
36
|
+
this.started = false;
|
37
|
+
},
|
38
|
+
|
39
|
+
// TODO: make sure destroying one instance of mouse doesn't mess with
|
40
|
+
// other instances of mouse
|
41
|
+
_mouseDestroy: function() {
|
42
|
+
this.element.unbind('.'+this.widgetName);
|
43
|
+
},
|
44
|
+
|
45
|
+
_mouseDown: function(event) {
|
46
|
+
// don't let more than one widget handle mouseStart
|
47
|
+
// TODO: figure out why we have to use originalEvent
|
48
|
+
event.originalEvent = event.originalEvent || {};
|
49
|
+
if (event.originalEvent.mouseHandled) { return; }
|
50
|
+
|
51
|
+
// we may have missed mouseup (out of window)
|
52
|
+
(this._mouseStarted && this._mouseUp(event));
|
53
|
+
|
54
|
+
this._mouseDownEvent = event;
|
55
|
+
|
56
|
+
var self = this,
|
57
|
+
btnIsLeft = (event.which == 1),
|
58
|
+
elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).closest(this.options.cancel).length : false);
|
59
|
+
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
|
60
|
+
return true;
|
61
|
+
}
|
62
|
+
|
63
|
+
this.mouseDelayMet = !this.options.delay;
|
64
|
+
if (!this.mouseDelayMet) {
|
65
|
+
this._mouseDelayTimer = setTimeout(function() {
|
66
|
+
self.mouseDelayMet = true;
|
67
|
+
}, this.options.delay);
|
68
|
+
}
|
69
|
+
|
70
|
+
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
|
71
|
+
this._mouseStarted = (this._mouseStart(event) !== false);
|
72
|
+
if (!this._mouseStarted) {
|
73
|
+
event.preventDefault();
|
74
|
+
return true;
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
// Click event may never have fired (Gecko & Opera)
|
79
|
+
if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
|
80
|
+
$.removeData(event.target, this.widgetName + '.preventClickEvent');
|
81
|
+
}
|
82
|
+
|
83
|
+
// these delegates are required to keep context
|
84
|
+
this._mouseMoveDelegate = function(event) {
|
85
|
+
return self._mouseMove(event);
|
86
|
+
};
|
87
|
+
this._mouseUpDelegate = function(event) {
|
88
|
+
return self._mouseUp(event);
|
89
|
+
};
|
90
|
+
$(document)
|
91
|
+
.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
92
|
+
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
93
|
+
|
94
|
+
event.preventDefault();
|
95
|
+
event.originalEvent.mouseHandled = true;
|
96
|
+
return true;
|
97
|
+
},
|
98
|
+
|
99
|
+
_mouseMove: function(event) {
|
100
|
+
// IE mouseup check - mouseup happened when mouse was out of window
|
101
|
+
if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
|
102
|
+
return this._mouseUp(event);
|
103
|
+
}
|
104
|
+
|
105
|
+
if (this._mouseStarted) {
|
106
|
+
this._mouseDrag(event);
|
107
|
+
return event.preventDefault();
|
108
|
+
}
|
109
|
+
|
110
|
+
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
|
111
|
+
this._mouseStarted =
|
112
|
+
(this._mouseStart(this._mouseDownEvent, event) !== false);
|
113
|
+
(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
|
114
|
+
}
|
115
|
+
|
116
|
+
return !this._mouseStarted;
|
117
|
+
},
|
118
|
+
|
119
|
+
_mouseUp: function(event) {
|
120
|
+
$(document)
|
121
|
+
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
122
|
+
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
123
|
+
|
124
|
+
if (this._mouseStarted) {
|
125
|
+
this._mouseStarted = false;
|
126
|
+
|
127
|
+
if (event.target == this._mouseDownEvent.target) {
|
128
|
+
$.data(event.target, this.widgetName + '.preventClickEvent', true);
|
129
|
+
}
|
130
|
+
|
131
|
+
this._mouseStop(event);
|
132
|
+
}
|
133
|
+
|
134
|
+
return false;
|
135
|
+
},
|
136
|
+
|
137
|
+
_mouseDistanceMet: function(event) {
|
138
|
+
return (Math.max(
|
139
|
+
Math.abs(this._mouseDownEvent.pageX - event.pageX),
|
140
|
+
Math.abs(this._mouseDownEvent.pageY - event.pageY)
|
141
|
+
) >= this.options.distance
|
142
|
+
);
|
143
|
+
},
|
144
|
+
|
145
|
+
_mouseDelayMet: function(event) {
|
146
|
+
return this.mouseDelayMet;
|
147
|
+
},
|
148
|
+
|
149
|
+
// These are placeholder methods, to be overriden by extending plugin
|
150
|
+
_mouseStart: function(event) {},
|
151
|
+
_mouseDrag: function(event) {},
|
152
|
+
_mouseStop: function(event) {},
|
153
|
+
_mouseCapture: function(event) { return true; }
|
154
|
+
});
|
155
|
+
|
156
|
+
})(jQuery);
|