jquerypp-rails 1.0.1.1.rc3 → 1.0.2
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.
- data/README.markdown +28 -31
- data/lib/jquerypp/rails/version.rb +1 -1
- metadata +2 -25
- data/vendor/assets/javascripts/lib/jquery.animate.js +0 -326
- data/vendor/assets/javascripts/lib/jquery.compare.js +0 -75
- data/vendor/assets/javascripts/lib/jquery.cookie.js +0 -118
- data/vendor/assets/javascripts/lib/jquery.dimensions.js +0 -191
- data/vendor/assets/javascripts/lib/jquery.event.default.js +0 -115
- data/vendor/assets/javascripts/lib/jquery.event.destroyed.js +0 -23
- data/vendor/assets/javascripts/lib/jquery.event.drag.js +0 -727
- data/vendor/assets/javascripts/lib/jquery.event.drop.js +0 -457
- data/vendor/assets/javascripts/lib/jquery.event.fastfix.js +0 -95
- data/vendor/assets/javascripts/lib/jquery.event.hover.js +0 -266
- data/vendor/assets/javascripts/lib/jquery.event.key.js +0 -156
- data/vendor/assets/javascripts/lib/jquery.event.livehack.js +0 -174
- data/vendor/assets/javascripts/lib/jquery.event.pause.js +0 -92
- data/vendor/assets/javascripts/lib/jquery.event.resize.js +0 -47
- data/vendor/assets/javascripts/lib/jquery.event.swipe.js +0 -133
- data/vendor/assets/javascripts/lib/jquery.fills.js +0 -249
- data/vendor/assets/javascripts/lib/jquery.form_params.js +0 -167
- data/vendor/assets/javascripts/lib/jquery.lang.json.js +0 -196
- data/vendor/assets/javascripts/lib/jquery.lang.vector.js +0 -214
- data/vendor/assets/javascripts/lib/jquery.range.js +0 -861
- data/vendor/assets/javascripts/lib/jquery.selection.js +0 -232
- data/vendor/assets/javascripts/lib/jquery.styles.js +0 -103
- data/vendor/assets/javascripts/lib/jquery.within.js +0 -94
@@ -1,232 +0,0 @@
|
|
1
|
-
// Dependencies:
|
2
|
-
//
|
3
|
-
// - jquery.selection.js
|
4
|
-
// - jquery.range.js
|
5
|
-
// - jquery.compare.js
|
6
|
-
|
7
|
-
(function($){
|
8
|
-
|
9
|
-
var getWindow = function( element ) {
|
10
|
-
return element ? element.ownerDocument.defaultView || element.ownerDocument.parentWindow : window
|
11
|
-
},
|
12
|
-
// A helper that uses range to abstract out getting the current start and endPos.
|
13
|
-
getElementsSelection = function(el, win){
|
14
|
-
// get a copy of the current range and a range that spans the element
|
15
|
-
var current = $.Range.current(el).clone(),
|
16
|
-
entireElement = $.Range(el).select(el);
|
17
|
-
// if there is no overlap, there is nothing selected
|
18
|
-
if(!current.overlaps(entireElement)){
|
19
|
-
return null;
|
20
|
-
}
|
21
|
-
// if the current range starts before our element
|
22
|
-
if(current.compare("START_TO_START", entireElement) < 1){
|
23
|
-
// the selection within the element begins at 0
|
24
|
-
startPos = 0;
|
25
|
-
// move the current range to start at our element
|
26
|
-
current.move("START_TO_START",entireElement);
|
27
|
-
}else{
|
28
|
-
// Make a copy of the element's range.
|
29
|
-
// Move it's end to the start of the selected range
|
30
|
-
// The length of the copy is the start of the selected
|
31
|
-
// range.
|
32
|
-
fromElementToCurrent =entireElement.clone();
|
33
|
-
fromElementToCurrent.move("END_TO_START", current);
|
34
|
-
startPos = fromElementToCurrent.toString().length
|
35
|
-
}
|
36
|
-
|
37
|
-
// If the current range ends after our element
|
38
|
-
if(current.compare("END_TO_END", entireElement) >= 0){
|
39
|
-
// the end position is the last character
|
40
|
-
endPos = entireElement.toString().length
|
41
|
-
}else{
|
42
|
-
// otherwise, it's the start position plus the current range
|
43
|
-
// TODO: this doesn't seem like it works if current
|
44
|
-
// extends to the left of the element.
|
45
|
-
endPos = startPos+current.toString().length
|
46
|
-
}
|
47
|
-
return {
|
48
|
-
start: startPos,
|
49
|
-
end : endPos,
|
50
|
-
width : endPos - startPos
|
51
|
-
};
|
52
|
-
},
|
53
|
-
// Text selection works differently for selection in an input vs
|
54
|
-
// normal html elements like divs, spans, and ps.
|
55
|
-
// This function branches between the various methods of getting the selection.
|
56
|
-
getSelection = function(el){
|
57
|
-
var win = getWindow(el);
|
58
|
-
|
59
|
-
// `selectionStart` means this is an input element in a standards browser.
|
60
|
-
if (el.selectionStart !== undefined) {
|
61
|
-
|
62
|
-
if(document.activeElement
|
63
|
-
&& document.activeElement != el
|
64
|
-
&& el.selectionStart == el.selectionEnd
|
65
|
-
&& el.selectionStart == 0){
|
66
|
-
return {start: el.value.length, end: el.value.length, width: 0};
|
67
|
-
}
|
68
|
-
return {start: el.selectionStart, end: el.selectionEnd, width: el.selectionEnd - el.selectionStart};
|
69
|
-
}
|
70
|
-
// getSelection means a 'normal' element in a standards browser.
|
71
|
-
else if(win.getSelection){
|
72
|
-
return getElementsSelection(el, win)
|
73
|
-
} else{
|
74
|
-
// IE will freak out, where there is no way to detect it, so we provide a callback if it does.
|
75
|
-
try {
|
76
|
-
// The following typically works for input elements in IE:
|
77
|
-
if (el.nodeName.toLowerCase() == 'input') {
|
78
|
-
var real = getWindow(el).document.selection.createRange(),
|
79
|
-
r = el.createTextRange();
|
80
|
-
r.setEndPoint("EndToStart", real);
|
81
|
-
|
82
|
-
var start = r.text.length
|
83
|
-
return {
|
84
|
-
start: start,
|
85
|
-
end: start + real.text.length,
|
86
|
-
width: real.text.length
|
87
|
-
}
|
88
|
-
}
|
89
|
-
// This works on textareas and other elements
|
90
|
-
else {
|
91
|
-
var res = getElementsSelection(el,win)
|
92
|
-
if(!res){
|
93
|
-
return res;
|
94
|
-
}
|
95
|
-
// we have to clean up for ie's textareas which don't count for
|
96
|
-
// newlines correctly
|
97
|
-
var current = $.Range.current().clone(),
|
98
|
-
r2 = current.clone().collapse().range,
|
99
|
-
r3 = current.clone().collapse(false).range;
|
100
|
-
|
101
|
-
r2.moveStart('character', -1)
|
102
|
-
r3.moveStart('character', -1)
|
103
|
-
// if we aren't at the start, but previous is empty, we are at start of newline
|
104
|
-
if (res.startPos != 0 && r2.text == "") {
|
105
|
-
res.startPos += 2;
|
106
|
-
}
|
107
|
-
// do a similar thing for the end of the textarea
|
108
|
-
if (res.endPos != 0 && r3.text == "") {
|
109
|
-
res.endPos += 2;
|
110
|
-
}
|
111
|
-
|
112
|
-
return res
|
113
|
-
}
|
114
|
-
}catch(e){
|
115
|
-
return {start: el.value.length, end: el.value.length, width: 0};
|
116
|
-
}
|
117
|
-
}
|
118
|
-
},
|
119
|
-
// Selects text within an element. Depending if it's a form element or
|
120
|
-
// not, or a standards based browser or not, we do different things.
|
121
|
-
select = function( el, start, end ) {
|
122
|
-
var win = getWindow(el);
|
123
|
-
// IE behaves bad even if it sorta supports
|
124
|
-
// getSelection so we have to try the IE methods first. barf.
|
125
|
-
if(el.setSelectionRange){
|
126
|
-
if(end === undefined){
|
127
|
-
el.focus();
|
128
|
-
el.setSelectionRange(start, start);
|
129
|
-
} else {
|
130
|
-
el.select();
|
131
|
-
el.selectionStart = start;
|
132
|
-
el.selectionEnd = end;
|
133
|
-
}
|
134
|
-
} else if (el.createTextRange) {
|
135
|
-
var r = el.createTextRange();
|
136
|
-
r.moveStart('character', start);
|
137
|
-
end = end || start;
|
138
|
-
r.moveEnd('character', end - el.value.length);
|
139
|
-
|
140
|
-
r.select();
|
141
|
-
} else if(win.getSelection){
|
142
|
-
var doc = win.document,
|
143
|
-
sel = win.getSelection(),
|
144
|
-
range = doc.createRange(),
|
145
|
-
ranges = [start, end !== undefined ? end : start];
|
146
|
-
getCharElement([el],ranges);
|
147
|
-
range.setStart(ranges[0].el, ranges[0].count);
|
148
|
-
range.setEnd(ranges[1].el, ranges[1].count);
|
149
|
-
|
150
|
-
// removeAllRanges is necessary for webkit
|
151
|
-
sel.removeAllRanges();
|
152
|
-
sel.addRange(range);
|
153
|
-
|
154
|
-
} else if(win.document.body.createTextRange){ //IE's weirdness
|
155
|
-
var range = document.body.createTextRange();
|
156
|
-
range.moveToElementText(el);
|
157
|
-
range.collapse()
|
158
|
-
range.moveStart('character', start)
|
159
|
-
range.moveEnd('character', end !== undefined ? end : start)
|
160
|
-
range.select();
|
161
|
-
}
|
162
|
-
|
163
|
-
},
|
164
|
-
// If one of the range values is within start and len, replace the range
|
165
|
-
// value with the element and its offset.
|
166
|
-
replaceWithLess = function(start, len, range, el){
|
167
|
-
if(typeof range[0] === 'number' && range[0] < len){
|
168
|
-
range[0] = {
|
169
|
-
el: el,
|
170
|
-
count: range[0] - start
|
171
|
-
};
|
172
|
-
}
|
173
|
-
if(typeof range[1] === 'number' && range[1] <= len){
|
174
|
-
range[1] = {
|
175
|
-
el: el,
|
176
|
-
count: range[1] - start
|
177
|
-
};;
|
178
|
-
}
|
179
|
-
},
|
180
|
-
getCharElement = function( elems , range, len ) {
|
181
|
-
var elem,
|
182
|
-
start;
|
183
|
-
|
184
|
-
len = len || 0;
|
185
|
-
for ( var i = 0; elems[i]; i++ ) {
|
186
|
-
elem = elems[i];
|
187
|
-
// Get the text from text nodes and CDATA nodes
|
188
|
-
if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
|
189
|
-
start = len
|
190
|
-
len += elem.nodeValue.length;
|
191
|
-
//check if len is now greater than what's in counts
|
192
|
-
replaceWithLess(start, len, range, elem )
|
193
|
-
// Traverse everything else, except comment nodes
|
194
|
-
} else if ( elem.nodeType !== 8 ) {
|
195
|
-
len = getCharElement( elem.childNodes, range, len );
|
196
|
-
}
|
197
|
-
}
|
198
|
-
return len;
|
199
|
-
};
|
200
|
-
/**
|
201
|
-
* @parent jQuery.selection
|
202
|
-
* @function jQuery.fn.selection
|
203
|
-
*
|
204
|
-
* Set or retrieve the currently selected text range. It works on all elements:
|
205
|
-
*
|
206
|
-
* $('#text').selection(8, 12)
|
207
|
-
* $('#text').selection() // -> { start : 8, end : 12, width: 4 }
|
208
|
-
*
|
209
|
-
* @param {Number} [start] Start position of the selection range
|
210
|
-
* @param {Number} [end] End position of the selection range
|
211
|
-
* @return {Object|jQuery} Returns either the jQuery object when setting the selection or
|
212
|
-
* an object containing
|
213
|
-
*
|
214
|
-
* - __start__ - The number of characters from the start of the element to the start of the selection.
|
215
|
-
* - __end__ - The number of characters from the start of the element to the end of the selection.
|
216
|
-
* - __width__ - The width of the selection range.
|
217
|
-
*
|
218
|
-
* when no arguments are passed.
|
219
|
-
*/
|
220
|
-
$.fn.selection = function(start, end){
|
221
|
-
if(start !== undefined){
|
222
|
-
return this.each(function(){
|
223
|
-
select(this, start, end)
|
224
|
-
})
|
225
|
-
}else{
|
226
|
-
return getSelection(this[0])
|
227
|
-
}
|
228
|
-
};
|
229
|
-
// for testing
|
230
|
-
$.fn.selection.getCharElement = getCharElement;
|
231
|
-
|
232
|
-
})(jQuery)
|
@@ -1,103 +0,0 @@
|
|
1
|
-
// - jquery.styles.js
|
2
|
-
(function( $ ) {
|
3
|
-
|
4
|
-
var getComputedStyle = document.defaultView && document.defaultView.getComputedStyle,
|
5
|
-
// The following variables are used to convert camelcased attribute names
|
6
|
-
// into dashed names, e.g. borderWidth to border-width
|
7
|
-
rupper = /([A-Z])/g,
|
8
|
-
rdashAlpha = /-([a-z])/ig,
|
9
|
-
fcamelCase = function( all, letter ) {
|
10
|
-
return letter.toUpperCase();
|
11
|
-
},
|
12
|
-
// Returns the computed style for an elementn
|
13
|
-
getStyle = function( elem ) {
|
14
|
-
if ( getComputedStyle ) {
|
15
|
-
return getComputedStyle(elem, null);
|
16
|
-
}
|
17
|
-
else if ( elem.currentStyle ) {
|
18
|
-
return elem.currentStyle;
|
19
|
-
}
|
20
|
-
},
|
21
|
-
// Checks for float px and numeric values
|
22
|
-
rfloat = /float/i,
|
23
|
-
rnumpx = /^-?\d+(?:px)?$/i,
|
24
|
-
rnum = /^-?\d/;
|
25
|
-
|
26
|
-
// Returns a list of styles for a given element
|
27
|
-
$.styles = function( el, styles ) {
|
28
|
-
if (!el ) {
|
29
|
-
return null;
|
30
|
-
}
|
31
|
-
var currentS = getStyle(el),
|
32
|
-
oldName, val, style = el.style,
|
33
|
-
results = {},
|
34
|
-
i = 0,
|
35
|
-
left, rsLeft, camelCase, name;
|
36
|
-
|
37
|
-
// Go through each style
|
38
|
-
for (; i < styles.length; i++ ) {
|
39
|
-
name = styles[i];
|
40
|
-
oldName = name.replace(rdashAlpha, fcamelCase);
|
41
|
-
|
42
|
-
if ( rfloat.test(name) ) {
|
43
|
-
name = jQuery.support.cssFloat ? "float" : "styleFloat";
|
44
|
-
oldName = "cssFloat";
|
45
|
-
}
|
46
|
-
|
47
|
-
// If we have getComputedStyle available
|
48
|
-
if ( getComputedStyle ) {
|
49
|
-
// convert camelcased property names to dashed name
|
50
|
-
name = name.replace(rupper, "-$1").toLowerCase();
|
51
|
-
// use getPropertyValue of the current style object
|
52
|
-
val = currentS.getPropertyValue(name);
|
53
|
-
// default opacity is 1
|
54
|
-
if ( name === "opacity" && val === "" ) {
|
55
|
-
val = "1";
|
56
|
-
}
|
57
|
-
results[oldName] = val;
|
58
|
-
} else {
|
59
|
-
// Without getComputedStyles
|
60
|
-
camelCase = name.replace(rdashAlpha, fcamelCase);
|
61
|
-
results[oldName] = currentS[name] || currentS[camelCase];
|
62
|
-
|
63
|
-
// convert to px
|
64
|
-
if (!rnumpx.test(results[oldName]) && rnum.test(results[oldName]) ) {
|
65
|
-
// Remember the original values
|
66
|
-
left = style.left;
|
67
|
-
rsLeft = el.runtimeStyle.left;
|
68
|
-
|
69
|
-
// Put in the new values to get a computed value out
|
70
|
-
el.runtimeStyle.left = el.currentStyle.left;
|
71
|
-
style.left = camelCase === "fontSize" ? "1em" : (results[oldName] || 0);
|
72
|
-
results[oldName] = style.pixelLeft + "px";
|
73
|
-
|
74
|
-
// Revert the changed values
|
75
|
-
style.left = left;
|
76
|
-
el.runtimeStyle.left = rsLeft;
|
77
|
-
}
|
78
|
-
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
return results;
|
83
|
-
};
|
84
|
-
|
85
|
-
/**
|
86
|
-
* @function jQuery.fn.styles
|
87
|
-
* @parent jQuery.styles
|
88
|
-
* @plugin jQuery.styles
|
89
|
-
*
|
90
|
-
* Returns a set of computed styles. Pass the names of the styles you want to
|
91
|
-
* retrieve as arguments:
|
92
|
-
*
|
93
|
-
* $("div").styles('float','display')
|
94
|
-
* // -> { cssFloat: "left", display: "block" }
|
95
|
-
*
|
96
|
-
* @param {String} style pass the names of the styles to retrieve as the argument list
|
97
|
-
* @return {Object} an object of `style` : `value` pairs
|
98
|
-
*/
|
99
|
-
$.fn.styles = function() {
|
100
|
-
// Pass the arguments as an array to $.styles
|
101
|
-
return $.styles(this[0], $.makeArray(arguments));
|
102
|
-
};
|
103
|
-
})(jQuery)
|
@@ -1,94 +0,0 @@
|
|
1
|
-
// - jquery.within.js
|
2
|
-
(function($){
|
3
|
-
// Checks if x and y coordinates are within a box with left, top, width and height
|
4
|
-
var withinBox = function(x, y, left, top, width, height ){
|
5
|
-
return (y >= top &&
|
6
|
-
y < top + height &&
|
7
|
-
x >= left &&
|
8
|
-
x < left + width);
|
9
|
-
}
|
10
|
-
/**
|
11
|
-
* @function jQuery.fn.within
|
12
|
-
* @parent jQuery.within
|
13
|
-
* @plugin jquery/dom/within
|
14
|
-
*
|
15
|
-
* Returns all elements matching the selector that touch a given point:
|
16
|
-
*
|
17
|
-
* // get all elements that touch 200x200.
|
18
|
-
* $('*').within(200, 200);
|
19
|
-
*
|
20
|
-
* @param {Number} left the position from the left of the page
|
21
|
-
* @param {Number} top the position from the top of the page
|
22
|
-
* @param {Boolean} [useOffsetCache=false] cache the dimensions and offset of the elements.
|
23
|
-
* @return {jQuery} a jQuery collection of elements whos area
|
24
|
-
* overlaps the element position.
|
25
|
-
*/
|
26
|
-
$.fn.within= function(left, top, useOffsetCache) {
|
27
|
-
var ret = []
|
28
|
-
this.each(function(){
|
29
|
-
var q = jQuery(this);
|
30
|
-
|
31
|
-
if (this == document.documentElement) {
|
32
|
-
return ret.push(this);
|
33
|
-
}
|
34
|
-
|
35
|
-
// uses either the cached offset or .offset()
|
36
|
-
var offset = useOffsetCache ?
|
37
|
-
jQuery.data(this,"offsetCache") || jQuery.data(this,"offsetCache", q.offset()) :
|
38
|
-
q.offset();
|
39
|
-
|
40
|
-
// Check if the given coordinates are within the area of the current element
|
41
|
-
var res = withinBox(left, top, offset.left, offset.top,
|
42
|
-
this.offsetWidth, this.offsetHeight );
|
43
|
-
|
44
|
-
if (res) {
|
45
|
-
// Add it to the results
|
46
|
-
ret.push(this);
|
47
|
-
}
|
48
|
-
});
|
49
|
-
|
50
|
-
return this.pushStack( jQuery.unique( ret ), "within", left+","+top );
|
51
|
-
}
|
52
|
-
|
53
|
-
|
54
|
-
/**
|
55
|
-
* @function jQuery.fn.withinBox
|
56
|
-
* @parent jQuery.within
|
57
|
-
*
|
58
|
-
* Returns all elements matching the selector that have a given area in common:
|
59
|
-
*
|
60
|
-
* $('*').withinBox(200, 200, 100, 100)
|
61
|
-
*
|
62
|
-
* @param {Number} left the position from the left of the page
|
63
|
-
* @param {Number} top the position from the top of the page
|
64
|
-
* @param {Number} width the width of the area
|
65
|
-
* @param {Number} height the height of the area
|
66
|
-
* @param {Boolean} [useOffsetCache=false] cache the dimensions and offset of the elements.
|
67
|
-
* @return {jQuery} a jQuery collection of elements whos area
|
68
|
-
* overlaps the element position.
|
69
|
-
*/
|
70
|
-
$.fn.withinBox = function(left, top, width, height, useOffsetCache){
|
71
|
-
var ret = []
|
72
|
-
this.each(function(){
|
73
|
-
var q = jQuery(this);
|
74
|
-
|
75
|
-
if(this == document.documentElement) return ret.push(this);
|
76
|
-
|
77
|
-
// use cached offset or .offset()
|
78
|
-
var offset = cache ?
|
79
|
-
jQuery.data(this,"offset") ||
|
80
|
-
jQuery.data(this,"offset", q.offset()) :
|
81
|
-
q.offset();
|
82
|
-
|
83
|
-
|
84
|
-
var ew = q.width(), eh = q.height(),
|
85
|
-
// Checks if the element offset is within the given box
|
86
|
-
res = !( (offset.top > top+height) || (offset.top +eh < top) || (offset.left > left+width ) || (offset.left+ew < left));
|
87
|
-
|
88
|
-
if(res)
|
89
|
-
ret.push(this);
|
90
|
-
});
|
91
|
-
return this.pushStack( jQuery.unique( ret ), "withinBox", jQuery.makeArray(arguments).join(",") );
|
92
|
-
}
|
93
|
-
|
94
|
-
})(jQuery)
|