rep.jquery 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/.gitignore +25 -0
  2. data/LICENSE +20 -0
  3. data/README +1 -0
  4. data/Rakefile +19 -0
  5. data/TODO +0 -0
  6. data/VERSION +1 -0
  7. data/lib/jquery.rb +1 -0
  8. data/public/images/jquery.tablesorter.blue/asc.gif +0 -0
  9. data/public/images/jquery.tablesorter.blue/bg.gif +0 -0
  10. data/public/images/jquery.tablesorter.blue/desc.gif +0 -0
  11. data/public/images/jquery.tablesorter.blue/style.css +39 -0
  12. data/public/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  13. data/public/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  14. data/public/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  15. data/public/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  16. data/public/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  17. data/public/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  18. data/public/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  19. data/public/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  20. data/public/images/ui-icons_222222_256x240.png +0 -0
  21. data/public/images/ui-icons_2e83ff_256x240.png +0 -0
  22. data/public/images/ui-icons_454545_256x240.png +0 -0
  23. data/public/images/ui-icons_888888_256x240.png +0 -0
  24. data/public/images/ui-icons_cd0a0a_256x240.png +0 -0
  25. data/public/javascripts/jquery/autogrow.js +134 -0
  26. data/public/javascripts/jquery/easing.js +207 -0
  27. data/public/javascripts/jquery/form.js +639 -0
  28. data/public/javascripts/jquery/jeditable.autogrow.js +41 -0
  29. data/public/javascripts/jquery/jeditable.js +545 -0
  30. data/public/javascripts/jquery/metadata.js +150 -0
  31. data/public/javascripts/jquery/scrollTo.js +217 -0
  32. data/public/javascripts/jquery/suggest.js +314 -0
  33. data/public/javascripts/jquery/tablesorter.patched.js +866 -0
  34. data/public/javascripts/jquery/template.js +93 -0
  35. data/public/javascripts/jquery/tooltip.js +296 -0
  36. data/public/javascripts/jquery/ui.all.js +300 -0
  37. data/public/javascripts/jquery.js +4376 -0
  38. data/public/stylesheets/jquery-ui.css +404 -0
  39. data/public/stylesheets/jquery.suggest.css +29 -0
  40. data/rep.jquery.gemspec +81 -0
  41. metadata +119 -0
