javascript_auto_include 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. data/Gemfile +7 -3
  2. data/Gemfile.lock +69 -19
  3. data/README.markdown +44 -12
  4. data/Rakefile +1 -1
  5. data/VERSION +1 -1
  6. data/lib/javascript_auto_include.rb +5 -1
  7. data/lib/javascript_auto_include/dependency.rb +13 -0
  8. data/lib/javascript_auto_include/helpers/action_view.rb +72 -19
  9. data/lib/javascript_auto_include/source_file.rb +61 -0
  10. data/spec/dependency_spec.rb +19 -0
  11. data/spec/javascript_auto_include_spec.rb +11 -0
  12. data/spec/javascript_auto_include_tag_spec.rb +9 -0
  13. data/spec/source_file_spec.rb +52 -0
  14. data/spec/spec_helper.rb +21 -0
  15. data/spec/testbed/Gemfile +7 -0
  16. data/spec/testbed/Gemfile.lock +86 -0
  17. data/spec/testbed/Rakefile +7 -0
  18. data/spec/testbed/config.ru +4 -0
  19. data/spec/testbed/config/application.rb +45 -0
  20. data/spec/testbed/config/boot.rb +6 -0
  21. data/spec/testbed/config/dependencies/another_fake_controller.yml +3 -0
  22. data/spec/testbed/config/dependencies/application.yml +2 -0
  23. data/spec/testbed/config/dependencies/fake_controller.yml +4 -0
  24. data/spec/testbed/config/dependencies/jquery.yml +2 -0
  25. data/spec/testbed/config/dependencies/rails.yml +2 -0
  26. data/spec/testbed/config/environment.rb +5 -0
  27. data/spec/testbed/config/environments/development.rb +26 -0
  28. data/spec/testbed/config/environments/production.rb +49 -0
  29. data/spec/testbed/config/environments/test.rb +35 -0
  30. data/spec/testbed/config/routes.rb +58 -0
  31. data/spec/testbed/log/development.log +0 -0
  32. data/spec/testbed/log/production.log +0 -0
  33. data/spec/testbed/log/server.log +0 -0
  34. data/spec/testbed/log/test.log +8 -0
  35. data/spec/testbed/public/javascripts/another_fake_controller.js +14 -0
  36. data/spec/testbed/public/javascripts/application.js +1 -0
  37. data/spec/testbed/public/javascripts/fake_controller.js +15 -0
  38. data/spec/testbed/public/javascripts/jquery.js +8316 -0
  39. data/spec/testbed/public/javascripts/jquery.ui.core.js +312 -0
  40. data/spec/testbed/public/javascripts/jquery.ui.core.min.js +17 -0
  41. data/spec/testbed/public/javascripts/jquery.ui.mouse.js +160 -0
  42. data/spec/testbed/public/javascripts/jquery.ui.mouse.min.js +17 -0
  43. data/spec/testbed/public/javascripts/jquery.ui.widget.js +262 -0
  44. data/spec/testbed/public/javascripts/jquery.ui.widget.min.js +15 -0
  45. data/spec/testbed/public/javascripts/rails.js +289 -0
  46. metadata +95 -88
  47. data/.document +0 -5
  48. data/javascript_auto_include.gemspec +0 -60
