jquerypp-rails 1.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.
- data/.document +5 -0
- data/.gitignore +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +24 -0
- data/Rakefile +2 -0
- data/jquerypp-rails.gemspec +20 -0
- data/lib/jquerypp/generators/jquerypp/install/install_generator.rb +49 -0
- data/lib/jquerypp/rails/engine.rb +8 -0
- data/lib/jquerypp/rails/version.rb +6 -0
- data/lib/jquerypp/rails.rb +8 -0
- data/lib/jquerypp-rails.rb +1 -0
- data/vendor/assets/javascripts/jquerypp.js +5419 -0
- data/vendor/assets/javascripts/lib/jquery.animate.js +326 -0
- data/vendor/assets/javascripts/lib/jquery.compare.js +75 -0
- data/vendor/assets/javascripts/lib/jquery.cookie.js +118 -0
- data/vendor/assets/javascripts/lib/jquery.dimensions.js +191 -0
- data/vendor/assets/javascripts/lib/jquery.event.default.js +115 -0
- data/vendor/assets/javascripts/lib/jquery.event.destroyed.js +23 -0
- data/vendor/assets/javascripts/lib/jquery.event.drag.js +727 -0
- data/vendor/assets/javascripts/lib/jquery.event.drop.js +457 -0
- data/vendor/assets/javascripts/lib/jquery.event.fastfix.js +95 -0
- data/vendor/assets/javascripts/lib/jquery.event.hover.js +266 -0
- data/vendor/assets/javascripts/lib/jquery.event.key.js +156 -0
- data/vendor/assets/javascripts/lib/jquery.event.livehack.js +174 -0
- data/vendor/assets/javascripts/lib/jquery.event.pause.js +92 -0
- data/vendor/assets/javascripts/lib/jquery.event.resize.js +47 -0
- data/vendor/assets/javascripts/lib/jquery.event.swipe.js +133 -0
- data/vendor/assets/javascripts/lib/jquery.fills.js +249 -0
- data/vendor/assets/javascripts/lib/jquery.form_params.js +167 -0
- data/vendor/assets/javascripts/lib/jquery.lang.json.js +196 -0
- data/vendor/assets/javascripts/lib/jquery.lang.vector.js +214 -0
- data/vendor/assets/javascripts/lib/jquery.range.js +861 -0
- data/vendor/assets/javascripts/lib/jquery.selection.js +232 -0
- data/vendor/assets/javascripts/lib/jquery.styles.js +103 -0
- data/vendor/assets/javascripts/lib/jquery.within.js +94 -0
- metadata +81 -0
@@ -0,0 +1,191 @@
|
|
1
|
+
// Dependencies:
|
2
|
+
//
|
3
|
+
// - jquery.dimensions.js
|
4
|
+
// - jquery.styles.js
|
5
|
+
|
6
|
+
(function($) {
|
7
|
+
|
8
|
+
var
|
9
|
+
//margin is inside border
|
10
|
+
weird = /button|select/i,
|
11
|
+
getBoxes = {},
|
12
|
+
checks = {
|
13
|
+
width: ["Left", "Right"],
|
14
|
+
height: ['Top', 'Bottom'],
|
15
|
+
oldOuterHeight: $.fn.outerHeight,
|
16
|
+
oldOuterWidth: $.fn.outerWidth,
|
17
|
+
oldInnerWidth: $.fn.innerWidth,
|
18
|
+
oldInnerHeight: $.fn.innerHeight
|
19
|
+
};
|
20
|
+
|
21
|
+
$.each({
|
22
|
+
|
23
|
+
/**
|
24
|
+
* @function jQuery.fn.outerWidth
|
25
|
+
* @parent jQuery.dimensions
|
26
|
+
*
|
27
|
+
* `jQuery.fn.outerWidth([value], [includeMargins])` lets you set
|
28
|
+
* the outer width of an object where:
|
29
|
+
*
|
30
|
+
* outerWidth = width + padding + border + (margin)
|
31
|
+
*
|
32
|
+
* And can be used like:
|
33
|
+
*
|
34
|
+
* $("#foo").outerWidth(100); //sets outer width
|
35
|
+
* $("#foo").outerWidth(100, true); // uses margins
|
36
|
+
* $("#foo").outerWidth(); //returns outer width
|
37
|
+
* $("#foo").outerWidth(true); //returns outer width + margins
|
38
|
+
*
|
39
|
+
* When setting the outerWidth, it adjusts the width of the element.
|
40
|
+
* If *includeMargin* is set to `true` margins will also be included.
|
41
|
+
* It is also possible to animate the outer width:
|
42
|
+
*
|
43
|
+
* $('#foo').animate({ outerWidth: 200 });
|
44
|
+
*
|
45
|
+
* @param {Number} [width] The width to set
|
46
|
+
* @param {Boolean} [includeMargin=false] Makes setting the outerWidth adjust
|
47
|
+
* for margins.
|
48
|
+
* @return {jQuery|Number} Returns the outer width or the jQuery wrapped elements
|
49
|
+
* if you are setting the outer width.
|
50
|
+
*/
|
51
|
+
width:
|
52
|
+
/**
|
53
|
+
* @function jQuery.fn.innerWidth
|
54
|
+
* @parent jQuery.dimensions
|
55
|
+
*
|
56
|
+
* `jQuery.fn.innerWidth([value])` lets you set the inner width of an element where
|
57
|
+
*
|
58
|
+
* innerWidth = width + padding
|
59
|
+
*
|
60
|
+
* Use it like:
|
61
|
+
*
|
62
|
+
* $("#foo").innerWidth(100); //sets inner width
|
63
|
+
* $("#foo").outerWidth(); // returns inner width
|
64
|
+
*
|
65
|
+
* Or in an animation like:
|
66
|
+
*
|
67
|
+
* $('#foo').animate({ innerWidth : 200 });
|
68
|
+
*
|
69
|
+
* Setting inner width adjusts the width of the element.
|
70
|
+
*
|
71
|
+
* @param {Number} [width] The inner width to set
|
72
|
+
* @return {jQuery|Number} Returns the inner width or the jQuery wrapped elements
|
73
|
+
* if you are setting the inner width.
|
74
|
+
*/
|
75
|
+
"Width",
|
76
|
+
/**
|
77
|
+
* @function jQuery.fn.outerHeight
|
78
|
+
* @parent jQuery.dimensions
|
79
|
+
*
|
80
|
+
* `jQuery.fn.outerHeight([value], [includeMargins])` lets
|
81
|
+
* you set the outer height of an object where:
|
82
|
+
*
|
83
|
+
* outerHeight = height + padding + border + (margin)
|
84
|
+
*
|
85
|
+
* And can be used like:
|
86
|
+
*
|
87
|
+
* $("#foo").outerHeight(100); //sets outer height
|
88
|
+
* $("#foo").outerHeight(100, true); // uses margins
|
89
|
+
* $("#foo").outerHeight(); //returns outer height
|
90
|
+
* $("#foo").outerHeight(true); //returns outer height + margins
|
91
|
+
*
|
92
|
+
* When setting the outerHeight, it adjusts the height of the element.
|
93
|
+
* If *includeMargin* is set to `true` margins will also be included.
|
94
|
+
* It is also possible to animate the outer heihgt:
|
95
|
+
*
|
96
|
+
* $('#foo').animate({ outerHeight : 200 });
|
97
|
+
*
|
98
|
+
* @param {Number} [height] The height to set
|
99
|
+
* @param {Boolean} [includeMargin=false] Makes setting the outerHeight adjust
|
100
|
+
* for margins.
|
101
|
+
* @return {jQuery|Number} Returns the outer height or the jQuery wrapped elements
|
102
|
+
* if you are setting the outer height.
|
103
|
+
*/
|
104
|
+
height:
|
105
|
+
/**
|
106
|
+
* @function jQuery.fn.innerHeight
|
107
|
+
* @parent jQuery.dimensions
|
108
|
+
*
|
109
|
+
* `jQuery.fn.innerHeight([value])` lets you set the inner height of an element where
|
110
|
+
*
|
111
|
+
* innerHeight = height + padding
|
112
|
+
*
|
113
|
+
* Use it like:
|
114
|
+
*
|
115
|
+
* $("#foo").innerHeight(100); //sets inner height
|
116
|
+
* $("#foo").outerHeight(); // returns inner height
|
117
|
+
*
|
118
|
+
* Or in an animation like:
|
119
|
+
*
|
120
|
+
* $('#foo').animate({ innerHeight : 200 });
|
121
|
+
*
|
122
|
+
* Setting inner height adjusts the height of the element.
|
123
|
+
*
|
124
|
+
* @param {Number} [height] The inner height to set
|
125
|
+
* @return {jQuery|Number} Returns the inner height or the jQuery wrapped elements
|
126
|
+
* if you are setting the inner height.
|
127
|
+
*/
|
128
|
+
// for each 'height' and 'width'
|
129
|
+
"Height" }, function(lower, Upper) {
|
130
|
+
|
131
|
+
//used to get the padding and border for an element in a given direction
|
132
|
+
getBoxes[lower] = function(el, boxes) {
|
133
|
+
var val = 0;
|
134
|
+
if (!weird.test(el.nodeName)) {
|
135
|
+
//make what to check for ....
|
136
|
+
var myChecks = [];
|
137
|
+
$.each(checks[lower], function() {
|
138
|
+
var direction = this;
|
139
|
+
$.each(boxes, function(name, val) {
|
140
|
+
if (val)
|
141
|
+
myChecks.push(name + direction+ (name == 'border' ? "Width" : "") );
|
142
|
+
})
|
143
|
+
})
|
144
|
+
$.each($.styles(el, myChecks), function(name, value) {
|
145
|
+
val += (parseFloat(value) || 0);
|
146
|
+
})
|
147
|
+
}
|
148
|
+
return val;
|
149
|
+
}
|
150
|
+
|
151
|
+
//getter / setter
|
152
|
+
$.fn["outer" + Upper] = function(v, margin) {
|
153
|
+
var first = this[0];
|
154
|
+
if (typeof v == 'number') {
|
155
|
+
// Setting the value
|
156
|
+
first && this[lower](v - getBoxes[lower](first, {padding: true, border: true, margin: margin}))
|
157
|
+
return this;
|
158
|
+
} else {
|
159
|
+
// Return the old value
|
160
|
+
return first ? checks["oldOuter" + Upper].call(this, v) : null;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
$.fn["inner" + Upper] = function(v) {
|
164
|
+
var first = this[0];
|
165
|
+
if (typeof v == 'number') {
|
166
|
+
// Setting the value
|
167
|
+
first&& this[lower](v - getBoxes[lower](first, { padding: true }))
|
168
|
+
return this;
|
169
|
+
} else {
|
170
|
+
// Return the old value
|
171
|
+
return first ? checks["oldInner" + Upper].call(this, v) : null;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
//provides animations
|
175
|
+
var animate = function(boxes){
|
176
|
+
// Return the animation function
|
177
|
+
return function(fx){
|
178
|
+
if (fx.state == 0) {
|
179
|
+
fx.start = $(fx.elem)[lower]();
|
180
|
+
fx.end = fx.end - getBoxes[lower](fx.elem,boxes);
|
181
|
+
}
|
182
|
+
fx.elem.style[lower] = (fx.pos * (fx.end - fx.start) + fx.start) + "px"
|
183
|
+
}
|
184
|
+
}
|
185
|
+
$.fx.step["outer" + Upper] = animate({padding: true, border: true})
|
186
|
+
$.fx.step["outer" + Upper+"Margin"] = animate({padding: true, border: true, margin: true})
|
187
|
+
$.fx.step["inner" + Upper] = animate({padding: true})
|
188
|
+
|
189
|
+
})
|
190
|
+
|
191
|
+
})(jQuery)
|
@@ -0,0 +1,115 @@
|
|
1
|
+
// - jquery.event.default.js
|
2
|
+
(function($){
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @function jQuery.fn.triggerAsync
|
6
|
+
* @parent jQuery.event.pause
|
7
|
+
* @plugin jquery/event/default
|
8
|
+
*
|
9
|
+
* `jQuery.fn.triggerAsync(type, [data], [success], [prevented]` triggers an event and calls success
|
10
|
+
* when the event has finished propagating through the DOM and no other handler
|
11
|
+
* called `event.preventDefault()` or returned `false`.
|
12
|
+
*
|
13
|
+
* $('#panel').triggerAsync('show', function() {
|
14
|
+
* $('#panel').show();
|
15
|
+
* });
|
16
|
+
*
|
17
|
+
* You can also provide a callback that gets called if `event.preventDefault()` was called on the event:
|
18
|
+
*
|
19
|
+
* $('panel').triggerAsync('show', function(){
|
20
|
+
* $('#panel').show();
|
21
|
+
* },function(){
|
22
|
+
* $('#other').addClass('error');
|
23
|
+
* });
|
24
|
+
*
|
25
|
+
* @param {String} type The type of event
|
26
|
+
* @param {Object} data The data for the event
|
27
|
+
* @param {Function} success a callback function which occurs upon success
|
28
|
+
* @param {Function} prevented a callback function which occurs if preventDefault was called
|
29
|
+
*/
|
30
|
+
$.fn.triggerAsync = function(type, data, success, prevented){
|
31
|
+
if(typeof data == 'function'){
|
32
|
+
success = data;
|
33
|
+
data = undefined;
|
34
|
+
}
|
35
|
+
|
36
|
+
if ( this[0] ) {
|
37
|
+
// Create a new jQuery event object and store the original preventDefault
|
38
|
+
var event = $.Event( type ),
|
39
|
+
old = event.preventDefault;
|
40
|
+
|
41
|
+
event.preventDefault = function(){
|
42
|
+
old.apply(this, arguments);
|
43
|
+
// call the prevented callback when event.preventDefault is called
|
44
|
+
prevented && prevented(this)
|
45
|
+
}
|
46
|
+
// Trigger the event with the success callback as the success handler
|
47
|
+
jQuery.event.trigger( {type: type, _success: success}, data, this[0] );
|
48
|
+
} else{
|
49
|
+
// If we have no elements call the success callback right away
|
50
|
+
success.call(this);
|
51
|
+
}
|
52
|
+
return this;
|
53
|
+
}
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
/**
|
58
|
+
* @add jQuery.event.special
|
59
|
+
*/
|
60
|
+
//cache default types for performance
|
61
|
+
var types = {}, rnamespaces= /\.(.*)$/, $event = $.event;
|
62
|
+
/**
|
63
|
+
* @attribute default
|
64
|
+
* @parent specialevents
|
65
|
+
* @plugin jquery/event/default
|
66
|
+
* @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/event/default/default.js
|
67
|
+
* @test jquery/event/default/qunit.html
|
68
|
+
*
|
69
|
+
*/
|
70
|
+
$event.special["default"] = {
|
71
|
+
add: function( handleObj ) {
|
72
|
+
//save the type
|
73
|
+
types[handleObj.namespace.replace(rnamespaces,"")] = true;
|
74
|
+
},
|
75
|
+
setup: function() {return true}
|
76
|
+
}
|
77
|
+
|
78
|
+
// overwrite trigger to allow default types
|
79
|
+
var oldTrigger = $event.trigger;
|
80
|
+
|
81
|
+
$event.trigger = function defaultTriggerer( event, data, elem, onlyHandlers){
|
82
|
+
// Event object or event type
|
83
|
+
var type = event.type || event,
|
84
|
+
// Caller can pass in an Event, Object, or just an event type string
|
85
|
+
event = typeof event === "object" ?
|
86
|
+
// jQuery.Event object
|
87
|
+
event[ jQuery.expando ] ? event :
|
88
|
+
// Object literal
|
89
|
+
new jQuery.Event( type, event ) :
|
90
|
+
// Just the event type (string)
|
91
|
+
new jQuery.Event( type),
|
92
|
+
res = oldTrigger.call($.event, event, data, elem, onlyHandlers);
|
93
|
+
|
94
|
+
if(!onlyHandlers && !event.isDefaultPrevented() && event.type.indexOf("default") !== 0) {
|
95
|
+
// Trigger the default. event
|
96
|
+
oldTrigger("default."+event.type, data, elem)
|
97
|
+
if(event._success){
|
98
|
+
event._success(event)
|
99
|
+
}
|
100
|
+
}
|
101
|
+
// code for paused
|
102
|
+
if( event.isPaused && event.isPaused() ){
|
103
|
+
// set back original stuff
|
104
|
+
event.isDefaultPrevented =
|
105
|
+
event.pausedState.isDefaultPrevented;
|
106
|
+
event.isPropagationStopped =
|
107
|
+
event.pausedState.isPropagationStopped;
|
108
|
+
}
|
109
|
+
return res;
|
110
|
+
};
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
})(jQuery)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
// - jquery.event.destroyed.js
|
2
|
+
(function( $ ) {
|
3
|
+
/**
|
4
|
+
* @attribute destroyed
|
5
|
+
* @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/dom/destroyed/destroyed.js
|
6
|
+
* @test jquery/event/destroyed/qunit.html
|
7
|
+
*/
|
8
|
+
|
9
|
+
// Store the old jQuery.cleanData
|
10
|
+
var oldClean = jQuery.cleanData;
|
11
|
+
|
12
|
+
// Overwrites cleanData which is called by jQuery on manipulation methods
|
13
|
+
$.cleanData = function( elems ) {
|
14
|
+
for ( var i = 0, elem;
|
15
|
+
(elem = elems[i]) !== undefined; i++ ) {
|
16
|
+
// Trigger the destroyed event
|
17
|
+
$(elem).triggerHandler("destroyed");
|
18
|
+
}
|
19
|
+
// Call the old jQuery.cleanData
|
20
|
+
oldClean(elems);
|
21
|
+
};
|
22
|
+
|
23
|
+
})(jQuery)
|