@@ -0,0 +1,217 @@
1
+ //= require "../jquery"
2
+
3
+ /**
4
+ * jQuery.ScrollTo
5
+ * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
6
+ * Dual licensed under MIT and GPL.
7
+ * Date: 5/25/2009
8
+ *
9
+ * @projectDescription Easy element scrolling using jQuery.
10
+ * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
11
+ * Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
12
+ *
13
+ * @author Ariel Flesler
14
+ * @version 1.4.2
15
+ *
16
+ * @id jQuery.scrollTo
17
+ * @id jQuery.fn.scrollTo
18
+ * @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
19
+ * The different options for target are:
20
+ * - A number position (will be applied to all axes).
21
+ * - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
22
+ * - A jQuery/DOM element ( logically, child of the element to scroll )
23
+ * - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
24
+ * - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
25
+ * - A percentage of the container's dimension/s, for example: 50% to go to the middle.
26
+ * - The string 'max' for go-to-end.
27
+ * @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
28
+ * @param {Object,Function} settings Optional set of settings or the onAfter callback.
29
+ * @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
30
+ * @option {Number} duration The OVERALL length of the animation.
31
+ * @option {String} easing The easing method for the animation.
32
+ * @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
33
+ * @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
34
+ * @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
35
+ * @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
36
+ * @option {Function} onAfter Function to be called after the scrolling ends.
37
+ * @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
38
+ * @return {jQuery} Returns the same jQuery object, for chaining.
39
+ *
40
+ * @desc Scroll to a fixed position
41
+ * @example $('div').scrollTo( 340 );
42
+ *
43
+ * @desc Scroll relatively to the actual position
44
+ * @example $('div').scrollTo( '+=340px', { axis:'y' } );
45
+ *
46
+ * @dec Scroll using a selector (relative to the scrolled element)
47
+ * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
48
+ *
49
+ * @ Scroll to a DOM element (same for jQuery object)
50
+ * @example var second_child = document.getElementById('container').firstChild.nextSibling;
51
+ * $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
52
+ * alert('scrolled!!');
53
+ * }});
54
+ *
55
+ * @desc Scroll on both axes, to different values
56
+ * @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
57
+ */
58
+ ;(function( $ ){
59
+
60
+ var $scrollTo = $.scrollTo = function( target, duration, settings ){
61
+ $(window).scrollTo( target, duration, settings );
62
+ };
63
+
64
+ $scrollTo.defaults = {
65
+ axis:'xy',
66
+ duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
67
+ };
68
+
69
+ // Returns the element that needs to be animated to scroll the window.
70
+ // Kept for backwards compatibility (specially for localScroll & serialScroll)
71
+ $scrollTo.window = function( scope ){
72
+ return $(window)._scrollable();
73
+ };
74
+
75
+ // Hack, hack, hack :)
76
+ // Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
77
+ $.fn._scrollable = function(){
78
+ return this.map(function(){
79
+ var elem = this,
80
+ isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;
81
+
82
+ if( !isWin )
83
+ return elem;
84
+
85
+ var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
86
+
87
+ return $.browser.safari || doc.compatMode == 'BackCompat' ?
88
+ doc.body :
89
+ doc.documentElement;
90
+ });
91
+ };
92
+
93
+ $.fn.scrollTo = function( target, duration, settings ){
94
+ if( typeof duration == 'object' ){
95
+ settings = duration;
96
+ duration = 0;
97
+ }
98
+ if( typeof settings == 'function' )
99
+ settings = { onAfter:settings };
100
+
101
+ if( target == 'max' )
102
+ target = 9e9;
103
+
104
+ settings = $.extend( {}, $scrollTo.defaults, settings );
105
+ // Speed is still recognized for backwards compatibility
106
+ duration = duration || settings.speed || settings.duration;
107
+ // Make sure the settings are given right
108
+ settings.queue = settings.queue && settings.axis.length > 1;
109
+
110
+ if( settings.queue )
111
+ // Let's keep the overall duration
112
+ duration /= 2;
113
+ settings.offset = both( settings.offset );
114
+ settings.over = both( settings.over );
115
+
116
+ return this._scrollable().each(function(){
117
+ var elem = this,
118
+ $elem = $(elem),
119
+ targ = target, toff, attr = {},
120
+ win = $elem.is('html,body');
121
+
122
+ switch( typeof targ ){
123
+ // A number will pass the regex
124
+ case 'number':
125
+ case 'string':
126
+ if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){
127
+ targ = both( targ );
128
+ // We are done
129
+ break;
130
+ }
131
+ // Relative selector, no break!
132
+ targ = $(targ,this);
133
+ case 'object':
134
+ // DOMElement / jQuery
135
+ if( targ.is || targ.style )
136
+ // Get the real position of the target
137
+ toff = (targ = $(targ)).offset();
138
+ }
139
+ $.each( settings.axis.split(''), function( i, axis ){
140
+ var Pos = axis == 'x' ? 'Left' : 'Top',
141
+ pos = Pos.toLowerCase(),
142
+ key = 'scroll' + Pos,
143
+ old = elem[key],
144
+ max = $scrollTo.max(elem, axis);
145
+
146
+ if( toff ){// jQuery / DOMElement
147
+ attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );
148
+
149
+ // If it's a dom element, reduce the margin
150
+ if( settings.margin ){
151
+ attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
152
+ attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
153
+ }
154
+
155
+ attr[key] += settings.offset[pos] || 0;
156
+
157
+ if( settings.over[pos] )
158
+ // Scroll to a fraction of its width/height
159
+ attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos];
160
+ }else{
161
+ var val = targ[pos];
162
+ // Handle percentage values
163
+ attr[key] = val.slice && val.slice(-1) == '%' ?
164
+ parseFloat(val) / 100 * max
165
+ : val;
166
+ }
167
+
168
+ // Number or 'number'
169
+ if( /^\d+$/.test(attr[key]) )
170
+ // Check the limits
171
+ attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max );
172
+
173
+ // Queueing axes
174
+ if( !i && settings.queue ){
175
+ // Don't waste time animating, if there's no need.
176
+ if( old != attr[key] )
177
+ // Intermediate animation
178
+ animate( settings.onAfterFirst );
179
+ // Don't animate this axis again in the next iteration.
180
+ delete attr[key];
181
+ }
182
+ });
183
+
184
+ animate( settings.onAfter );
185
+
186
+ function animate( callback ){
187
+ $elem.animate( attr, duration, settings.easing, callback && function(){
188
+ callback.call(this, target, settings);
189
+ });
190
+ };
191
+
192
+ }).end();
193
+ };
194
+
195
+ // Max scrolling position, works on quirks mode
196
+ // It only fails (not too badly) on IE, quirks mode.
197
+ $scrollTo.max = function( elem, axis ){
198
+ var Dim = axis == 'x' ? 'Width' : 'Height',
199
+ scroll = 'scroll'+Dim;
200
+
201
+ if( !$(elem).is('html,body') )
202
+ return elem[scroll] - $(elem)[Dim.toLowerCase()]();
203
+
204
+ var size = 'client' + Dim,
205
+ html = elem.ownerDocument.documentElement,
206
+ body = elem.ownerDocument.body;
207
+
208
+ return Math.max( html[scroll], body[scroll] )
209
+ - Math.min( html[size] , body[size] );
210
+
211
+ };
212
+
213
+ function both( val ){
214
+ return typeof val == 'object' ? val : { top:val, left:val };
215
+ };
216
+
217
+ })( jQuery );
@@ -0,0 +1,314 @@
1
+ //= require "../jquery"
2
+
3
+
4
+ /*
5
+ * jquery.suggest 1.1 - 2007-08-06
6
+ *
7
+ * Uses code and techniques from following libraries:
8
+ * 1. http://www.dyve.net/jquery/?autocomplete
9
+ * 2. http://dev.jquery.com/browser/trunk/plugins/interface/iautocompleter.js
10
+ *
11
+ * All the new stuff written by Peter Vulgaris (www.vulgarisoip.com)
12
+ * Feel free to do whatever you want with this file
13
+ *
14
+ */
15
+
16
+ (function($) {
17
+
18
+ $.suggest = function(input, options) {
19
+
20
+ var $input = $(input).attr("autocomplete", "off");
21
+ var $results = $(document.createElement("ul"));
22
+
23
+ var timeout = false; // hold timeout ID for suggestion results to appear
24
+ var prevLength = 0; // last recorded length of $input.val()
25
+ var cache = []; // cache MRU list
26
+ var cacheSize = 0; // size of cache in chars (bytes?)
27
+
28
+ $results.addClass(options.resultsClass).appendTo('body');
29
+
30
+
31
+ resetPosition();
32
+ $(window)
33
+ .load(resetPosition) // just in case user is changing size of page while loading
34
+ .resize(resetPosition);
35
+
36
+ $input.blur(function() {
37
+ setTimeout(function() { $results.hide() }, 200);
38
+ });
39
+
40
+
41
+ // help IE users if possible
42
+ try {
43
+ $results.bgiframe();
44
+ } catch(e) { }
45
+
46
+
47
+ // I really hate browser detection, but I don't see any other way
48
+ if ($.browser.mozilla)
49
+ $input.keypress(processKey); // onkeypress repeats arrow keys in Mozilla/Opera
50
+ else
51
+ $input.keydown(processKey); // onkeydown repeats arrow keys in IE/Safari
52
+
53
+
54
+
55
+
56
+ function resetPosition() {
57
+ // requires jquery.dimension plugin
58
+ var offset = $input.offset();
59
+ $results.css({
60
+ top: (offset.top + input.offsetHeight) + 'px',
61
+ left: offset.left + 'px'
62
+ });
63
+ }
64
+
65
+
66
+ function processKey(e) {
67
+
68
+ // handling up/down/escape requires results to be visible
69
+ // handling enter/tab requires that AND a result to be selected
70
+ if ((/27$|38$|40$/.test(e.keyCode) && $results.is(':visible')) ||
71
+ (/^13$|^9$/.test(e.keyCode) && getCurrentResult())) {
72
+
73
+ if (e.preventDefault)
74
+ e.preventDefault();
75
+ if (e.stopPropagation)
76
+ e.stopPropagation();
77
+
78
+ e.cancelBubble = true;
79
+ e.returnValue = false;
80
+
81
+ switch(e.keyCode) {
82
+
83
+ case 38: // up
84
+ prevResult();
85
+ break;
86
+
87
+ case 40: // down
88
+ nextResult();
89
+ break;
90
+
91
+ case 9: // tab
92
+ case 13: // return
93
+ selectCurrentResult();
94
+ break;
95
+
96
+ case 27: // escape
97
+ $results.hide();
98
+ break;
99
+
100
+ }
101
+
102
+ } else if ($input.val().length != prevLength) {
103
+
104
+ if (timeout)
105
+ clearTimeout(timeout);
106
+ timeout = setTimeout(suggest, options.delay);
107
+ prevLength = $input.val().length;
108
+
109
+ }
110
+
111
+
112
+ }
113
+
114
+
115
+ function suggest() {
116
+
117
+ var q = $.trim($input.val());
118
+
119
+ if (q.length >= options.minchars) {
120
+
121
+ cached = checkCache(q);
122
+
123
+ if (cached) {
124
+
125
+ displayItems(cached['items']);
126
+
127
+ } else {
128
+
129
+ $.get(options.source, {q: q}, function(txt) {
130
+
131
+ $results.hide();
132
+
133
+ var items = parseTxt(txt, q);
134
+
135
+ displayItems(items);
136
+ addToCache(q, items, txt.length);
137
+
138
+ });
139
+
140
+ }
141
+
142
+ } else {
143
+
144
+ $results.hide();
145
+
146
+ }
147
+
148
+ }
149
+
150
+
151
+ function checkCache(q) {
152
+
153
+ for (var i = 0; i < cache.length; i++)
154
+ if (cache[i]['q'] == q) {
155
+ cache.unshift(cache.splice(i, 1)[0]);
156
+ return cache[0];
157
+ }
158
+
159
+ return false;
160
+
161
+ }
162
+
163
+ function addToCache(q, items, size) {
164
+
165
+ while (cache.length && (cacheSize + size > options.maxCacheSize)) {
166
+ var cached = cache.pop();
167
+ cacheSize -= cached['size'];
168
+ }
169
+
170
+ cache.push({
171
+ q: q,
172
+ size: size,
173
+ items: items
174
+ });
175
+
176
+ cacheSize += size;
177
+
178
+ }
179
+
180
+ function displayItems(items) {
181
+
182
+ if (!items)
183
+ return;
184
+
185
+ if (!items.length) {
186
+ $results.hide();
187
+ return;
188
+ }
189
+
190
+ var html = '';
191
+ for (var i = 0; i < items.length; i++)
192
+ html += '<li>' + items[i] + '</li>';
193
+
194
+ $results.html(html).show();
195
+
196
+ $results
197
+ .children('li')
198
+ .mouseover(function() {
199
+ $results.children('li').removeClass(options.selectClass);
200
+ $(this).addClass(options.selectClass);
201
+ })
202
+ .click(function(e) {
203
+ e.preventDefault();
204
+ e.stopPropagation();
205
+ selectCurrentResult();
206
+ });
207
+
208
+ }
209
+
210
+ function parseTxt(txt, q) {
211
+
212
+ var items = [];
213
+ var tokens = txt.split(options.delimiter);
214
+
215
+ // parse returned data for non-empty items
216
+ for (var i = 0; i < tokens.length; i++) {
217
+ var token = $.trim(tokens[i]);
218
+ if (token) {
219
+ token = token.replace(
220
+ new RegExp(q, 'ig'),
221
+ function(q) { return '<span class="' + options.matchClass + '">' + q + '</span>' }
222
+ );
223
+ items[items.length] = token;
224
+ }
225
+ }
226
+
227
+ return items;
228
+ }
229
+
230
+ function getCurrentResult() {
231
+
232
+ if (!$results.is(':visible'))
233
+ return false;
234
+
235
+ var $currentResult = $results.children('li.' + options.selectClass);
236
+
237
+ if (!$currentResult.length)
238
+ $currentResult = false;
239
+
240
+ return $currentResult;
241
+
242
+ }
243
+
244
+ function selectCurrentResult() {
245
+
246
+ $currentResult = getCurrentResult();
247
+
248
+ if ($currentResult) {
249
+ $input.val($currentResult.text());
250
+ $results.hide();
251
+
252
+ if (options.onSelect)
253
+ options.onSelect.apply($input[0]);
254
+
255
+ }
256
+
257
+ }
258
+
259
+ function nextResult() {
260
+
261
+ $currentResult = getCurrentResult();
262
+
263
+ if ($currentResult)
264
+ $currentResult
265
+ .removeClass(options.selectClass)
266
+ .next()
267
+ .addClass(options.selectClass);
268
+ else
269
+ $results.children('li:first-child').addClass(options.selectClass);
270
+
271
+ }
272
+
273
+ function prevResult() {
274
+
275
+ $currentResult = getCurrentResult();
276
+
277
+ if ($currentResult)
278
+ $currentResult
279
+ .removeClass(options.selectClass)
280
+ .prev()
281
+ .addClass(options.selectClass);
282
+ else
283
+ $results.children('li:last-child').addClass(options.selectClass);
284
+
285
+ }
286
+
287
+ }
288
+
289
+ $.fn.suggest = function(source, options) {
290
+
291
+ if (!source)
292
+ return;
293
+
294
+ options = options || {};
295
+ options.source = source;
296
+ options.delay = options.delay || 100;
297
+ options.resultsClass = options.resultsClass || 'ac_results';
298
+ options.selectClass = options.selectClass || 'ac_over';
299
+ options.matchClass = options.matchClass || 'ac_match';
300
+ options.minchars = options.minchars || 2;
301
+ options.delimiter = options.delimiter || '\n';
302
+ options.onSelect = options.onSelect || false;
303
+ options.maxCacheSize = options.maxCacheSize || 65536;
304
+
305
+ this.each(function() {
306
+ new $.suggest(this, options);
307
+ });
308
+
309
+ return this;
310
+
311
+ };
312
+
313
+ })(jQuery);
314
+