@@ -0,0 +1,312 @@
1
+ /*!
2
+ * jQuery UI 1.8.13
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
9
+ */
10
+ (function( $, undefined ) {
11
+
12
+ // prevent duplicate loading
13
+ // this is only a problem because we proxy existing functions
14
+ // and we don't want to double proxy them
15
+ $.ui = $.ui || {};
16
+ if ( $.ui.version ) {
17
+ return;
18
+ }
19
+
20
+ $.extend( $.ui, {
21
+ version: "1.8.13",
22
+
23
+ keyCode: {
24
+ ALT: 18,
25
+ BACKSPACE: 8,
26
+ CAPS_LOCK: 20,
27
+ COMMA: 188,
28
+ COMMAND: 91,
29
+ COMMAND_LEFT: 91, // COMMAND
30
+ COMMAND_RIGHT: 93,
31
+ CONTROL: 17,
32
+ DELETE: 46,
33
+ DOWN: 40,
34
+ END: 35,
35
+ ENTER: 13,
36
+ ESCAPE: 27,
37
+ HOME: 36,
38
+ INSERT: 45,
39
+ LEFT: 37,
40
+ MENU: 93, // COMMAND_RIGHT
41
+ NUMPAD_ADD: 107,
42
+ NUMPAD_DECIMAL: 110,
43
+ NUMPAD_DIVIDE: 111,
44
+ NUMPAD_ENTER: 108,
45
+ NUMPAD_MULTIPLY: 106,
46
+ NUMPAD_SUBTRACT: 109,
47
+ PAGE_DOWN: 34,
48
+ PAGE_UP: 33,
49
+ PERIOD: 190,
50
+ RIGHT: 39,
51
+ SHIFT: 16,
52
+ SPACE: 32,
53
+ TAB: 9,
54
+ UP: 38,
55
+ WINDOWS: 91 // COMMAND
56
+ }
57
+ });
58
+
59
+ // plugins
60
+ $.fn.extend({
61
+ _focus: $.fn.focus,
62
+ focus: function( delay, fn ) {
63
+ return typeof delay === "number" ?
64
+ this.each(function() {
65
+ var elem = this;
66
+ setTimeout(function() {
67
+ $( elem ).focus();
68
+ if ( fn ) {
69
+ fn.call( elem );
70
+ }
71
+ }, delay );
72
+ }) :
73
+ this._focus.apply( this, arguments );
74
+ },
75
+
76
+ scrollParent: function() {
77
+ var scrollParent;
78
+ if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
79
+ scrollParent = this.parents().filter(function() {
80
+ return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
81
+ }).eq(0);
82
+ } else {
83
+ scrollParent = this.parents().filter(function() {
84
+ return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
85
+ }).eq(0);
86
+ }
87
+
88
+ return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
89
+ },
90
+
91
+ zIndex: function( zIndex ) {
92
+ if ( zIndex !== undefined ) {
93
+ return this.css( "zIndex", zIndex );
94
+ }
95
+
96
+ if ( this.length ) {
97
+ var elem = $( this[ 0 ] ), position, value;
98
+ while ( elem.length && elem[ 0 ] !== document ) {
99
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
100
+ // This makes behavior of this function consistent across browsers
101
+ // WebKit always returns auto if the element is positioned
102
+ position = elem.css( "position" );
103
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
104
+ // IE returns 0 when zIndex is not specified
105
+ // other browsers return a string
106
+ // we ignore the case of nested elements with an explicit value of 0
107
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
108
+ value = parseInt( elem.css( "zIndex" ), 10 );
109
+ if ( !isNaN( value ) && value !== 0 ) {
110
+ return value;
111
+ }
112
+ }
113
+ elem = elem.parent();
114
+ }
115
+ }
116
+
117
+ return 0;
118
+ },
119
+
120
+ disableSelection: function() {
121
+ return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
122
+ ".ui-disableSelection", function( event ) {
123
+ event.preventDefault();
124
+ });
125
+ },
126
+
127
+ enableSelection: function() {
128
+ return this.unbind( ".ui-disableSelection" );
129
+ }
130
+ });
131
+
132
+ $.each( [ "Width", "Height" ], function( i, name ) {
133
+ var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
134
+ type = name.toLowerCase(),
135
+ orig = {
136
+ innerWidth: $.fn.innerWidth,
137
+ innerHeight: $.fn.innerHeight,
138
+ outerWidth: $.fn.outerWidth,
139
+ outerHeight: $.fn.outerHeight
140
+ };
141
+
142
+ function reduce( elem, size, border, margin ) {
143
+ $.each( side, function() {
144
+ size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
145
+ if ( border ) {
146
+ size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
147
+ }
148
+ if ( margin ) {
149
+ size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
150
+ }
151
+ });
152
+ return size;
153
+ }
154
+
155
+ $.fn[ "inner" + name ] = function( size ) {
156
+ if ( size === undefined ) {
157
+ return orig[ "inner" + name ].call( this );
158
+ }
159
+
160
+ return this.each(function() {
161
+ $( this ).css( type, reduce( this, size ) + "px" );
162
+ });
163
+ };
164
+
165
+ $.fn[ "outer" + name] = function( size, margin ) {
166
+ if ( typeof size !== "number" ) {
167
+ return orig[ "outer" + name ].call( this, size );
168
+ }
169
+
170
+ return this.each(function() {
171
+ $( this).css( type, reduce( this, size, true, margin ) + "px" );
172
+ });
173
+ };
174
+ });
175
+
176
+ // selectors
177
+ function focusable( element, isTabIndexNotNaN ) {
178
+ var nodeName = element.nodeName.toLowerCase();
179
+ if ( "area" === nodeName ) {
180
+ var map = element.parentNode,
181
+ mapName = map.name,
182
+ img;
183
+ if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
184
+ return false;
185
+ }
186
+ img = $( "img[usemap=#" + mapName + "]" )[0];
187
+ return !!img && visible( img );
188
+ }
189
+ return ( /input|select|textarea|button|object/.test( nodeName )
190
+ ? !element.disabled
191
+ : "a" == nodeName
192
+ ? element.href || isTabIndexNotNaN
193
+ : isTabIndexNotNaN)
194
+ // the element and all of its ancestors must be visible
195
+ && visible( element );
196
+ }
197
+
198
+ function visible( element ) {
199
+ return !$( element ).parents().andSelf().filter(function() {
200
+ return $.curCSS( this, "visibility" ) === "hidden" ||
201
+ $.expr.filters.hidden( this );
202
+ }).length;
203
+ }
204
+
205
+ $.extend( $.expr[ ":" ], {
206
+ data: function( elem, i, match ) {
207
+ return !!$.data( elem, match[ 3 ] );
208
+ },
209
+
210
+ focusable: function( element ) {
211
+ return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
212
+ },
213
+
214
+ tabbable: function( element ) {
215
+ var tabIndex = $.attr( element, "tabindex" ),
216
+ isTabIndexNaN = isNaN( tabIndex );
217
+ return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
218
+ }
219
+ });
220
+
221
+ // support
222
+ $(function() {
223
+ var body = document.body,
224
+ div = body.appendChild( div = document.createElement( "div" ) );
225
+
226
+ $.extend( div.style, {
227
+ minHeight: "100px",
228
+ height: "auto",
229
+ padding: 0,
230
+ borderWidth: 0
231
+ });
232
+
233
+ $.support.minHeight = div.offsetHeight === 100;
234
+ $.support.selectstart = "onselectstart" in div;
235
+
236
+ // set display to none to avoid a layout bug in IE
237
+ // http://dev.jquery.com/ticket/4014
238
+ body.removeChild( div ).style.display = "none";
239
+ });
240
+
241
+
242
+
243
+
244
+
245
+ // deprecated
246
+ $.extend( $.ui, {
247
+ // $.ui.plugin is deprecated. Use the proxy pattern instead.
248
+ plugin: {
249
+ add: function( module, option, set ) {
250
+ var proto = $.ui[ module ].prototype;
251
+ for ( var i in set ) {
252
+ proto.plugins[ i ] = proto.plugins[ i ] || [];
253
+ proto.plugins[ i ].push( [ option, set[ i ] ] );
254
+ }
255
+ },
256
+ call: function( instance, name, args ) {
257
+ var set = instance.plugins[ name ];
258
+ if ( !set || !instance.element[ 0 ].parentNode ) {
259
+ return;
260
+ }
261
+
262
+ for ( var i = 0; i < set.length; i++ ) {
263
+ if ( instance.options[ set[ i ][ 0 ] ] ) {
264
+ set[ i ][ 1 ].apply( instance.element, args );
265
+ }
266
+ }
267
+ }
268
+ },
269
+
270
+ // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
271
+ contains: function( a, b ) {
272
+ return document.compareDocumentPosition ?
273
+ a.compareDocumentPosition( b ) & 16 :
274
+ a !== b && a.contains( b );
275
+ },
276
+
277
+ // only used by resizable
278
+ hasScroll: function( el, a ) {
279
+
280
+ //If overflow is hidden, the element might have extra content, but the user wants to hide it
281
+ if ( $( el ).css( "overflow" ) === "hidden") {
282
+ return false;
283
+ }
284
+
285
+ var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
286
+ has = false;
287
+
288
+ if ( el[ scroll ] > 0 ) {
289
+ return true;
290
+ }
291
+
292
+ // TODO: determine which cases actually cause this to happen
293
+ // if the element doesn't have the scroll set, see if it's possible to
294
+ // set the scroll
295
+ el[ scroll ] = 1;
296
+ has = ( el[ scroll ] > 0 );
297
+ el[ scroll ] = 0;
298
+ return has;
299
+ },
300
+
301
+ // these are odd functions, fix the API or move into individual plugins
302
+ isOverAxis: function( x, reference, size ) {
303
+ //Determines when x coordinate is over "b" element axis
304
+ return ( x > reference ) && ( x < ( reference + size ) );
305
+ },
306
+ isOver: function( y, x, top, left, height, width ) {
307
+ //Determines when x, y coordinates is over "b" element
308
+ return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
309
+ }
310
+ });
311
+
312
+ })( jQuery );
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * jQuery UI 1.8.13
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
9
+ */
10
+ (function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.13",
11
+ keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();
12
+ b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,
13
+ "overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",
14
+ function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,
15
+ outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,"tabindex"),d=isNaN(b);
16
+ return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=
17
+ 0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
@@ -0,0 +1,160 @@
1
+ /*!
2
+ * jQuery UI Mouse 1.8.13
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
+ var mouseHandled = false;
16
+ $(document).mousedown(function(e) {
17
+ mouseHandled = false;
18
+ });
19
+
20
+ $.widget("ui.mouse", {
21
+ options: {
22
+ cancel: ':input,option',
23
+ distance: 1,
24
+ delay: 0
25
+ },
26
+ _mouseInit: function() {
27
+ var self = this;
28
+
29
+ this.element
30
+ .bind('mousedown.'+this.widgetName, function(event) {
31
+ return self._mouseDown(event);
32
+ })
33
+ .bind('click.'+this.widgetName, function(event) {
34
+ if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
35
+ $.removeData(event.target, self.widgetName + '.preventClickEvent');
36
+ event.stopImmediatePropagation();
37
+ return false;
38
+ }
39
+ });
40
+
41
+ this.started = false;
42
+ },
43
+
44
+ // TODO: make sure destroying one instance of mouse doesn't mess with
45
+ // other instances of mouse
46
+ _mouseDestroy: function() {
47
+ this.element.unbind('.'+this.widgetName);
48
+ },
49
+
50
+ _mouseDown: function(event) {
51
+ // don't let more than one widget handle mouseStart
52
+ if(mouseHandled) {return};
53
+
54
+ // we may have missed mouseup (out of window)
55
+ (this._mouseStarted && this._mouseUp(event));
56
+
57
+ this._mouseDownEvent = event;
58
+
59
+ var self = this,
60
+ btnIsLeft = (event.which == 1),
61
+ elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
62
+ if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
63
+ return true;
64
+ }
65
+
66
+ this.mouseDelayMet = !this.options.delay;
67
+ if (!this.mouseDelayMet) {
68
+ this._mouseDelayTimer = setTimeout(function() {
69
+ self.mouseDelayMet = true;
70
+ }, this.options.delay);
71
+ }
72
+
73
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
74
+ this._mouseStarted = (this._mouseStart(event) !== false);
75
+ if (!this._mouseStarted) {
76
+ event.preventDefault();
77
+ return true;
78
+ }
79
+ }
80
+
81
+ // Click event may never have fired (Gecko & Opera)
82
+ if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
83
+ $.removeData(event.target, this.widgetName + '.preventClickEvent');
84
+ }
85
+
86
+ // these delegates are required to keep context
87
+ this._mouseMoveDelegate = function(event) {
88
+ return self._mouseMove(event);
89
+ };
90
+ this._mouseUpDelegate = function(event) {
91
+ return self._mouseUp(event);
92
+ };
93
+ $(document)
94
+ .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
95
+ .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
96
+
97
+ event.preventDefault();
98
+
99
+ mouseHandled = true;
100
+ return true;
101
+ },
102
+
103
+ _mouseMove: function(event) {
104
+ // IE mouseup check - mouseup happened when mouse was out of window
105
+ if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
106
+ return this._mouseUp(event);
107
+ }
108
+
109
+ if (this._mouseStarted) {
110
+ this._mouseDrag(event);
111
+ return event.preventDefault();
112
+ }
113
+
114
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
115
+ this._mouseStarted =
116
+ (this._mouseStart(this._mouseDownEvent, event) !== false);
117
+ (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
118
+ }
119
+
120
+ return !this._mouseStarted;
121
+ },
122
+
123
+ _mouseUp: function(event) {
124
+ $(document)
125
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
126
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
127
+
128
+ if (this._mouseStarted) {
129
+ this._mouseStarted = false;
130
+
131
+ if (event.target == this._mouseDownEvent.target) {
132
+ $.data(event.target, this.widgetName + '.preventClickEvent', true);
133
+ }
134
+
135
+ this._mouseStop(event);
136
+ }
137
+
138
+ return false;
139
+ },
140
+
141
+ _mouseDistanceMet: function(event) {
142
+ return (Math.max(
143
+ Math.abs(this._mouseDownEvent.pageX - event.pageX),
144
+ Math.abs(this._mouseDownEvent.pageY - event.pageY)
145
+ ) >= this.options.distance
146
+ );
147
+ },
148
+
149
+ _mouseDelayMet: function(event) {
150
+ return this.mouseDelayMet;
151
+ },
152
+
153
+ // These are placeholder methods, to be overriden by extending plugin
154
+ _mouseStart: function(event) {},
155
+ _mouseDrag: function(event) {},
156
+ _mouseStop: function(event) {},
157
+ _mouseCapture: function(event) { return true; }
158
+ });
159
+
160
+ })(jQuery);