cv 0.0.1

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 (87) hide show
  1. data/.gitignore +5 -0
  2. data/Gemfile +3 -0
  3. data/Rakefile +2 -0
  4. data/cv.gemspec +29 -0
  5. data/lib/cv.rb +15 -0
  6. data/lib/cv/config/assets.yml +19 -0
  7. data/lib/cv/contact.rb +19 -0
  8. data/lib/cv/content.rb +19 -0
  9. data/lib/cv/ext/blank.rb +5 -0
  10. data/lib/cv/ext/hash.rb +5 -0
  11. data/lib/cv/public/images/bg.jpg +0 -0
  12. data/lib/cv/public/images/colors/celestial_sky.png +0 -0
  13. data/lib/cv/public/images/colors/charcoal_black.png +0 -0
  14. data/lib/cv/public/images/colors/dark_indigo.png +0 -0
  15. data/lib/cv/public/images/colors/dark_indigo_arrow_center.png +0 -0
  16. data/lib/cv/public/images/colors/dark_indigo_arrow_left.png +0 -0
  17. data/lib/cv/public/images/colors/dark_indigo_arrow_right.png +0 -0
  18. data/lib/cv/public/images/colors/dark_violet.png +0 -0
  19. data/lib/cv/public/images/colors/electric_blue.png +0 -0
  20. data/lib/cv/public/images/colors/light_indigo.png +0 -0
  21. data/lib/cv/public/images/colors/lime_green.png +0 -0
  22. data/lib/cv/public/images/colors/lobster_red.png +0 -0
  23. data/lib/cv/public/images/colors/olive_green.png +0 -0
  24. data/lib/cv/public/images/colors/orange_peel.png +0 -0
  25. data/lib/cv/public/images/colors/royal_magenta.png +0 -0
  26. data/lib/cv/public/images/colors/scarlet_red.png +0 -0
  27. data/lib/cv/public/images/colors/silver_grey.png +0 -0
  28. data/lib/cv/public/images/curriculum_bg.png +0 -0
  29. data/lib/cv/public/images/fancybox/blank.gif +0 -0
  30. data/lib/cv/public/images/fancybox/fancy_close.png +0 -0
  31. data/lib/cv/public/images/fancybox/fancy_loading.png +0 -0
  32. data/lib/cv/public/images/fancybox/fancy_nav_left.png +0 -0
  33. data/lib/cv/public/images/fancybox/fancy_nav_right.png +0 -0
  34. data/lib/cv/public/images/fancybox/fancy_shadow_e.png +0 -0
  35. data/lib/cv/public/images/fancybox/fancy_shadow_n.png +0 -0
  36. data/lib/cv/public/images/fancybox/fancy_shadow_ne.png +0 -0
  37. data/lib/cv/public/images/fancybox/fancy_shadow_nw.png +0 -0
  38. data/lib/cv/public/images/fancybox/fancy_shadow_s.png +0 -0
  39. data/lib/cv/public/images/fancybox/fancy_shadow_se.png +0 -0
  40. data/lib/cv/public/images/fancybox/fancy_shadow_sw.png +0 -0
  41. data/lib/cv/public/images/fancybox/fancy_shadow_w.png +0 -0
  42. data/lib/cv/public/images/fancybox/fancy_title_left.png +0 -0
  43. data/lib/cv/public/images/fancybox/fancy_title_main.png +0 -0
  44. data/lib/cv/public/images/fancybox/fancy_title_over.png +0 -0
  45. data/lib/cv/public/images/fancybox/fancy_title_right.png +0 -0
  46. data/lib/cv/public/images/fancybox/fancybox-x.png +0 -0
  47. data/lib/cv/public/images/fancybox/fancybox-y.png +0 -0
  48. data/lib/cv/public/images/fancybox/fancybox.png +0 -0
  49. data/lib/cv/public/images/shadow.png +0 -0
  50. data/lib/cv/public/images/social/download.png +0 -0
  51. data/lib/cv/public/images/social/email.png +0 -0
  52. data/lib/cv/public/images/social/facebook.png +0 -0
  53. data/lib/cv/public/images/social/flickr.png +0 -0
  54. data/lib/cv/public/images/social/friendfeed.png +0 -0
  55. data/lib/cv/public/images/social/google.png +0 -0
  56. data/lib/cv/public/images/social/linkedin.png +0 -0
  57. data/lib/cv/public/images/social/msn.png +0 -0
  58. data/lib/cv/public/images/social/myspace.png +0 -0
  59. data/lib/cv/public/images/social/skype.png +0 -0
  60. data/lib/cv/public/images/social/twitter.png +0 -0
  61. data/lib/cv/public/images/social/yahoo.png +0 -0
  62. data/lib/cv/public/images/social/youtube.png +0 -0
  63. data/lib/cv/public/javascripts/Delicious_500-Delicious_700-Delicious_italic_500-Delicious_italic_700.font.js +28 -0
  64. data/lib/cv/public/javascripts/application.js +151 -0
  65. data/lib/cv/public/javascripts/cufon_yui.js +7 -0
  66. data/lib/cv/public/javascripts/jquery-1.5.1.js +8316 -0
  67. data/lib/cv/public/javascripts/jquery.easing-1.3.pack.js +72 -0
  68. data/lib/cv/public/javascripts/jquery.fancybox-1.3.4.js +1156 -0
  69. data/lib/cv/public/javascripts/jquery_mail.js +63 -0
  70. data/lib/cv/public/javascripts/json2.js +480 -0
  71. data/lib/cv/public/javascripts/packaged/e1819cfc_all.js +554 -0
  72. data/lib/cv/public/javascripts/scroll-follow.js +251 -0
  73. data/lib/cv/public/javascripts/scroll.js +69 -0
  74. data/lib/cv/public/javascripts/ui.core.js +291 -0
  75. data/lib/cv/public/stylesheets/960.css +338 -0
  76. data/lib/cv/public/stylesheets/colors/dark_indigo.css +11 -0
  77. data/lib/cv/public/stylesheets/jquery.fancybox-1.3.4.css +359 -0
  78. data/lib/cv/public/stylesheets/packaged/b32e3f66_all.css +1 -0
  79. data/lib/cv/public/stylesheets/print.css +425 -0
  80. data/lib/cv/public/stylesheets/reset.css +38 -0
  81. data/lib/cv/public/stylesheets/style.css +446 -0
  82. data/lib/cv/site.rb +31 -0
  83. data/lib/cv/version.rb +3 -0
  84. data/lib/cv/views/default.haml +14 -0
  85. data/lib/cv/views/index.haml +123 -0
  86. data/lib/cv/views/sitemap.haml +7 -0
  87. metadata +250 -0
