jquerypp-rails 1.0.1.1.rc3 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/README.markdown
CHANGED
@@ -1,61 +1,58 @@
|
|
1
1
|
# jquerypp-rails
|
2
2
|
|
3
|
-
jQuery++! For Rails! So great.
|
4
|
-
|
5
3
|
jQuery++ is a collection of all the DOM utilities and special events jQuery forgot about. Come learn about jQuery++ and how it can be useful to your project.
|
6
4
|
|
7
5
|
This gem provides:
|
8
6
|
|
9
7
|
* jQuery++
|
10
8
|
|
11
|
-
|
9
|
+
And includes:
|
10
|
+
|
11
|
+
- DOM HELPERS
|
12
|
+
* Animate
|
13
|
+
* Compare
|
14
|
+
* Cookie
|
15
|
+
* Dimensions
|
16
|
+
* Form Params
|
17
|
+
* Range
|
18
|
+
* Selection
|
19
|
+
* Styles
|
20
|
+
* Within
|
21
|
+
|
22
|
+
- EVENTS
|
23
|
+
* Destroyed
|
24
|
+
* Drag
|
25
|
+
* Drop
|
26
|
+
* Fastfix
|
27
|
+
* Hover
|
28
|
+
* Key
|
29
|
+
* Pause
|
12
30
|
|
13
|
-
Apps generated with Rails 3.1 or later include jquery-rails in the Gemfile by default. So just make a new app:
|
14
31
|
|
15
|
-
|
16
|
-
rails new myapp
|
17
|
-
```
|
32
|
+
## Installation
|
18
33
|
|
19
|
-
|
20
|
-
add the jquery-rails gem to your Gemfile.
|
34
|
+
Add into your Gemfile:
|
21
35
|
|
22
36
|
```ruby
|
23
37
|
gem "jquerypp-rails"
|
24
38
|
```
|
25
39
|
|
26
|
-
And run `bundle install`. The rest of the installation depends on
|
27
|
-
whether the asset pipeline is being used.
|
40
|
+
And run `bundle install`. The rest of the installation depends on whether the asset pipeline is being used.
|
28
41
|
|
29
42
|
### Rails 3.1 or greater (with asset pipeline *enabled*)
|
30
43
|
|
31
|
-
The jquery
|
44
|
+
The jquery++ file will be added to the asset pipeline and available for you to use. If they're not already in `app/assets/javascripts/application.js` by default, add these lines:
|
32
45
|
|
33
46
|
```js
|
34
47
|
//= require jquerypp
|
35
48
|
```
|
36
49
|
|
37
|
-
|
38
|
-
|
39
|
-
### Rails 3.0 (or greater with asset pipeline *disabled*)
|
40
|
-
|
41
|
-
This gem adds a single generator: `jquery:install`. Running the generator will remove any Prototype JS files you may happen to have, and copy jQuery++ to the `public/javascripts` directory.
|
42
|
-
|
43
|
-
This gem will also hook into the Rails configuration process, removing Prototype and adding jQuery to the javascript files included by the `javascript_include_tag(:defaults)` call. While this gem contains the minified and un-minified versions of jQuery and jQuery UI, only the minified versions are included in `:defaults`.
|
44
|
-
|
45
|
-
To invoke the generator, run:
|
50
|
+
You're done!
|
46
51
|
|
47
|
-
|
48
|
-
rails generate jquery:install
|
49
|
-
```
|
52
|
+
## More Info
|
50
53
|
|
51
|
-
|
54
|
+
For more information about all functionality and implementation of it, visit http://jquerypp.com/
|
52
55
|
|
53
56
|
## Contributing
|
54
57
|
|
55
58
|
Feel free to open an issue ticket if you find something that could be improved. A couple notes:
|
56
|
-
|
57
|
-
## Acknowledgements
|
58
|
-
|
59
|
-
Many thanks are due to all of [the jquery-rails contributors](https://github.com/rails/jquery-rails/graphs/contributors). Special thanks to [JangoSteve](http://github.com/JangoSteve) for tirelessly answering questions and accepting patches, and the [Rails Core Team](https://github.com/organizations/rails/teams/617) for making jquery-rails an official part of Rails 3.1.
|
60
|
-
|
61
|
-
Copyright [André Arko](http://arko.net), released under the MIT License.
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquerypp-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.2
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jonathan Tapia
|
@@ -48,29 +48,6 @@ files:
|
|
48
48
|
- lib/jquerypp/rails/engine.rb
|
49
49
|
- lib/jquerypp/rails/version.rb
|
50
50
|
- vendor/assets/javascripts/jquerypp.js
|
51
|
-
- vendor/assets/javascripts/lib/jquery.animate.js
|
52
|
-
- vendor/assets/javascripts/lib/jquery.compare.js
|
53
|
-
- vendor/assets/javascripts/lib/jquery.cookie.js
|
54
|
-
- vendor/assets/javascripts/lib/jquery.dimensions.js
|
55
|
-
- vendor/assets/javascripts/lib/jquery.event.default.js
|
56
|
-
- vendor/assets/javascripts/lib/jquery.event.destroyed.js
|
57
|
-
- vendor/assets/javascripts/lib/jquery.event.drag.js
|
58
|
-
- vendor/assets/javascripts/lib/jquery.event.drop.js
|
59
|
-
- vendor/assets/javascripts/lib/jquery.event.fastfix.js
|
60
|
-
- vendor/assets/javascripts/lib/jquery.event.hover.js
|
61
|
-
- vendor/assets/javascripts/lib/jquery.event.key.js
|
62
|
-
- vendor/assets/javascripts/lib/jquery.event.livehack.js
|
63
|
-
- vendor/assets/javascripts/lib/jquery.event.pause.js
|
64
|
-
- vendor/assets/javascripts/lib/jquery.event.resize.js
|
65
|
-
- vendor/assets/javascripts/lib/jquery.event.swipe.js
|
66
|
-
- vendor/assets/javascripts/lib/jquery.fills.js
|
67
|
-
- vendor/assets/javascripts/lib/jquery.form_params.js
|
68
|
-
- vendor/assets/javascripts/lib/jquery.lang.json.js
|
69
|
-
- vendor/assets/javascripts/lib/jquery.lang.vector.js
|
70
|
-
- vendor/assets/javascripts/lib/jquery.range.js
|
71
|
-
- vendor/assets/javascripts/lib/jquery.selection.js
|
72
|
-
- vendor/assets/javascripts/lib/jquery.styles.js
|
73
|
-
- vendor/assets/javascripts/lib/jquery.within.js
|
74
51
|
homepage: http://rubygems.org/gems/jquerypp-rails
|
75
52
|
licenses: []
|
76
53
|
post_install_message:
|
@@ -1,326 +0,0 @@
|
|
1
|
-
// Dependencies:
|
2
|
-
//
|
3
|
-
// - jquery.animate.js
|
4
|
-
// - jquery.styles.js
|
5
|
-
|
6
|
-
(function ($) {
|
7
|
-
|
8
|
-
// Overwrites `jQuery.fn.animate` to use CSS 3 animations if possible
|
9
|
-
|
10
|
-
var
|
11
|
-
// The global animation counter
|
12
|
-
animationNum = 0,
|
13
|
-
// The stylesheet for our animations
|
14
|
-
styleSheet = null,
|
15
|
-
// The animation cache
|
16
|
-
cache = [],
|
17
|
-
// Stores the browser properties like transition end event name and prefix
|
18
|
-
browser = null,
|
19
|
-
// Store the original $.fn.animate
|
20
|
-
oldanimate = $.fn.animate,
|
21
|
-
|
22
|
-
// Return the stylesheet, create it if it doesn't exists
|
23
|
-
getStyleSheet = function () {
|
24
|
-
if(!styleSheet) {
|
25
|
-
var style = document.createElement('style');
|
26
|
-
style.setAttribute("type", "text/css");
|
27
|
-
style.setAttribute("media", "screen");
|
28
|
-
|
29
|
-
document.getElementsByTagName('head')[0].appendChild(style);
|
30
|
-
if (!window.createPopup) { /* For Safari */
|
31
|
-
style.appendChild(document.createTextNode(''));
|
32
|
-
}
|
33
|
-
|
34
|
-
styleSheet = style.sheet;
|
35
|
-
}
|
36
|
-
|
37
|
-
return styleSheet;
|
38
|
-
},
|
39
|
-
|
40
|
-
//removes an animation rule from a sheet
|
41
|
-
removeAnimation = function (sheet, name) {
|
42
|
-
for (var j = sheet.cssRules.length - 1; j >= 0; j--) {
|
43
|
-
var rule = sheet.cssRules[j];
|
44
|
-
// 7 means the keyframe rule
|
45
|
-
if (rule.type === 7 && rule.name == name) {
|
46
|
-
sheet.deleteRule(j)
|
47
|
-
return;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
},
|
51
|
-
|
52
|
-
// Returns whether the animation should be passed to the original $.fn.animate.
|
53
|
-
passThrough = function (props, ops) {
|
54
|
-
var nonElement = !(this[0] && this[0].nodeType),
|
55
|
-
isInline = !nonElement && $(this).css("display") === "inline" && $(this).css("float") === "none";
|
56
|
-
|
57
|
-
for (var name in props) {
|
58
|
-
// jQuery does something with these values
|
59
|
-
if (props[name] == 'show' || props[name] == 'hide' || props[name] == 'toggle'
|
60
|
-
// Arrays for individual easing
|
61
|
-
|| $.isArray(props[name])
|
62
|
-
// Negative values not handled the same
|
63
|
-
|| props[name] < 0
|
64
|
-
// unit-less value
|
65
|
-
|| name == 'zIndex' || name == 'z-index'
|
66
|
-
) {
|
67
|
-
return true;
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
return props.jquery === true || getBrowser() === null ||
|
72
|
-
// Animating empty properties
|
73
|
-
$.isEmptyObject(props) ||
|
74
|
-
// We can't do custom easing
|
75
|
-
ops.length == 4 || typeof ops[2] == 'string' ||
|
76
|
-
// Second parameter is an object - we can only handle primitives
|
77
|
-
$.isPlainObject(ops) ||
|
78
|
-
// Inline and non elements
|
79
|
-
isInline || nonElement;
|
80
|
-
},
|
81
|
-
|
82
|
-
// Gets a CSS number (with px added as the default unit if the value is a number)
|
83
|
-
cssValue = function(origName, value) {
|
84
|
-
if (typeof value === "number" && !$.cssNumber[ origName ]) {
|
85
|
-
return value += "px";
|
86
|
-
}
|
87
|
-
return value;
|
88
|
-
},
|
89
|
-
|
90
|
-
// Feature detection borrowed by http://modernizr.com/
|
91
|
-
getBrowser = function(){
|
92
|
-
if(!browser) {
|
93
|
-
var t,
|
94
|
-
el = document.createElement('fakeelement'),
|
95
|
-
transitions = {
|
96
|
-
'transition': {
|
97
|
-
transitionEnd : 'transitionEnd',
|
98
|
-
prefix : ''
|
99
|
-
},
|
100
|
-
// 'OTransition': {
|
101
|
-
// transitionEnd : 'oTransitionEnd',
|
102
|
-
// prefix : '-o-'
|
103
|
-
// },
|
104
|
-
// 'MSTransition': {
|
105
|
-
// transitionEnd : 'msTransitionEnd',
|
106
|
-
// prefix : '-ms-'
|
107
|
-
// },
|
108
|
-
'MozTransition': {
|
109
|
-
transitionEnd : 'animationend',
|
110
|
-
prefix : '-moz-'
|
111
|
-
},
|
112
|
-
'WebkitTransition': {
|
113
|
-
transitionEnd : 'webkitAnimationEnd',
|
114
|
-
prefix : '-webkit-'
|
115
|
-
}
|
116
|
-
}
|
117
|
-
|
118
|
-
for(t in transitions){
|
119
|
-
if( el.style[t] !== undefined ){
|
120
|
-
browser = transitions[t];
|
121
|
-
}
|
122
|
-
}
|
123
|
-
}
|
124
|
-
return browser;
|
125
|
-
},
|
126
|
-
|
127
|
-
// Properties that Firefox can't animate if set to 'auto':
|
128
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=571344
|
129
|
-
// Provides a converter that returns the actual value
|
130
|
-
ffProps = {
|
131
|
-
top : function(el) {
|
132
|
-
return el.position().top;
|
133
|
-
},
|
134
|
-
left : function(el) {
|
135
|
-
return el.position().left;
|
136
|
-
},
|
137
|
-
width : function(el) {
|
138
|
-
return el.width();
|
139
|
-
},
|
140
|
-
height : function(el) {
|
141
|
-
return el.height();
|
142
|
-
},
|
143
|
-
fontSize : function(el) {
|
144
|
-
return '1em';
|
145
|
-
}
|
146
|
-
},
|
147
|
-
|
148
|
-
// Add browser specific prefix
|
149
|
-
addPrefix = function(properties) {
|
150
|
-
var result = {};
|
151
|
-
$.each(properties, function(name, value) {
|
152
|
-
result[getBrowser().prefix + name] = value;
|
153
|
-
});
|
154
|
-
return result;
|
155
|
-
},
|
156
|
-
|
157
|
-
// Returns the animation name for a given style. It either uses a cached
|
158
|
-
// version or adds it to the stylesheet, removing the oldest style if the
|
159
|
-
// cache has reached a certain size.
|
160
|
-
getAnimation = function(style) {
|
161
|
-
var sheet, name, last;
|
162
|
-
|
163
|
-
// Look up the cached style, set it to that name and reset age if found
|
164
|
-
// increment the age for any other animation
|
165
|
-
$.each(cache, function(i, animation) {
|
166
|
-
if(style === animation.style) {
|
167
|
-
name = animation.name;
|
168
|
-
animation.age = 0;
|
169
|
-
} else {
|
170
|
-
animation.age += 1;
|
171
|
-
}
|
172
|
-
});
|
173
|
-
|
174
|
-
if(!name) { // Add a new style
|
175
|
-
sheet = getStyleSheet();
|
176
|
-
name = "jquerypp_animation_" + (animationNum++);
|
177
|
-
// get the last sheet and insert this rule into it
|
178
|
-
sheet.insertRule("@" + getBrowser().prefix + "keyframes " + name + ' ' + style,
|
179
|
-
(sheet.cssRules && sheet.cssRules.length) || 0);
|
180
|
-
cache.push({
|
181
|
-
name : name,
|
182
|
-
style : style,
|
183
|
-
age : 0
|
184
|
-
});
|
185
|
-
|
186
|
-
// Sort the cache by age
|
187
|
-
cache.sort(function(first, second) {
|
188
|
-
return first.age - second.age;
|
189
|
-
});
|
190
|
-
|
191
|
-
// Remove the last (oldest) item from the cache if it has more than 20 items
|
192
|
-
if(cache.length > 20) {
|
193
|
-
last = cache.pop();
|
194
|
-
removeAnimation(sheet, last.name);
|
195
|
-
}
|
196
|
-
}
|
197
|
-
|
198
|
-
return name;
|
199
|
-
};
|
200
|
-
|
201
|
-
/**
|
202
|
-
* @function $.fn.animate
|
203
|
-
* @parent $.animate
|
204
|
-
*
|
205
|
-
* Animate CSS properties using native CSS animations, if possible.
|
206
|
-
* Uses the original [$.fn.animate()](http://api.$.com/animate/) otherwise.
|
207
|
-
*
|
208
|
-
* @param {Object} props The CSS properties to animate
|
209
|
-
* @param {Integer|String|Object} [speed=400] The animation duration in ms.
|
210
|
-
* Will use $.fn.animate if a string or object is passed
|
211
|
-
* @param {Function} [callback] A callback to execute once the animation is complete
|
212
|
-
* @return {jQuery} The jQuery element
|
213
|
-
*/
|
214
|
-
$.fn.animate = function (props, speed, easing, callback) {
|
215
|
-
//default to normal animations if browser doesn't support them
|
216
|
-
if (passThrough.apply(this, arguments)) {
|
217
|
-
return oldanimate.apply(this, arguments);
|
218
|
-
}
|
219
|
-
|
220
|
-
var optall = jQuery.speed(speed, easing, callback);
|
221
|
-
|
222
|
-
// Add everything to the animation queue
|
223
|
-
this.queue(optall.queue, function(done) {
|
224
|
-
var
|
225
|
-
//current CSS values
|
226
|
-
current,
|
227
|
-
// The list of properties passed
|
228
|
-
properties = [],
|
229
|
-
to = "",
|
230
|
-
prop,
|
231
|
-
self = $(this),
|
232
|
-
duration = optall.duration,
|
233
|
-
//the animation keyframe name
|
234
|
-
animationName,
|
235
|
-
// The key used to store the animation hook
|
236
|
-
dataKey,
|
237
|
-
//the text for the keyframe
|
238
|
-
style = "{ from {",
|
239
|
-
// The animation end event handler.
|
240
|
-
// Will be called both on animation end and after calling .stop()
|
241
|
-
animationEnd = function (currentCSS, exec) {
|
242
|
-
self.css(currentCSS);
|
243
|
-
|
244
|
-
self.css(addPrefix({
|
245
|
-
"animation-duration" : "",
|
246
|
-
"animation-name" : "",
|
247
|
-
"animation-fill-mode" : "",
|
248
|
-
"animation-play-state" : ""
|
249
|
-
}));
|
250
|
-
|
251
|
-
// Call the original callback
|
252
|
-
if (optall.old && exec) {
|
253
|
-
// Call success, pass the DOM element as the this reference
|
254
|
-
optall.old.call(self[0], true)
|
255
|
-
}
|
256
|
-
|
257
|
-
$.removeData(self, dataKey, true);
|
258
|
-
}
|
259
|
-
|
260
|
-
for(prop in props) {
|
261
|
-
properties.push(prop);
|
262
|
-
}
|
263
|
-
|
264
|
-
if(getBrowser().prefix === '-moz-') {
|
265
|
-
// Normalize 'auto' properties in FF
|
266
|
-
$.each(properties, function(i, prop) {
|
267
|
-
var converter = ffProps[$.camelCase(prop)];
|
268
|
-
if(converter && self.css(prop) == 'auto') {
|
269
|
-
self.css(prop, converter(self));
|
270
|
-
}
|
271
|
-
});
|
272
|
-
}
|
273
|
-
|
274
|
-
// Use $.styles
|
275
|
-
current = self.styles.apply(self, properties);
|
276
|
-
$.each(properties, function(i, cur) {
|
277
|
-
// Convert a camelcased property name
|
278
|
-
var name = cur.replace(/([A-Z]|^ms)/g, "-$1" ).toLowerCase();
|
279
|
-
style += name + " : " + cssValue(cur, current[cur]) + "; ";
|
280
|
-
to += name + " : " + cssValue(cur, props[cur]) + "; ";
|
281
|
-
});
|
282
|
-
|
283
|
-
style += "} to {" + to + " }}";
|
284
|
-
|
285
|
-
animationName = getAnimation(style);
|
286
|
-
dataKey = animationName + '.run';
|
287
|
-
|
288
|
-
// Add a hook which will be called when the animation stops
|
289
|
-
$._data(this, dataKey, {
|
290
|
-
stop : function(gotoEnd) {
|
291
|
-
// Pause the animation
|
292
|
-
self.css(addPrefix({
|
293
|
-
'animation-play-state' : 'paused'
|
294
|
-
}));
|
295
|
-
// Unbind the animation end handler
|
296
|
-
self.off(getBrowser().transitionEnd, animationEnd);
|
297
|
-
if(!gotoEnd) {
|
298
|
-
// We were told not to finish the animation
|
299
|
-
// Call animationEnd but set the CSS to the current computed style
|
300
|
-
animationEnd(self.styles.apply(self, properties), false);
|
301
|
-
} else {
|
302
|
-
// Finish animaion
|
303
|
-
animationEnd(props, true);
|
304
|
-
}
|
305
|
-
}
|
306
|
-
});
|
307
|
-
|
308
|
-
// set this element to point to that animation
|
309
|
-
self.css(addPrefix({
|
310
|
-
"animation-duration" : duration + "ms",
|
311
|
-
"animation-name" : animationName,
|
312
|
-
"animation-fill-mode": "forwards"
|
313
|
-
}));
|
314
|
-
|
315
|
-
// Attach the transition end event handler to run only once
|
316
|
-
self.one(getBrowser().transitionEnd, function() {
|
317
|
-
// Call animationEnd using the passed properties
|
318
|
-
animationEnd(props, true);
|
319
|
-
done();
|
320
|
-
});
|
321
|
-
|
322
|
-
});
|
323
|
-
|
324
|
-
return this;
|
325
|
-
};
|
326
|
-
})(jQuery)
|