@@ -0,0 +1,251 @@
1
+ /**
2
+ * jquery.scrollFollow.js
3
+ * Copyright (c) 2008 Net Perspective (http://kitchen.net-perspective.com/)
4
+ * Licensed under the MIT License (http://www.opensource.org/licenses/mit-license.php)
5
+ *
6
+ * @author R.A. Ray
7
+ *
8
+ * @projectDescription jQuery plugin for allowing an element to animate down as the user scrolls the page.
9
+ *
10
+ * @version 0.4.0
11
+ *
12
+ * @requires jquery.js (tested with 1.2.6)
13
+ * @requires ui.core.js (tested with 1.5.2)
14
+ *
15
+ * @optional jquery.cookie.js (http://www.stilbuero.de/2006/09/17/cookie-plugin-for-jquery/)
16
+ * @optional jquery.easing.js (http://gsgd.co.uk/sandbox/jquery/easing/ - tested with 1.3)
17
+ *
18
+ * @param speed int - Duration of animation (in milliseconds)
19
+ * default: 500
20
+ * @param offset int - Number of pixels box should remain from top of viewport
21
+ * default: 0
22
+ * @param easing string - Any one of the easing options from the easing plugin - Requires jQuery Easing Plugin < http://gsgd.co.uk/sandbox/jquery/easing/ >
23
+ * default: 'linear'
24
+ * @param container string - ID of the containing div
25
+ * default: box's immediate parent
26
+ * @param killSwitch string - ID of the On/Off toggle element
27
+ * default: 'killSwitch'
28
+ * @param onText string - killSwitch text to be displayed if sliding is enabled
29
+ * default: 'Turn Slide Off'
30
+ * @param offText string - killSwitch text to be displayed if sliding is disabled
31
+ * default: 'Turn Slide On'
32
+ * @param relativeTo string - Scroll animation can be relative to either the 'top' or 'bottom' of the viewport
33
+ * default: 'top'
34
+ * @param delay int - Time between the end of the scroll and the beginning of the animation in milliseconds
35
+ * default: 0
36
+ */
37
+
38
+ ( function( $ ) {
39
+
40
+ $.scrollFollow = function ( box, options )
41
+ {
42
+ // Convert box into a jQuery object
43
+ box = $( box );
44
+
45
+ // 'box' is the object to be animated
46
+ var position = box.css( 'position' );
47
+
48
+ function ani()
49
+ {
50
+ // The script runs on every scroll which really means many times during a scroll.
51
+ // We don't want multiple slides to queue up.
52
+ box.queue( [ ] );
53
+
54
+ // A bunch of values we need to determine where to animate to
55
+ var viewportHeight = parseInt( $( window ).height() );
56
+ var pageScroll = parseInt( $( document ).scrollTop() );
57
+ var parentTop = parseInt( box.cont.offset().top );
58
+ var parentHeight = parseInt( box.cont.attr( 'offsetHeight' ) );
59
+ var boxHeight = parseInt( box.attr( 'offsetHeight' ) + ( parseInt( box.css( 'marginTop' ) ) || 0 ) + ( parseInt( box.css( 'marginBottom' ) ) || 0 ) );
60
+ var aniTop;
61
+
62
+ // Make sure the user wants the animation to happen
63
+ if ( isActive )
64
+ {
65
+ // If the box should animate relative to the top of the window
66
+ if ( options.relativeTo == 'top' )
67
+ {
68
+ // Don't animate until the top of the window is close enough to the top of the box
69
+ if ( box.initialOffsetTop >= ( pageScroll + options.offset ) )
70
+ {
71
+ aniTop = box.initialTop;
72
+ }
73
+ else
74
+ {
75
+ aniTop = Math.min( ( Math.max( ( -parentTop ), ( pageScroll - box.initialOffsetTop + box.initialTop ) ) + options.offset ), ( parentHeight - boxHeight - box.paddingAdjustment ) );
76
+ }
77
+ }
78
+ // If the box should animate relative to the bottom of the window
79
+ else if ( options.relativeTo == 'bottom' )
80
+ {
81
+ // Don't animate until the bottom of the window is close enough to the bottom of the box
82
+ if ( ( box.initialOffsetTop + boxHeight ) >= ( pageScroll + options.offset + viewportHeight ) )
83
+ {
84
+ aniTop = box.initialTop;
85
+ }
86
+ else
87
+ {
88
+ aniTop = Math.min( ( pageScroll + viewportHeight - boxHeight - options.offset ), ( parentHeight - boxHeight ) );
89
+ }
90
+ }
91
+
92
+ // Checks to see if the relevant scroll was the last one
93
+ // "-20" is to account for inaccuracy in the timeout
94
+ if ( ( new Date().getTime() - box.lastScroll ) >= ( options.delay - 20 ) )
95
+ {
96
+ box.animate(
97
+ {
98
+ top: aniTop
99
+ }, options.speed, options.easing
100
+ );
101
+ }
102
+ }
103
+ };
104
+
105
+ // For user-initiated stopping of the slide
106
+ var isActive = true;
107
+
108
+ if ( $.cookie != undefined )
109
+ {
110
+ if( $.cookie( 'scrollFollowSetting' + box.attr( 'id' ) ) == 'false' )
111
+ {
112
+ var isActive = false;
113
+
114
+ $( '#' + options.killSwitch ).text( options.offText )
115
+ .toggle(
116
+ function ()
117
+ {
118
+ isActive = true;
119
+
120
+ $( this ).text( options.onText );
121
+
122
+ $.cookie( 'scrollFollowSetting' + box.attr( 'id' ), true, { expires: 365, path: '/'} );
123
+
124
+ ani();
125
+ },
126
+ function ()
127
+ {
128
+ isActive = false;
129
+
130
+ $( this ).text( options.offText );
131
+
132
+ box.animate(
133
+ {
134
+ top: box.initialTop
135
+ }, options.speed, options.easing
136
+ );
137
+
138
+ $.cookie( 'scrollFollowSetting' + box.attr( 'id' ), false, { expires: 365, path: '/'} );
139
+ }
140
+ );
141
+ }
142
+ else
143
+ {
144
+ $( '#' + options.killSwitch ).text( options.onText )
145
+ .toggle(
146
+ function ()
147
+ {
148
+ isActive = false;
149
+
150
+ $( this ).text( options.offText );
151
+
152
+ box.animate(
153
+ {
154
+ top: box.initialTop
155
+ }, 0
156
+ );
157
+
158
+ $.cookie( 'scrollFollowSetting' + box.attr( 'id' ), false, { expires: 365, path: '/'} );
159
+ },
160
+ function ()
161
+ {
162
+ isActive = true;
163
+
164
+ $( this ).text( options.onText );
165
+
166
+ $.cookie( 'scrollFollowSetting' + box.attr( 'id' ), true, { expires: 365, path: '/'} );
167
+
168
+ ani();
169
+ }
170
+ );
171
+ }
172
+ }
173
+
174
+ // If no parent ID was specified, and the immediate parent does not have an ID
175
+ // options.container will be undefined. So we need to figure out the parent element.
176
+ if ( options.container == '')
177
+ {
178
+ box.cont = box.parent();
179
+ }
180
+ else
181
+ {
182
+ box.cont = $( '#' + options.container );
183
+ }
184
+
185
+ // Finds the default positioning of the box.
186
+ box.initialOffsetTop = parseInt( box.offset().top );
187
+ box.initialTop = parseInt( box.css( 'top' ) ) || 0;
188
+
189
+ // Hack to fix different treatment of boxes positioned 'absolute' and 'relative'
190
+ if ( box.css( 'position' ) == 'relative' )
191
+ {
192
+ box.paddingAdjustment = parseInt( box.cont.css( 'paddingTop' ) ) + parseInt( box.cont.css( 'paddingBottom' ) );
193
+ }
194
+ else
195
+ {
196
+ box.paddingAdjustment = 0;
197
+ }
198
+
199
+ // Animate the box when the page is scrolled
200
+ $( window ).scroll( function ()
201
+ {
202
+ // Sets up the delay of the animation
203
+ $.fn.scrollFollow.interval = setTimeout( function(){ ani();} , options.delay );
204
+
205
+ // To check against right before setting the animation
206
+ box.lastScroll = new Date().getTime();
207
+ }
208
+ );
209
+
210
+ // Animate the box when the page is resized
211
+ $( window ).resize( function ()
212
+ {
213
+ // Sets up the delay of the animation
214
+ $.fn.scrollFollow.interval = setTimeout( function(){ ani();} , options.delay );
215
+
216
+ // To check against right before setting the animation
217
+ box.lastScroll = new Date().getTime();
218
+ }
219
+ );
220
+
221
+ // Run an initial animation on page load
222
+ box.lastScroll = 0;
223
+
224
+ ani();
225
+ };
226
+
227
+ $.fn.scrollFollow = function ( options )
228
+ {
229
+ options = options || {};
230
+ options.relativeTo = options.relativeTo || 'top';
231
+ options.speed = options.speed || 500;
232
+ options.offset = options.offset || 0;
233
+ options.easing = options.easing || 'swing';
234
+ options.container = options.container || this.parent().attr( 'id' );
235
+ options.killSwitch = options.killSwitch || 'killSwitch';
236
+ options.onText = options.onText || 'Turn Slide Off';
237
+ options.offText = options.offText || 'Turn Slide On';
238
+ options.delay = options.delay || 0;
239
+
240
+ this.each( function()
241
+ {
242
+ new $.scrollFollow( this, options );
243
+ }
244
+ );
245
+
246
+ return this;
247
+ };
248
+ })( jQuery );
249
+
250
+
251
+
@@ -0,0 +1,69 @@
1
+ (function(){
2
+
3
+ var special = jQuery.event.special,
4
+ uid1 = 'D' + (+new Date()),
5
+ uid2 = 'D' + (+new Date() + 1);
6
+
7
+ special.scrollstart = {
8
+ setup: function() {
9
+
10
+ var timer,
11
+ handler = function(evt) {
12
+
13
+ var _self = this,
14
+ _args = arguments;
15
+
16
+ if (timer) {
17
+ clearTimeout(timer);
18
+ } else {
19
+ evt.type = 'scrollstart';
20
+ jQuery.event.handle.apply(_self, _args);
21
+ }
22
+
23
+ timer = setTimeout( function(){
24
+ timer = null;
25
+ }, special.scrollstop.latency);
26
+
27
+ };
28
+
29
+ jQuery(this).bind('scroll', handler).data(uid1, handler);
30
+
31
+ },
32
+ teardown: function(){
33
+ jQuery(this).unbind( 'scroll', jQuery(this).data(uid1) );
34
+ }
35
+ };
36
+
37
+ special.scrollstop = {
38
+ latency: 300,
39
+ setup: function() {
40
+
41
+ var timer,
42
+ handler = function(evt) {
43
+
44
+ var _self = this,
45
+ _args = arguments;
46
+
47
+ if (timer) {
48
+ clearTimeout(timer);
49
+ }
50
+
51
+ timer = setTimeout( function(){
52
+
53
+ timer = null;
54
+ evt.type = 'scrollstop';
55
+ jQuery.event.handle.apply(_self, _args);
56
+
57
+ }, special.scrollstop.latency);
58
+
59
+ };
60
+
61
+ jQuery(this).bind('scroll', handler).data(uid2, handler);
62
+
63
+ },
64
+ teardown: function() {
65
+ jQuery(this).unbind( 'scroll', jQuery(this).data(uid2) );
66
+ }
67
+ };
68
+
69
+ })();
@@ -0,0 +1,291 @@
1
+ /*
2
+ * jQuery UI 1.5.2
3
+ *
4
+ * Copyright (c) 2008 Paul Bakaus (ui.jquery.com)
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI
9
+ */
10
+ ;(function($) {
11
+
12
+ $.ui = {
13
+ plugin: {
14
+ add: function(module, option, set) {
15
+ var proto = $.ui[module].prototype;
16
+ for(var i in set) {
17
+ proto.plugins[i] = proto.plugins[i] || [];
18
+ proto.plugins[i].push([option, set[i]]);
19
+ }
20
+ },
21
+ call: function(instance, name, args) {
22
+ var set = instance.plugins[name];
23
+ if(!set) { return; }
24
+
25
+ for (var i = 0; i < set.length; i++) {
26
+ if (instance.options[set[i][0]]) {
27
+ set[i][1].apply(instance.element, args);
28
+ }
29
+ }
30
+ }
31
+ },
32
+ cssCache: {},
33
+ css: function(name) {
34
+ if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }
35
+ var tmp = $('<div class="ui-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body');
36
+
37
+ //if (!$.browser.safari)
38
+ //tmp.appendTo('body');
39
+
40
+ //Opera and Safari set width and height to 0px instead of auto
41
+ //Safari returns rgba(0,0,0,0) when bgcolor is not set
42
+ $.ui.cssCache[name] = !!(
43
+ (!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) ||
44
+ !(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))
45
+ );
46
+ try { $('body').get(0).removeChild(tmp.get(0)); } catch(e){}
47
+ return $.ui.cssCache[name];
48
+ },
49
+ disableSelection: function(el) {
50
+ $(el).attr('unselectable', 'on').css('MozUserSelect', 'none');
51
+ },
52
+ enableSelection: function(el) {
53
+ $(el).attr('unselectable', 'off').css('MozUserSelect', '');
54
+ },
55
+ hasScroll: function(e, a) {
56
+ var scroll = /top/.test(a||"top") ? 'scrollTop' : 'scrollLeft', has = false;
57
+ if (e[scroll] > 0) return true; e[scroll] = 1;
58
+ has = e[scroll] > 0 ? true : false; e[scroll] = 0;
59
+ return has;
60
+ }
61
+ };
62
+
63
+
64
+ /** jQuery core modifications and additions **/
65
+
66
+ var _remove = $.fn.remove;
67
+ $.fn.remove = function() {
68
+ $("*", this).add(this).triggerHandler("remove");
69
+ return _remove.apply(this, arguments );
70
+ };
71
+
72
+ // $.widget is a factory to create jQuery plugins
73
+ // taking some boilerplate code out of the plugin code
74
+ // created by Scott González and Jörn Zaefferer
75
+ function getter(namespace, plugin, method) {
76
+ var methods = $[namespace][plugin].getter || [];
77
+ methods = (typeof methods == "string" ? methods.split(/,?\s+/) : methods);
78
+ return ($.inArray(method, methods) != -1);
79
+ }
80
+
81
+ $.widget = function(name, prototype) {
82
+ var namespace = name.split(".")[0];
83
+ name = name.split(".")[1];
84
+
85
+ // create plugin method
86
+ $.fn[name] = function(options) {
87
+ var isMethodCall = (typeof options == 'string'),
88
+ args = Array.prototype.slice.call(arguments, 1);
89
+
90
+ if (isMethodCall && getter(namespace, name, options)) {
91
+ var instance = $.data(this[0], name);
92
+ return (instance ? instance[options].apply(instance, args)
93
+ : undefined);
94
+ }
95
+
96
+ return this.each(function() {
97
+ var instance = $.data(this, name);
98
+ if (isMethodCall && instance && $.isFunction(instance[options])) {
99
+ instance[options].apply(instance, args);
100
+ } else if (!isMethodCall) {
101
+ $.data(this, name, new $[namespace][name](this, options));
102
+ }
103
+ });
104
+ };
105
+
106
+ // create widget constructor
107
+ $[namespace][name] = function(element, options) {
108
+ var self = this;
109
+
110
+ this.widgetName = name;
111
+ this.widgetBaseClass = namespace + '-' + name;
112
+
113
+ this.options = $.extend({}, $.widget.defaults, $[namespace][name].defaults, options);
114
+ this.element = $(element)
115
+ .bind('setData.' + name, function(e, key, value) {
116
+ return self.setData(key, value);
117
+ })
118
+ .bind('getData.' + name, function(e, key) {
119
+ return self.getData(key);
120
+ })
121
+ .bind('remove', function() {
122
+ return self.destroy();
123
+ });
124
+ this.init();
125
+ };
126
+
127
+ // add widget prototype
128
+ $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
129
+ };
130
+
131
+ $.widget.prototype = {
132
+ init: function() {},
133
+ destroy: function() {
134
+ this.element.removeData(this.widgetName);
135
+ },
136
+
137
+ getData: function(key) {
138
+ return this.options[key];
139
+ },
140
+ setData: function(key, value) {
141
+ this.options[key] = value;
142
+
143
+ if (key == 'disabled') {
144
+ this.element[value ? 'addClass' : 'removeClass'](
145
+ this.widgetBaseClass + '-disabled');
146
+ }
147
+ },
148
+
149
+ enable: function() {
150
+ this.setData('disabled', false);
151
+ },
152
+ disable: function() {
153
+ this.setData('disabled', true);
154
+ }
155
+ };
156
+
157
+ $.widget.defaults = {
158
+ disabled: false
159
+ };
160
+
161
+
162
+ /** Mouse Interaction Plugin **/
163
+
164
+ $.ui.mouse = {
165
+ mouseInit: function() {
166
+ var self = this;
167
+
168
+ this.element.bind('mousedown.'+this.widgetName, function(e) {
169
+ return self.mouseDown(e);
170
+ });
171
+
172
+ // Prevent text selection in IE
173
+ if ($.browser.msie) {
174
+ this._mouseUnselectable = this.element.attr('unselectable');
175
+ this.element.attr('unselectable', 'on');
176
+ }
177
+
178
+ this.started = false;
179
+ },
180
+
181
+ // TODO: make sure destroying one instance of mouse doesn't mess with
182
+ // other instances of mouse
183
+ mouseDestroy: function() {
184
+ this.element.unbind('.'+this.widgetName);
185
+
186
+ // Restore text selection in IE
187
+ ($.browser.msie
188
+ && this.element.attr('unselectable', this._mouseUnselectable));
189
+ },
190
+
191
+ mouseDown: function(e) {
192
+ // we may have missed mouseup (out of window)
193
+ (this._mouseStarted && this.mouseUp(e));
194
+
195
+ this._mouseDownEvent = e;
196
+
197
+ var self = this,
198
+ btnIsLeft = (e.which == 1),
199
+ elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false);
200
+ if (!btnIsLeft || elIsCancel || !this.mouseCapture(e)) {
201
+ return true;
202
+ }
203
+
204
+ this._mouseDelayMet = !this.options.delay;
205
+ if (!this._mouseDelayMet) {
206
+ this._mouseDelayTimer = setTimeout(function() {
207
+ self._mouseDelayMet = true;
208
+ }, this.options.delay);
209
+ }
210
+
211
+ if (this.mouseDistanceMet(e) && this.mouseDelayMet(e)) {
212
+ this._mouseStarted = (this.mouseStart(e) !== false);
213
+ if (!this._mouseStarted) {
214
+ e.preventDefault();
215
+ return true;
216
+ }
217
+ }
218
+
219
+ // these delegates are required to keep context
220
+ this._mouseMoveDelegate = function(e) {
221
+ return self.mouseMove(e);
222
+ };
223
+ this._mouseUpDelegate = function(e) {
224
+ return self.mouseUp(e);
225
+ };
226
+ $(document)
227
+ .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
228
+ .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
229
+
230
+ return false;
231
+ },
232
+
233
+ mouseMove: function(e) {
234
+ // IE mouseup check - mouseup happened when mouse was out of window
235
+ if ($.browser.msie && !e.button) {
236
+ return this.mouseUp(e);
237
+ }
238
+
239
+ if (this._mouseStarted) {
240
+ this.mouseDrag(e);
241
+ return false;
242
+ }
243
+
244
+ if (this.mouseDistanceMet(e) && this.mouseDelayMet(e)) {
245
+ this._mouseStarted =
246
+ (this.mouseStart(this._mouseDownEvent, e) !== false);
247
+ (this._mouseStarted ? this.mouseDrag(e) : this.mouseUp(e));
248
+ }
249
+
250
+ return !this._mouseStarted;
251
+ },
252
+
253
+ mouseUp: function(e) {
254
+ $(document)
255
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
256
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
257
+
258
+ if (this._mouseStarted) {
259
+ this._mouseStarted = false;
260
+ this.mouseStop(e);
261
+ }
262
+
263
+ return false;
264
+ },
265
+
266
+ mouseDistanceMet: function(e) {
267
+ return (Math.max(
268
+ Math.abs(this._mouseDownEvent.pageX - e.pageX),
269
+ Math.abs(this._mouseDownEvent.pageY - e.pageY)
270
+ ) >= this.options.distance
271
+ );
272
+ },
273
+
274
+ mouseDelayMet: function(e) {
275
+ return this._mouseDelayMet;
276
+ },
277
+
278
+ // These are placeholder methods, to be overriden by extending plugin
279
+ mouseStart: function(e) {},
280
+ mouseDrag: function(e) {},
281
+ mouseStop: function(e) {},
282
+ mouseCapture: function(e) { return true; }
283
+ };
284
+
285
+ $.ui.mouse.defaults = {
286
+ cancel: null,
287
+ distance: 1,
288
+ delay: 0
289
+ };
290
+
291
+ })(jQuery);